This is an old version, view current version.

4.6 Complex special functions

The following functions are specific to complex numbers other than absolute value, which has a specific meaning for complex numbers.

real abs(complex z)
Return the absolute value of z, also known as the modulus or magnitude, which for \(z = x + yi\) is \[ \textrm{abs}(z) = \sqrt{x^2 + y^2}. \]
Available since 2.28

real arg(complex z)
Return the phase angle (in radians) of z, which for \(z = x + yi\) is \[ \textrm{arg}(z) = \textrm{atan2}(y, x) = \textrm{atan}(y / x). \]
Available since 2.28

real norm(complex z)
Return the Euclidean norm of z, which is its absolute value squared, and which for \(z = x + yi\) is \[ \textrm{norm}(z) = \textrm{abs}^2(z) = x^2 + y^2. \]
Available since 2.28

complex conj(complex z)
Return the complex conjugate of z, which negates the imaginary component, so that if \(z = x + yi\), \[ \textrm{conj}(z) = x - yi. \]
Available since 2.28

complex proj(complex z)
Return the projection of z onto the Riemann sphere, which for \(z = x + yi\) is \[ \textrm{proj}(z) = \begin{cases} z & \textrm{if} \ z \ \textrm{is finite, and} \\ 0 + \textrm{sign}(y)i & \textrm{otherwise,} \end{cases} \] where \(\textrm{sign}(y)\) is -1 if \(y\) is negative and 1 otherwise.
Available since 2.28

complex polar(real r, real theta)
Return the complex number with magnitude (absolute value) r and phase angle theta.
Available since 2.28