Difference between revisions of "Ln"
m (missing =) |
|||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Math Functions]] | [[Category:Math Functions]] | ||
+ | [[Category:Functions that operate on complex numbers]] | ||
[[Category:Doc Status D]] <!-- For Lumina use, do not change --> | [[Category:Doc Status D]] <!-- For Lumina use, do not change --> | ||
− | = Ln(x) = | + | == Ln(x) == |
+ | The natural logarithm of «x». This is the value ''y'' such that ''e<sup>y</sup> = [[Exp]](y) = x'', where e=2.718281828459045 is Euler's number. | ||
− | + | «x» must be non-negative when [[EnableComplexNumbers|complex numbers are not enabled]] or a warning will be issued. If the warning is ignored, or [[Preferences|Show Result Warnings]] is off, the result is [[NaN]]. When [[EnableComplexNumbers|complex numbers are enabled]], a negative «x» results in a complex number. | |
− | + | == Library == | |
+ | Math functions | ||
+ | |||
+ | == Examples == | ||
+ | :<code>Ln(1) → 0</code> | ||
+ | :<code>Ln(2) → 0.6931471805599453</code> | ||
+ | :<code>Ln(2.718) → 0.999896315728952</code> | ||
+ | :<code>Ln(1/2.718) → -0.999896315728952</code> | ||
+ | :<code>Ln(0) → -INF</code> | ||
+ | :<code>Ln(-1) → NaN { With Warning: ''Logarithm of a non-positive number'' } </code> | ||
+ | |||
+ | == Base b Logarithms == | ||
+ | The base-''b'' logarithm of «x» is given by: | ||
+ | :<code>Ln(x) / Ln(b)</code> | ||
− | = | + | For example: |
+ | :<code>Ln(1024) / Ln(2) → 10</code> | ||
+ | is the base-2 logarithm of 1024, since <code>1024 = 2<sup>10</sup></code> | ||
− | + | == Complex numbers == | |
− | + | When «x» is negative or complex, the result of [[Ln]](x) is a complex number. If you want [[Ln]] to return a complex number for a negative parameter, you must set the system variable [[EnableComplexNumbers]] to 1, otherwise a warning is issued with a result of [[NaN]]. To set [[EnableComplexNumbers]], see [[EnableComplexNumbers|enabling complex numbers]]. | |
− | + | The value of the imaginary part can be interpreted as being in radians. | |
− | |||
− | |||
− | |||
− | |||
− | = | + | A complex number can be written in polar form as <math>r e^{\theta j}</math>. Thus, <math>\ln x = \ln r + \theta j</math>. In other words, the real part of the result is the log magnitude, and the imaginary part is the phasor angle, <math>\theta</math>, expressed in radians and in <math>[-\pi,\pi)</math>. |
− | + | :<code>Ln(-1) → -3.142j { When EnableComplexNumbers is 1 }</code> | |
− | + | :<code>Ln(2.71828j) → 1+1.571j { ImPart is <math>\pi/2</math> }</code> | |
− | + | == See Also == | |
+ | * [[LogTen]] | ||
+ | * [[ProductLog]] | ||
+ | * [[ImPart]] | ||
+ | * [[Exp]] | ||
+ | * [[Complex Numbers]] | ||
+ | * [[Math functions]] | ||
+ | * [[LogNormal]] |
Latest revision as of 23:28, 27 October 2022
Ln(x)
The natural logarithm of «x». This is the value y such that ey = Exp(y) = x, where e=2.718281828459045 is Euler's number.
«x» must be non-negative when complex numbers are not enabled or a warning will be issued. If the warning is ignored, or Show Result Warnings is off, the result is NaN. When complex numbers are enabled, a negative «x» results in a complex number.
Library
Math functions
Examples
Ln(1) → 0
Ln(2) → 0.6931471805599453
Ln(2.718) → 0.999896315728952
Ln(1/2.718) → -0.999896315728952
Ln(0) → -INF
Ln(-1) → NaN { With Warning: Logarithm of a non-positive number }
Base b Logarithms
The base-b logarithm of «x» is given by:
Ln(x) / Ln(b)
For example:
Ln(1024) / Ln(2) → 10
is the base-2 logarithm of 1024, since 1024 = 210
Complex numbers
When «x» is negative or complex, the result of Ln(x) is a complex number. If you want Ln to return a complex number for a negative parameter, you must set the system variable EnableComplexNumbers to 1, otherwise a warning is issued with a result of NaN. To set EnableComplexNumbers, see enabling complex numbers.
The value of the imaginary part can be interpreted as being in radians.
A complex number can be written in polar form as [math]\displaystyle{ r e^{\theta j} }[/math]. Thus, [math]\displaystyle{ \ln x = \ln r + \theta j }[/math]. In other words, the real part of the result is the log magnitude, and the imaginary part is the phasor angle, [math]\displaystyle{ \theta }[/math], expressed in radians and in [math]\displaystyle{ [-\pi,\pi) }[/math].
Ln(-1) → -3.142j { When EnableComplexNumbers is 1 }
Ln(2.71828j) → 1+1.571j { ImPart is [math]\displaystyle{ \pi/2 }[/math] }
Enable comment auto-refresher