public final class Complex extends Object implements FieldElement<Complex>
| Constructor and Description |
|---|
Complex()
Construct a new complex number with real and imaginary parts both equal to 0.
|
Complex(double real)
Construct a new complex number with zero imaginary part, i.e, a real number.
|
Complex(double real,
double im)
Construct a new complex number with the given real and imaginary parts.
|
| Modifier and Type | Method and Description |
|---|---|
double |
abs()
Compute and return the absolute value of this element.
|
Complex |
additiveInverse()
Return the element of this field that, when added to this element, produces the additive identity.
|
int |
compareTo(Complex other) |
Complex |
conjugate()
Compute and return the conjugate of this element.
|
Complex |
dividedBy(Complex value)
Divide this element by the given element and return the result.
|
Complex |
dividedBy(double value)
Divide this element by the given double.
|
static Complex |
from(Real real) |
double |
im()
The imaginary part of this complex number.
|
boolean |
isReal()
Returns true if this complex number is also a real number and false otherwise.
|
Complex |
minus(Complex other)
Subtract the given element from this element.
|
Complex |
plus(Complex other)
Add this element to the given element.
|
Complex |
plus(double other)
Add this element to the given double.
|
double |
real()
The real part of this complex number.
|
Complex |
sqrt()
The square root operation applied to this element.
|
Complex |
times(Complex other)
Multiply this element by the given element.
|
String |
toString() |
static Complex |
zero() |
public Complex()
public Complex(double real)
real - the real part of the new complex number.public Complex(double real,
double im)
real - the real part of the new complex number.im - the imaginary part of the new complex number.public static Complex zero()
public final Complex plus(Complex other)
FieldElementplus in interface FieldElement<Complex>other - the element to add to this element.public final Complex plus(double other)
other - the double to add to this element.public final Complex minus(Complex other)
FieldElementminus in interface FieldElement<Complex>other - the element to subtract from this element.public final Complex times(Complex other)
FieldElementtimes in interface FieldElement<Complex>other - the element to multiply this element by.public final Complex dividedBy(double value)
value - the double to divide this element by.public final Complex dividedBy(Complex value)
FieldElementdividedBy in interface FieldElement<Complex>value - the divisor.public final Complex conjugate()
FieldElementconjugate in interface FieldElement<Complex>public final double abs()
FieldElementabs in interface FieldElement<Complex>public Complex additiveInverse()
FieldElementadditiveInverse in interface FieldElement<Complex>public Complex sqrt()
FieldElementsqrt in interface FieldElement<Complex>public final double real()
public final double im()
public final boolean isReal()
public int compareTo(@NonNull
Complex other)
compareTo in interface Comparable<Complex>