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 Complexacos(Complex z)Inverse of cosine.static Complexasin(Complex z)Inverse of sine.static Complexatan(Complex z)Inverse of tangent.static Complexcos(Complex z)Cosine of a complex number.static Complexcosh(Complex z)Hyperbolic cosine of a complex number.static Complexexp(Complex z)Exponential of a complex number.static Complexlog(Complex z)Natural logarithm of a complex number.static Complexpow(Complex z1, Complex z2)z1 to the power z2.static Complexsin(Complex z)Sine of a complex number.static Complexsinh(Complex z)Hyperbolic sine of a complex number.static Complexsqrt(Complex z)Square root of a complex number.static Complextan(Complex z)Tangent of a complex number.static Complextanh(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- ifzis aNaNor ∞- 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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞- 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- ifzis aNaNor ∞- 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- ifzis aNaNor ∞- 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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
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- ifzis aNaNor ∞
-
-