The functions described in this chapter provide support for complex numbers. The algorithms take care to avoid unnecessary intermediate underflows and overflows, allowing the functions to be evaluated over as much of the complex plane as possible.
For multiple-valued functions the branch cuts have been chosen to follow the conventions of Abramowitz and Stegun in the ‘Handbook of Mathematical Functions’. The functions return principal values which are the same as those in GNU Calc, which in turn are the same as those in ‘Common Lisp, The Language (Second Edition)’ and the HP-28/48 series of calculators.
In this section we describe the mathematical functions on complex numbers.
Note
Please note that the standard functions from the math library do not accept complex numbers.
Create a new complex number with real part a and imaginary part b.
Returns the real part of a complex number.
Returns the imaginary part of a complex number.
Returns the norm of the complex number z calculated as \(\sqrt{z \, z^\star}\). This function accepts a real or complex number as argument.
Returns the square norm of the complex number z calculated as \(z \, z^\star\). This function accepts a real or complex number as argument.
Returns the real and the imaginary parts of the real or complex number z. If z is a real number returns an imaginary part equal to zero.
Returns the complex conjugate \(z^\star\) of the complex number z.
The imaginary unit.
This function returns the square root of the complex number z, \(\sqrt{z}\). The branch cut is the negative real axis. The result always lies in the right half of the complex plane.
This function returns the complex exponential of the complex number z, \(\exp(z)\).
This function returns the complex natural logarithm (base e) of the complex number z, \(\log(z)\). The branch cut is the negative real axis.
This function returns the complex base-10 logarithm of the complex number z, \(\log_{10}(z)\).
The function returns the complex number z raised to the complex power a, \(z^a\). This is computed as \(\exp(a \, \log(z))\) using complex logarithms and complex exponentials.
This function returns the complex sine of the complex number z,
This function returns the complex cosine of the complex number z,
This function returns the complex tangent of the complex number z, \(\tan(z) = \sin(z)/\cos(z)\).
This function returns the complex secant of the complex number z, \(\sec(z) = 1/\cos(z)\).
This function returns the complex cosecant of the complex number z, \(\csc(z) = 1/\sin(z)\).
This function returns the complex cotangent of the complex number z, \(\cot(z) = 1/\tan(z)\).
This function returns the complex arcsine of the complex number z, \(\arcsin(z)\). The branch cuts are on the real axis, less than -1 and greater than 1.
This function returns the complex arccosine of the complex number z, \(\arccos(z)\). The branch cuts are on the real axis, less than -1 and greater than 1.
This function returns the complex arctangent of the complex number z, \(\arctan(z)\). The branch cuts are on the imaginary axis, below -i and above i.
This function returns the complex arcsecant of the complex number z, \(\textrm{asec}(z) = \textrm{acos}(1/z)\).
This function returns the complex arccosecant of the complex number z, \(\textrm{acsc}(z) = \textrm{asin}(1/z)\).
This function returns the complex arccotangent of the complex number z, \(\textrm{acot}(z) = \textrm{atan}(1/z)\).
This function returns the complex hyperbolic arcsine of the complex number z, \(\textrm{asinh}(z)\). The branch cuts are on the imaginary axis, below -i and above i.
This function returns the complex hyperbolic arccosine of the complex number z, \(\textrm{acosh}(z)\). The branch cut is on the real axis, less than 1. Note that in this case we use the negative square root in formula 4.6.21 of Abramowitz & Stegun giving \(\textrm{acosh}(z)=\log(z-\sqrt{z^2-1})\).
This function returns the complex hyperbolic arctangent of the complex number z, \(\textrm{atanh}(z)\). The branch cuts are on the real axis, less than -1 and greater than 1.
This function returns the complex hyperbolic arcsecant of the complex number z, \(\textrm{asech}(z) = \textrm{acosh}(1/z)\).
This function returns the complex hyperbolic arccosecant of the complex number z, \(\textrm{acsch}(z) = \textrm{asin}(1/z)\).
This function returns the complex hyperbolic arccotangent of the complex number z, \(\textrm{acoth}(z) = \textrm{atanh}(1/z)\).