The ALOG function returns the natural logarithm of X.

For input of a complex number, Z = X + iY, the complex number can be rewritten as Z = R exp(iθ), where R = abs(Z) and θ = atan(Y,X). The complex natural log is then given by,

alog(Z) = alog(R) + iθ

In the above formula, the use of the two-argument arctangent separates the solutions at Y = 0 and takes into account the branch-cut discontinuity along the real axis from -∞ to 0, and ensures that exp(alog(Z)) is equal to Z. For details see formulas 4.4.1-3 in Abramowitz, M. and Stegun, I.A., 1964: Handbook of Mathematical Functions (Washington: National Bureau of Standards).

Examples


Find the natural logarithm of 2 and print the result by entering:

IDL> alog(2)
0.69314718

Find the complex natural log of sqrt(2) + i sqrt(2) and print the result by entering:

IDL> alog(complex(sqrt(2), sqrt(2)))
(      0.69314718,      0.78539819)

Note: The real part of the result is just ALOG(2) and the imaginary part gives the angle (in radians) of the complex number relative to the real axis. See the ATAN function for an example of visualizing the complex natural log.

Find the decay rate of tritium given its half-life (t1/2) of 12.32 years and the decay rate = -(ln(2))/t1/2 :

IDL> -(alog(2))/12.32
-0.056261949

Syntax


Result = ALOG(X)

Return Value


Returns the natural logarithm of X.

Arguments


X

The value for which the natural log is desired. For real input, X should be greater than or equal to zero. If X is double-precision floating or complex, the result is of the same type. All other types are converted to single-precision floating-point and yield floating-point results. If X is an array, the result has the same dimensions, with each element containing the natural log of the corresponding element of X.

Keywords


Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History


Original

Introduced

See Also


ALOG10, ALOG2, ATAN