public final class Complex extends Number<Complex> implements Field<Complex>
This class represents an immutable complex number.
Modifier and Type | Field and Description |
---|---|
static Complex |
I
The imaginary unit i.
|
static Complex |
ONE
The complex number one.
|
static Complex |
ZERO
The complex number zero.
|
Modifier and Type | Method and Description |
---|---|
double |
argument()
Returns the argument of this complex number.
|
int |
compareTo(Complex that)
Compares two complex numbers, the real components are compared first,
then if equal, the imaginary components.
|
Complex |
conjugate()
Returns the conjugate of this complex number.
|
Complex |
copy()
Returns a copy of this number
allocated
by the calling thread (possibly on the stack). |
Complex |
divide(Complex that)
Returns this complex divided by the specified complex.
|
Complex |
divide(double k)
Returns this complex divided by the specified factor.
|
double |
doubleValue()
|
boolean |
equals(Complex that,
double tolerance)
Indicates if two complexes are "sufficiently" alike to be considered
equal.
|
boolean |
equals(java.lang.Object that)
Compares this complex against the specified Object.
|
Complex |
exp()
Returns the exponential number e raised to the power of
this complex.
|
double |
getImaginary()
Returns the imaginary component of this complex number.
|
double |
getReal()
Returns the real component of this complex number.
|
int |
hashCode()
Returns the hash code for this complex number.
|
Complex |
inverse()
Returns the inverse of this complex.
|
boolean |
isInfinite()
Indicates if either the real or imaginary component of this complex
is infinite.
|
boolean |
isLargerThan(Complex that)
Compares the
magnitude of this complex number
with the magnitude of the complex number specified. |
boolean |
isNaN()
Indicates if either the real or imaginary component of this complex
is not a number.
|
Complex |
log()
Returns the principal natural logarithm (base e) of this complex.
|
long |
longValue()
|
double |
magnitude()
Returns the magnitude of this complex number, also referred to
as the "modulus" or "length".
|
Complex |
minus(Complex that)
Returns the difference between this complex and the one specified.
|
Complex |
opposite()
Returns the negation of this complex.
|
Complex |
plus(Complex that)
Returns the sum of this complex with the one specified.
|
Complex |
pow(Complex that)
Returns this complex raised to the power of the specified complex
exponent.
|
Complex |
pow(double e)
Returns this complex raised to the specified power.
|
Complex |
sqrt()
Returns one of the two square root of this complex number.
|
Complex |
times(Complex that)
Returns the product of this complex with the one specified.
|
Complex |
times(double k)
Returns this complex multiplied by the specified factor.
|
javolution.text.Text |
toText()
Returns the text representation of this complex number.
|
static Complex |
valueOf(java.lang.CharSequence csq)
Returns the complex number for the specified character sequence.
|
static Complex |
valueOf(double real,
double imaginary)
Returns the complex number having the specified real and imaginary
components.
|
byteValue, floatValue, intValue, isGreaterThan, isLessThan, pow, shortValue, toString
public static Complex valueOf(double real, double imaginary)
real
- the real component of this complex number.imaginary
- the imaginary component of this complex number.getReal()
,
getImaginary()
public static Complex valueOf(java.lang.CharSequence csq)
csq
- the character sequence.TextFormat.getInstance(Complex.class).parse(csq)
java.lang.IllegalArgumentException
- if the character sequence does not
contain a parsable complex number.TextFormat.getInstance(Class)
public boolean isInfinite()
true
if this complex is infinite;
false
otherwise.public boolean isNaN()
true
if this complex is NaN;
false
otherwise.public double getReal()
public double getImaginary()
public Complex opposite()
opposite
in interface GroupAdditive<Complex>
-this
.public Complex plus(Complex that)
plus
in interface GroupAdditive<Complex>
that
- the complex to be added.this + that
.public Complex minus(Complex that)
public Complex times(double k)
k
- the factor multiplier.this * k
.public Complex times(Complex that)
public Complex inverse()
inverse
in interface GroupMultiplicative<Complex>
1 / this
.public Complex divide(double k)
k
- the factor divisor.this / k
.public Complex divide(Complex that)
that
- the complex divisor.this / that
.public Complex conjugate()
(this.real(), - this.imaginary())
.public double magnitude()
public double argument()
public Complex sqrt()
sqrt(this)
.public Complex exp()
ePI*i
= -1
exp(this)
.public Complex log()
log(this)
.public Complex pow(double e)
e
- the exponent.this**e
.public Complex pow(Complex that)
that
- the exponent.this**that
.public boolean equals(Complex that, double tolerance)
that
- the complex to compare with.tolerance
- the maximum magnitude of the difference between
them before they are considered not equal.true
if they are considered equal;
false
otherwise.public boolean equals(java.lang.Object that)
public int hashCode()
public javolution.text.Text toText()
public long longValue()
public double doubleValue()
doubleValue
in class Number<Complex>
(double) this.getReal()
public int compareTo(Complex that)
public boolean isLargerThan(Complex that)
magnitude
of this complex number
with the magnitude of the complex number specified.isLargerThan
in class Number<Complex>
that
- the complex number to be compared with.|this| > |that|