Stdlib cmplx
The cmplx
module provides a suite of functions for performing operations on complex numbers. These functions allow you to create, manipulate, and compute advanced mathematical expressions using complex arithmetic.
Functions
-
new(real, imag)
Creates a new complex number from the given real and imaginary parts. -
conj(c)
Returns the complex conjugate of the complex numberc
. -
abs(c)
Returns the modulus (absolute value) of the complex numberc
. -
arg(c)
Returns the phase (argument) of the complex numberc
in radians. -
sin(c)
Returns the sine of the complex numberc
. -
cos(c)
Returns the cosine of the complex numberc
. -
acos(c)
Returns the arc cosine (inverse cosine) of the complex numberc
. -
acosh(c)
Returns the hyperbolic arc cosine of the complex numberc
. -
asin(c)
Returns the arc sine (inverse sine) of the complex numberc
. -
asinh(c)
Returns the hyperbolic arc sine of the complex numberc
. -
atan(c)
Returns the arc tangent (inverse tangent) of the complex numberc
. -
atanh(c)
Returns the hyperbolic arc tangent of the complex numberc
. -
cosh(c)
Returns the hyperbolic cosine of the complex numberc
. -
cot(c)
Returns the cotangent of the complex numberc
(defined as 1/tan(c)). -
exp(c)
Returns the exponential function (e^c) of the complex numberc
. -
inf()
Returns an infinite complex number. -
isinf(c)
Reports whether the complex numberc
is infinite; returnstrue
if it is, otherwisefalse
. -
isnan(c)
Reports whether the complex numberc
is NaN (not a number); returnstrue
if it is, otherwisefalse
. -
log(c)
Returns the natural logarithm of the complex numberc
. -
log10(c)
Returns the base-10 logarithm of the complex numberc
. -
nan()
Returns a complex number representing NaN. -
phase(c)
Alias forarg(c)
; returns the phase (argument) of the complex numberc
. -
polar(c)
Returns the polar coordinates of the complex numberc
as a map with keys: r
: The modulus (absolute value)-
theta
: The angle in radians -
pow(x, y)
Returns the result of raising the complex numberx
to the power of complex numbery
. -
rect(r, theta)
Returns the complex number corresponding to the given polar coordinatesr
andtheta
. -
sinh(c)
Returns the hyperbolic sine of the complex numberc
. -
sqrt(c)
Returns the square root of the complex numberc
. -
tan(c)
Returns the tangent of the complex numberc
. -
tanh(c)
Returns the hyperbolic tangent of the complex numberc
.