public class Complex extends java.lang.Object implements ComplexNumber, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static Complex |
I
A complex number representing the imaginary unit
|
static Complex |
NaN
A complex number representing NaN (not a number)
|
static Complex |
ONE
A complex number representing one
|
static Complex |
ZERO
A complex number representing zero
|
Constructor and Description |
---|
Complex(ComplexNumber num)
Create a complex number that has the same value as the specified other
complex number.
|
Complex(double re)
Create a complex number with zero imaginary part.
|
Complex(double re,
double im)
Create a complex number.
|
Modifier and Type | Method and Description |
---|---|
double |
abs()
Calculates the absolute value of this complex number.
|
Complex |
acos()
Calculate the inverse cosine of this complex number.
|
Complex |
acosh()
Calculate the inverse hyperbolic cosine of this complex number.
|
Complex |
add(ComplexNumber c)
Add another complex number to this complex number
|
Complex |
add(double d)
Add a real number to this complex number
|
double |
arg()
Calculates the argument of this complex number.
|
Complex |
asin()
Calculate the inverse sine of this complex number.
|
Complex |
asinh()
Calculate the inverse hyperbolic sine of this complex number.
|
Complex |
atan()
Calculate the inverse tangent of this complex number.
|
Complex |
atanh()
Calculate the inverse hyperbolic tangent of this complex number.
|
Complex |
conjugate()
Calculates the conjugate of this complex number
|
Complex |
cos()
Calculate the cosine of this complex number.
|
Complex |
cosh()
Calculate the hyperbolic cosine of this complex number.
|
Complex |
divide(ComplexNumber c)
Divide this complex number by another complex number
|
Complex |
divide(double d)
Divide this complex number by a real number
|
Complex |
divideReversed(ComplexNumber c)
Divide another complex number by this complex number
|
Complex |
divideReversed(double d)
Divide a real number by this complex number
|
boolean |
equals(java.lang.Object o)
Compare this complex number to another object.
|
Complex |
exp()
Calculates the exponential of this complex number
|
Complex |
expm1()
Returns exp(this)-1.
|
double |
getImag()
Returns the imaginary part of the complex number.
|
double |
getReal()
Returns the real part of the complex number.
|
int |
hashCode()
Returns a hash code of the complex number.
|
Complex |
invert()
Calculates the inverse of this complex number
|
boolean |
isInfinite()
Check whether the complex number is infinite.
|
boolean |
isNaN()
Check whether the complex number is NaN (not-a-numer).
|
Complex |
log()
Calculates the natural logarithm of this complex number
|
Complex |
log1p()
Returns log(this+1).
|
Complex |
multiply(ComplexNumber c)
Multiply this complex number by another complex number
|
Complex |
multiply(double d)
Multiply this complex number by a real number
|
Complex |
multiply(int i)
Multiply this complex number by an integer
|
Complex |
negate()
Calculates the negation of this complex number
|
static Complex |
newPolar(double abs,
double argument)
Create a complex number from polar coordinates.
|
Complex |
pow(ComplexNumber c)
Raise this complex number to a complex power
|
Complex |
pow(double d)
Raise this complex number to a real power
|
Complex |
sin()
Calculate the sine of this complex number.
|
Complex |
sinh()
Calculate the hyperbolic sine of this complex number.
|
Complex |
sqrt()
Calculates the square root of this complex number
|
Complex |
subtract(ComplexNumber c)
Subtract another complex number from this complex number
|
Complex |
subtract(double d)
Subtract a real number from this complex number
|
Complex |
subtractReversed(ComplexNumber c)
Subtract this complex number from another complex number
|
Complex |
subtractReversed(double d)
Subtract this complex number from a real number
|
Complex |
tan()
Calculate the tangent of this complex number.
|
Complex |
tanh()
Calculate the hyperbolic tangent of this complex number.
|
java.lang.String |
toString()
Returns a text representation of the complex number.
|
static Complex |
valueOf(ComplexNumber num)
Create a complex number that has the same value as the specified other
complex number.
|
static Complex |
valueOf(double re)
Create a complex number with zero imaginary part.
|
static Complex |
valueOf(double re,
double im)
Create a complex number.
|
public static final Complex I
public static final Complex ONE
public static final Complex ZERO
public static final Complex NaN
public Complex(ComplexNumber num)
num
- The other complex numberpublic Complex(double re)
re
- The real partpublic Complex(double re, double im)
re
- The real partim
- The imaginary partpublic static Complex valueOf(ComplexNumber num)
num
- The other complex numberpublic static Complex valueOf(double re)
re
- The real partpublic static Complex valueOf(double re, double im)
re
- The real partim
- The imaginary partpublic static Complex newPolar(double abs, double argument)
abs
- The absolute valueargument
- The argumentpublic double getReal()
getReal
in interface ComplexNumber
public double getImag()
getImag
in interface ComplexNumber
public Complex add(ComplexNumber c)
c
- The other complex numberpublic Complex add(double d)
d
- The real numberpublic Complex subtract(ComplexNumber c)
c
- The other complex numberpublic Complex subtractReversed(ComplexNumber c)
c
- The other complex numberpublic Complex subtract(double d)
d
- The real numberpublic Complex subtractReversed(double d)
d
- The real numberpublic Complex multiply(ComplexNumber c)
c
- The complex number multiplierpublic Complex multiply(double d)
d
- The real number multiplierpublic Complex multiply(int i)
i
- The integer multiplierpublic Complex divide(ComplexNumber c)
c
- The complex number divisorpublic Complex divide(double d)
d
- The real number divisorpublic Complex divideReversed(ComplexNumber c)
c
- The complex number dividendpublic Complex divideReversed(double d)
d
- The real number dividendpublic Complex negate()
public Complex conjugate()
public Complex sqrt()
public Complex exp()
public Complex expm1()
public Complex log()
public Complex log1p()
public Complex acosh()
public Complex asinh()
public Complex atanh()
public Complex acos()
public Complex asin()
public Complex atan()
public Complex cos()
public Complex sin()
public Complex tan()
public Complex cosh()
public Complex sinh()
public Complex tanh()
public Complex pow(ComplexNumber c)
c
- The complex powerpublic Complex pow(double d)
d
- The real powerpublic Complex invert()
public double abs()
abs
in interface ComplexNumber
public double arg()
arg
in interface ComplexNumber
public boolean isNaN()
isNaN
in interface ComplexNumber
public boolean isInfinite()
isInfinite
in interface ComplexNumber
public java.lang.String toString()
toString
in interface ComplexNumber
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object