Package dev.nm.number.complex
Class ElementaryFunction
- java.lang.Object
-
- dev.nm.number.complex.ElementaryFunction
-
-
Constructor Summary
Constructors Constructor Description ElementaryFunction()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.
-
-
-
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
- ifz
is aNaN
or ∞- See Also:
- 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
- ifz
is aNaN
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
- ifz
is aNaN
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 numberz2
- a complex number- Returns:
- z1z2
- Throws:
IllegalArgumentException
- ifz
is aNaN
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
- ifz
is aNaN
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
- ifz
is aNaN
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
- ifz
is aNaN
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
- ifz
is aNaN
or ∞- See Also:
- 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
- ifz
is aNaN
or ∞- See Also:
- 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
- ifz
is aNaN
or ∞- See Also:
- 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
- ifz
is aNaN
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
- ifz
is aNaN
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
- ifz
is aNaN
or ∞
-
-