logarithm

Highcharts: Displaying zero values in logarithmic scale

落爺英雄遲暮 提交于 2019-12-29 08:08:22
问题 I am working with logarithmic scale in the y-axis I know that log(0) doesn't exist but I need to draw 0 values, and I need a log scale. I read in other answers that changing the zero values to null solve the problem, but it is not working for me. See the example: http://jsfiddle.net/QEK3x/15/ Thank you in advance. 回答1: Although not perfect, the best I came up with was to set the zero point to 0.0001 and then set the y-axis min to 0.0001: http://jsfiddle.net/6LHT8/ yAxis: { min:0.0001, type:

Highcharts: Displaying zero values in logarithmic scale

大憨熊 提交于 2019-12-29 08:08:07
问题 I am working with logarithmic scale in the y-axis I know that log(0) doesn't exist but I need to draw 0 values, and I need a log scale. I read in other answers that changing the zero values to null solve the problem, but it is not working for me. See the example: http://jsfiddle.net/QEK3x/15/ Thank you in advance. 回答1: Although not perfect, the best I came up with was to set the zero point to 0.0001 and then set the y-axis min to 0.0001: http://jsfiddle.net/6LHT8/ yAxis: { min:0.0001, type:

De Bruijn-like sequence for `2^n - 1`: how is it constructed?

那年仲夏 提交于 2019-12-29 02:51:07
问题 I'm looking at the entry Find the log base 2 of an N-bit integer in O(lg(N)) operations with multiply and lookup from Bit Twiddling hacks. I can easily see how the second algorithm in that entry works static const int MultiplyDeBruijnBitPosition2[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; r = MultiplyDeBruijnBitPosition2[(uint32_t)(v * 0x077CB531U) >> 27]; which calculates n = log2 v where v is known to be a

Custom logarithmic axis scaling in matplotlib

不打扰是莪最后的温柔 提交于 2019-12-28 04:32:11
问题 I'm trying to scale the x axis of a plot with math.log(1+x) instead of the usual 'log' scale option, and I've looked over some of the custom scaling examples but I can't get mine to work! Here's my MWE: import matplotlib.pyplot as plt import numpy as np import math from matplotlib.ticker import FormatStrFormatter from matplotlib import scale as mscale from matplotlib import transforms as mtransforms class CustomScale(mscale.ScaleBase): name = 'custom' def __init__(self, axis, **kwargs):

gnuplot: how to get correct order of magnitude?

廉价感情. 提交于 2019-12-24 11:28:24
问题 This question/issue is maybe related somehow to this topic. If you type: print log10(1e7) you will get 7.0 . print int(log10(1e7)) you will get 7 . However, if you type print log10(1e6) you will get 6.0 . print int(log10(1e6)) you will get 5 . These are probably rounding errors related to log10 and cannot(?) be avoided. Because if you type print sprintf("%.20e",log10(1e6)) gives 5.99999999999999911182e+00 print sprintf("%.20e",log10(1e7)) gives 7.00000000000000000000e+00 You can extend and

Calculate logarithm by hand

一笑奈何 提交于 2019-12-24 09:55:11
问题 I'd like to calculate the mathematical logarithm "by hand"... ... where stands for the logarithmBase and stands for the value. Some examples (See Log calculator): The base 2 logarithm of 10 is 3.3219280949 The base 5 logarithm of 15 is 1.6826061945 ... Hoever - I do not want to use a already implemented function call like Math.ceil, Math.log, Math.abs, ... , because I want a clean native solution that just deals with +-*/ and some loops. This is the code I got so far: function myLog(base, x)

How to dynamically change axis from linear to logarithmic in HighChart

好久不见. 提交于 2019-12-23 21:47:47
问题 I want to dynamically change axis from linear to logarithmic and vice versa in HighCharts. Please see this fiddle example. yAxis: { //linear type: 'logarithmic', minorTickInterval: 0.1 }, There is a type: String in api For initial declarative chart setup. I want to dynamically change to logarithmic/linear back and forth. 回答1: Use axis.update , see: http://jsfiddle.net/ZCecV/1/ (docs: http://api.highcharts.com/highcharts#Axis.update() ) 来源: https://stackoverflow.com/questions/16324284/how-to

Calculating the subsegments of a line, using logarithmic scaling

五迷三道 提交于 2019-12-23 16:15:31
问题 I want to calculate the length of the subsegments of a line having a length of totalLineLength , where the subsegments are proportional to the log of the events given. A visual representation: |---|-----|---------| a line composed of subsegments. I want the sum of the calculated subsegments to be equal to totalLineLength , and Success must be printed. Log(x+1) must be used too (because it gives always positive results for positive arguments and scales 1 too). Using linear scaling, I'm doing

Algorithm behind Math.log - Java

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 13:01:15
问题 Lately I used the Math.log() to code some program and now I ask myself how does the method log() work. How does the computer calculate the logarithm? Thanks for solution. 回答1: When in doubts, look at the source code (working with Java 8). public static double log(double a) { return StrictMath.log(a); // default impl. delegates to StrictMath } You see it calls a static method from StrictMath.java. static native double log(double a); What native keyword means you can read here. Basically, it

Rotating text onto a line on a log scale in Matplotlib

孤街醉人 提交于 2019-12-22 10:57:57
问题 Problem I am working with data on a logarithmic scale and would like to rotate it to fit a line. I know the model but am unsure quite what angle I should be plugging into transform_angles to recover the correct rotation. After a bit of trial and error I know the answer is around 10 degrees for the axes limits I require. MWE import matplotlib.pylab as plt import numpy as np plt.clf() plt.yscale('log') plt.ylim((1e-11, 1e-1)) # Other data is usually plotted and these are the ranges I need. plt