Movatterモバイル変換


[0]ホーム

URL:


Skip to content

log

log(x:array,/)array

Calculates an implementation-dependent approximation to the natural (basee) logarithm for each elementx_i of the input arrayx.

Note

The natural logarithm of a complex number\(z\) with polar coordinates\((r,\theta)\) equals\(\ln r + (\theta + 2n\pi)j\) with principal value\(\ln r + \theta j\).

Note

For complex floating-point operands,log(conj(x)) must equalconj(log(x)).

Note

By convention, the branch cut of the natural logarithm is the negative real axis\((-\infty, 0)\).

The natural logarithm is a continuous function from above the branch cut, taking into account the sign of the imaginary component.

Accordingly, for complex arguments, the function returns the natural logarithm in the range of a strip in the interval\([-\pi j, +\pi j]\) along the imaginary axis and mathematically unbounded along the real axis.

Note: branch cuts follow C99 and have provisional status (seeBranch Cuts).

Parameters:

x (array) – input array. Should have a floating-point data type.

Returns:

out (array) – an array containing the evaluated natural logarithm for each element inx. The returned array must have a floating-point data type determined byType Promotion Rules.

Notes

Special cases

For real-valued floating-point operands,

  • Ifx_i isNaN, the result isNaN.

  • Ifx_i is less than0, the result isNaN.

  • Ifx_i is either+0 or-0, the result is-infinity.

  • Ifx_i is1, the result is+0.

  • Ifx_i is+infinity, the result is+infinity.

For complex floating-point operands, leta=real(x_i),b=imag(x_i), and

  • Ifa is-0 andb is+0, the result is-infinity+πj.

  • Ifa is+0 andb is+0, the result is-infinity+0j.

  • Ifa is a finite number andb is+infinity, the result is+infinity+πj/2.

  • Ifa is a finite number andb isNaN, the result isNaN+NaNj.

  • Ifa is-infinity andb is a positive (i.e., greater than0) finite number, the result is+infinity+πj.

  • Ifa is+infinity andb is a positive (i.e., greater than0) finite number, the result is+infinity+0j.

  • Ifa is-infinity andb is+infinity, the result is+infinity+3πj/4.

  • Ifa is+infinity andb is+infinity, the result is+infinity+πj/4.

  • Ifa is either+infinity or-infinity andb isNaN, the result is+infinity+NaNj.

  • Ifa isNaN andb is a finite number, the result isNaN+NaNj.

  • Ifa isNaN andb is+infinity, the result is+infinity+NaNj.

  • Ifa isNaN andb isNaN, the result isNaN+NaNj.

Changed in version 2022.12:Added complex data type support.


[8]ページ先頭

©2009-2025 Movatter.jp