将线性刻度转换为对数 [英] Convert Linear scale to Logarithmic

查看:28
本文介绍了将线性刻度转换为对数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个线性标度,范围从 0.1 到 10,变化增量为 0.1:
  |----------[]----------|
0.1       5.0      10

I have a linear scale that ranges form 0.1 to 10 with increments of change at 0.1:
  |----------[]----------|
0.1         5.0         10

然而,输出确实需要:
  |----------[]----------|
0.1       1.0      10(对数刻度)

However, the output really needs to be:
  |----------[]----------|
0.1         1.0         10 (logarithmic scale)

我正在尝试找出将 5(例如)转换为 1.0 所需的公式.因此,如果表盘在 1.0 和 10 之间移动一半(线性刻度上的实际值为 7.5),结果对数值会是多少?想了几个小时,但我已经有好几年没有研究过这种数学了,所以我真的很迷茫.我了解 log10X = 10y 的基本概念,但仅此而已.

I'm trying to figure out the formula needed to convert the 5 (for example) to 1.0. Consequently, if the dial was shifted halfway between 1.0 and 10 (real value on linear scale being 7.5), what would the resulting logarithmic value be? Been thinking about this for hours, but I have not worked with this type of math in quite a few years, so I am really lost. I understand the basic concept of log10X = 10y, but that's pretty much it.

5.0 的伪值将变为 10(或 101),而 10 的伪值将变为 1010.那么如何计算伪值 结果的对数值,比如 7.5?

The psuedo-value of 5.0 would become 10 (or 101) while the psuedo-value of 10 would be 1010. So how to figure the pseudo-value and resulting logarithmic value of, let's say, the 7.5?

如果需要其他信息,请告诉我.

Let me know if addition information is needed.

感谢您提供的任何帮助;这打败了我.

Thanks for any help provided; this has beaten me.

推荐答案

Notation

作为数学和编程的惯例,日志"是函数被视为基数e.exp"函数是指数函数.请记住,这些函数是逆函数,我们将函数视为:

Notation

As is the convention both in mathematics and programming, the "log" function is taken to be base-e. The "exp" function is the exponential function. Remember that these functions are inverses we take the functions as:

exp : ℝ → ℝ+, and

exp : ℝ → ℝ+, and

日志:ℝ+ → ℝ.

解决方案

你只是在这里解一个简单的方程:

Solution

You're just solving a simple equation here:

y = exp bx

求解通过点 x=0.1, y=0.1 和 x=10, y=10 的 ab.

Solve for a and b passing through the points x=0.1, y=0.1 and x=10, y=10.

观察比率 y1/y2 由下式给出:

Observe that the ratio y1/y2 is given by:

y1/y2 = (a exp bx1)/(a exp bx2)= exp b(x1-x2)

y1/y2 = (a exp bx1) / (a exp bx2) = exp b(x1-x2)

这可以让你解决b

b = log (y1/y2)/(x1-x2)

b = log (y1/y2) / (x1-x2)

剩下的就简单了.

b = log (10/0.1)/(10 - 0.1) = 20/99 log 10 ≈ 0.46516870565536284

b = log (10 / 0.1) / (10 - 0.1) = 20/99 log 10 ≈ 0.46516870565536284

a = y1/exp bx1 ≈ 0.09545484566618341

a = y1 / exp bx1 ≈ 0.09545484566618341

更多关于符号

在您的职业生涯中,您会发现有人使用 log 函数以 e、10 甚至 2 为底的约定.这并不意味着任何人都是对或错.只是一个符号约定,每个人都可以自由使用他们喜欢的符号约定.

More About Notation

In your career you will find people who use the convention that the log function uses base e, base 10, and even base 2. This does not mean that anybody is right or wrong. It is simply a notational convention and everybody is free to use the notational convention that they prefer.

数学和计算机编程中的约定是使用以 e 为底的对数,而在这种情况下使用以 e 为底简化了符号,这就是我选择它的原因.它与 Google 提供的计算器和您的 TI-84 等计算器使用的约定不同,但话说回来,计算器是为工程师准备的,工程师使用的符号与数学家和程序员使用的符号不同.

The convention in both mathematics and computer programming is to use base e logarithm, and using base e simplifies notation in this case, which is why I chose it. It is not the same as the convention used by calculators such as the one provided by Google and your TI-84, but then again, calculators are for engineers, and engineers use different notation than mathematicians and programmers.

以下编程语言在标准库中包含 base-e 日志函数.

The following programming languages include a base-e log function in the standard library.

  • C log() (和 C++,通过包含)

  • C log() (and C++, by inclusion)

Java Math.log()

JavaScript Math.log()

JavaScript Math.log()

Python math.log()(包括Numpy)

Python math.log() (including Numpy)

Fortran log()

Fortran log()

C#、Math.Log()

R

Maxima(严格来说是一种 CAS,而不是一种语言)

Maxima (strictly speaking a CAS, not a language)

Scheme 的log

Lisp 的log

事实上,我想不出一种单一编程语言,其中log()不是以e为底的对数.我确信这样的编程语言是存在的.

In fact, I cannot think of a single programming language where log() is anything other than the base-e logarithm. I'm sure such a programming language exists.

这篇关于将线性刻度转换为对数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆