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 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 . This function accepts a real or complex number as argument.
Returns the square norm of the complex number z calculated as . 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 of the complex number z.
The imaginary unit.
This function returns the square root of the complex number 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, .
This function returns the complex natural logarithm (base e) of the complex number z, . The branch cut is the negative real axis.
This function returns the complex base-10 logarithm of the complex number z, .
The function returns the complex number z raised to the complex power a, . This is computed as 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, .
This function returns the complex secant of the complex number z, .
This function returns the complex cosecant of the complex number z, .
This function returns the complex cotangent of the complex number z, .
This function returns the complex arcsine of the complex number 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, . 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, . The branch cuts are on the imaginary axis, below -i and above i.
This function returns the complex arcsecant of the complex number z, .
This function returns the complex arccosecant of the complex number z, .
This function returns the complex arccotangent of the complex number z, .
This function returns the complex hyperbolic arcsine of the complex number 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, . 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 .
This function returns the complex hyperbolic arctangent of the complex number 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, .
This function returns the complex hyperbolic arccosecant of the complex number z, .
This function returns the complex hyperbolic arccotangent of the complex number z, .