问题标签 [logarithm]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
80918 浏览

algorithm - 函数的大 O 是多少 (log n)^k

对于任何 k ,函数 (log n) k的大 O 复杂度是多少?

0 投票
1 回答
346 浏览

math - 对数刻度

我正在编写一个小型合成器应用程序,我通过单击一个小节的长度来输入音符。现在,音阶是对数的,我的问题是,如何将鼠标的位置转换为相关的音高。目前我计算一个比率。它可以工作,有点,但我得到了广泛的紧密包装的低音,在远端,我只用几个像素转换成多个八度音阶。基本上我想要,如果我点击条的中心(1/2),频率加倍,1/4 是频率的另一个两倍。等等......我在这里很愚蠢!

0 投票
4 回答
21493 浏览

r - 使用 R 在直方图中使 y 轴对数

嗨,我正在使用 R 制作直方图,但是 Y 轴的数量太大,我需要将其转换为对数。请参阅下面的脚本:

那么我应该如何更改我的脚本呢?谢谢

0 投票
3 回答
5822 浏览

big-o - 对数和幂的渐近复杂度

所以,很明显,log(n)O(n)。但是,怎么(log(n))^2办?sqrt(n)或者——什么log(n)限制了什么?

有一系列的比较是这样的:

我经常遇到这些比较,但我从来没有想出解决它们的好方法。解决一般情况的策略提示?


[编辑:我不是在谈论计算这些函数值的计算复杂性。我说的是功能本身。例如,是因为for和f(n) = n的上限。]g(n) = log(n)f(n) ≤ c g(n)c = 1n₀ > 0

0 投票
3 回答
5673 浏览

gnuplot - gnuplot中对数刻度的直方图

我必须使用 gnuplot 在两个轴上以对数刻度绘制直方图。我需要 bin 在 log10 中等间距。在 y 轴上使用对数刻度不是问题。主要问题是在 x 轴上创建 bin。例如,在 log10 中使用 10 个 bin,第一个 bin 将是 [1],[2],[3]....[10 - 19][20 - 29].....[100 190] 等等. 我在网上搜索过,但找不到任何实用的解决方案。如果在 gnuplot 中实现它太复杂了,你能建议一些其他软件/语言来做吗?

正如有人问的那样,我会更具体地解释我需要做什么。我有一个像这样的(巨大的)列表:

例如,1400 万个 IP 地址发送了 1 个数据包,700 万个 2 个数据包...... 1 个 IP 地址发送了 6600 个数据包,......,1 个 IP 地址发送了 19000 个数据包。如您所见,两个轴上的值都很高,因此如果没有对数刻度,我无法绘制它。

因为我需要快速完成,所以我尝试的第一件事是绘制这个列表,因为它使用 gnuplot 在两个轴上设置 logscale 使用框。结果是可以理解的,但不太合适。事实上,盒子在 x 轴上变得越来越细,因为很明显,10-100 中的点比 1-10 中的多!因此,在第二个十年之后,它变得一团糟。

0 投票
1 回答
4651 浏览

scale - Unable to plot first point using `set log x`, `set log y` under `gnuplot`

I am trying to plot two graphs using different columns from the same data file. As the range of one graph is far greater than the other, I am setting the y-axis to a logarithmic scale. As the domain of values are also very small for both graphs, I am also setting the x-axis to a logarithmic scale.

I have no problem plotting the graphs except that gnuplot does not plot the first points in the data file (where x = 0).

The code that I am using to plot the graphs is thus:

Note that, because I am using a logarithmic scale for both axes, I cannot include the value of zero in either range.

An excerpt of the data file that I am using is thus:

The file that is plotted is thus:

enter image description here

Notice how the first value of the second graph is not plotted.

0 投票
2 回答
12211 浏览

javascript - jQuery UI Slider 对数刻度

我正在将此 jQuery UI 代码用于对数滑块:

expon功能是:

#amount_min并且#amount_max是 HTML 输入元素。上面的代码可以很好地从滑块获取值并将它们放入输入元素。

但是现在我需要与expon()- 相对的函数来在我更改输入值时更改滑块。有人可以帮我吗?

0 投票
3 回答
6228 浏览

math - 科学计算器 - 使用以二为底的对数函数

在模型 casio fx-82ms 中,我必须使用对数函数进行一些科学计算,但计算器计算所有问题的底数为十(10),但我需要以二为底。任何人都可以帮助我吗?

0 投票
2 回答
4706 浏览

c++ - 非常非常大数的对数

我必须找到非常大的日志。

我在 C++ 中这样做

我已经做了一个乘、加、减、除的函数,但是对数有问题。我不需要代码,我需要一个简单的想法,如何使用这些函数来完成它。

谢谢。

PS对不起,我忘了告诉你:我只需要找到那个数字的二进制对

PS-2 我在Wikipedia中找到:

如果我在大数字下重新制作它,它会正常工作吗?

0 投票
2 回答
375 浏览

php - php:将包含 0..9a..f 的 varchar(32) 快速转换为 varchar ([log[38]16]+1)... 0..9A..z

假设我们有一个字符串 md5('somestring')。它将包含符号 0..f。因此,char(32) 可以保存该散列,但我相信它可能需要不超过 21 个字节 ([log 38/log 236 + 1])*Length(hash)。将带有符号 0..f 的字符串转换为带有符号 0..9A..z 的字符串的任何快速函数?(这将占用超过 21 个字节,因为它只使用数字和拉丁字母)?