# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.number.complex

## Class ElementaryFunction

• java.lang.Object
• com.numericalmethod.suanshu.number.complex.ElementaryFunction

• public class ElementaryFunction
extends Object
This class contains some elementary functions for complex number, Complex. The references for the formulae can be found in the following.
• ### Constructor Summary

Constructors
Constructor and Description
ElementaryFunction()
• ### Method Summary

All Methods
Modifier and Type Method and Description
static Complex acos(Complex z)
Inverse of cosine.
static Complex asin(Complex z)
Inverse of sine.
static Complex atan(Complex z)
Inverse of tangent.
static Complex cos(Complex z)
Cosine of a complex number.
static Complex cosh(Complex z)
Hyperbolic cosine of a complex number.
static Complex exp(Complex z)
Exponential of a complex number.
static Complex log(Complex z)
Natural logarithm of a complex number.
static Complex pow(Complex z1, Complex z2)
z1 to the power z2.
static Complex sin(Complex z)
Sine of a complex number.
static Complex sinh(Complex z)
Hyperbolic sine of a complex number.
static Complex sqrt(Complex z)
Square root of a complex number.
static Complex tan(Complex z)
Tangent of a complex number.
static Complex tanh(Complex z)
Hyperbolic tangent of a complex number.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### ElementaryFunction

public ElementaryFunction()
• ### Method Detail

• #### sqrt

public static Complex sqrt(Complex z)
Square root of a complex number.
Parameters:
z - a complex number
Returns:
the square root of the number
Throws:
IllegalArgumentException - if z is a NaN or
Wikipedia: Square roots of negative and complex numbers
• #### log

public static Complex log(Complex z)
Natural logarithm of a complex number.
ln(a + bi) = ln(r exp(i θ)) = ln(r) + i θ
Parameters:
z - a complex number
Returns:
ln(z)
Throws:
IllegalArgumentException - if z is a NaN or
• #### exp

public static Complex exp(Complex z)
Exponential of a complex number.

exp(a + bi) = exp(a) * [cos(b) + i sin(b)]
= exp(b)cos(b) + i exp(a)sin(b)

Parameters:
z - a complex number
Returns:
ez
Throws:
IllegalArgumentException - if z is a NaN or
• #### pow

public static Complex pow(Complex z1,
Complex z2)
z1 to the power z2.
(r exp(i θ)) ^ (a + bi) = r^a exp(-b θ) (cos(b ln(r) + a θ) + i sin(b ln(r) + a θ))
Parameters:
z1 - a complex number
z2 - a complex number
Returns:
z1z2
Throws:
IllegalArgumentException - if z is a NaN or
• #### sin

public static Complex sin(Complex z)
Sine of a complex number.
sin(a + bi) = sin(a)cosh(b) + i cos(a)sinh(b)
Parameters:
z - a complex number
Returns:
sin(z)
Throws:
IllegalArgumentException - if z is a NaN or
• #### cos

public static Complex cos(Complex z)
Cosine of a complex number.
cos(a + bi) = cos(a)cosh(b) - i sin(a)sinh(b)
Parameters:
z - a complex number
Returns:
cos(z)
Throws:
IllegalArgumentException - if z is a NaN or
• #### tan

public static Complex tan(Complex z)
Tangent of a complex number.

tan(a + bi) = [sin(2a) + i sinh(2a)] / [cos(2a) + cosh(2b)]

Parameters:
z - a complex number
Returns:
tan(z)
Throws:
IllegalArgumentException - if z is a NaN or
• #### asin

public static Complex asin(Complex z)
Inverse of sine.
arcsin(z) = -i ln(iz + sqrt(1 - z2))
Parameters:
z - a complex number
Returns:
sin-1(z)
Throws:
IllegalArgumentException - if z is a NaN or
Inverse Sine from Wolfram MathWorld
• #### acos

public static Complex acos(Complex z)
Inverse of cosine.
arccos(z) = pi / 2 + i ln(iz + sqrt(1 - z2)) = pi / 2 - arcsin(z)
Parameters:
z - a complex number
Returns:
cos-1(z)
Throws:
IllegalArgumentException - if z is a NaN or
Inverse Cosine from Wolfram MathWorld
• #### atan

public static Complex atan(Complex z)
Inverse of tangent.
arctan(z) = i * ( ln ( 1 - iz ) - ln ( 1 + iz) ) / 2
Parameters:
z - a complex number
Returns:
tan-1(z)
Throws:
IllegalArgumentException - if z is a NaN or
Inverse Tangent from Wolfram MathWorld
• #### sinh

public static Complex sinh(Complex z)
Hyperbolic sine of a complex number.
sinh(a + bi) = sinh(a)cos(b) + i cosh(a)sin(b)
Parameters:
z - a complex number
Returns:
sinh(z)
Throws:
IllegalArgumentException - if z is a NaN or
• #### cosh

public static Complex cosh(Complex z)
Hyperbolic cosine of a complex number.
cosh(a + bi) = cosh(a)cos(b) + i sinh(a)sin(b)
Parameters:
z - a complex number
Returns:
cosh(z)
Throws:
IllegalArgumentException - if z is a NaN or
• #### tanh

public static Complex tanh(Complex z)
Hyperbolic tangent of a complex number.
tanh(a + bi) = [sinh(2a) + i sin(2b)] / [cosh(2a) + cos(2b)]
Parameters:
z - a complex number
Returns:
tanh(z)
Throws:
IllegalArgumentException - if z is a NaN or