|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
com.dautelle.math.numbers.RealtimeNumber
com.dautelle.math.numbers.Complex
This class represents an immutable complex number.
Nested Class Summary | |
static class |
Complex.Value
This inner class represents a mutable image of an immutable Complex . |
Nested classes inherited from class com.dautelle.math.numbers.RealtimeNumber |
RealtimeNumber.Factory |
Field Summary | |
static Complex |
I
The imaginary unit i. |
static Complex |
ONE
The complex number one. |
static Complex |
ZERO
The complex number zero. |
Method Summary | |
Complex |
add(Complex that)
Returns the sum of this complex with the one specified. |
java.lang.StringBuffer |
appendTo(java.lang.StringBuffer sb)
Appends the the text representation of this complex number using its cartesian form to the StringBuffer argument. |
double |
argument()
Returns the argument of this complex number. |
Complex |
conjugate()
Returns the conjugate of this complex number. |
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()
Returns the magnitude of this Complex as a double . |
boolean |
equals(Complex that,
double tolerance)
Indicates if two complexes are "sufficiently" alike to be considered equal. |
static boolean |
equals(Matrix A,
Matrix B,
double tolerance)
Indicates if two complex matrices 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. |
float |
floatValue()
Returns the magnitude of this Complex as a float . |
int |
hashCode()
Returns the hash code for this complex number. |
double |
imaginary()
Returns the imaginary component of this complex number. |
int |
intValue()
Returns the magnitude of this Complex as an int . |
Complex |
inverse()
Returns the inverse of this complex. |
boolean |
isInfinite()
Indicates if either the real or imaginary component of this complex is infinite. |
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()
Returns the magnitude of this Complex as a long . |
double |
magnitude()
Returns the magnitude of this complex number, also referred to as the "modulus" or "length". |
Complex |
multiply(Complex that)
Returns the product of this complex with the one specified. |
Complex |
multiply(double k)
Returns this complex multiplied by the specified factor. |
Complex |
negate()
Returns the negation of this complex. |
Operable |
opposite()
Returns the additive inverse of this object. |
Operable |
plus(Operable that)
Returns the sum of this object 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. |
double |
real()
Returns the real component of this complex number. |
Operable |
reciprocal()
Returns the multiplicative inverse of this object. |
Complex |
sqrt()
Returns one of the two square root of this complex number. |
Complex |
subtract(Complex that)
Returns the difference between this complex and the one specified. |
Operable |
times(Operable that)
Returns the product of this object with the one specified. |
java.lang.String |
toString()
Returns the text representation of this complex number using its cartesian form. |
void |
toXml(XmlElement xml)
Sets the attributes and content of the XML element corresponding to this object. |
static Complex |
valueOf(java.lang.CharSequence chars)
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. |
static Complex |
valueOf(XmlElement xml)
XML factory method. |
Methods inherited from class com.dautelle.math.numbers.RealtimeNumber |
clone, export, isLocalObject, isPoolObject, pow, recycle, toHeap |
Methods inherited from class java.lang.Number |
byteValue, shortValue |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Complex ZERO
public static final Complex ONE
public static final Complex I
Method Detail |
public static Complex valueOf(double real, double imaginary)
real
- the real component of this complex number.imaginary
- the imaginary component of this complex number.
real()
,
imaginary()
public static Complex valueOf(java.lang.CharSequence chars)
"1.0 + 2.0i"
, "1.3 - 2.5i"
).
chars
- the character sequence.
java.lang.NumberFormatException
- if this character sequence does not contain
a parsable complex number.public static Complex valueOf(XmlElement xml)
xml
- the XML element describing the complex number to return (e.g.
<math:Complex real="0.0" imaginary="1.0"/>
).
public final boolean isInfinite()
true
if this complex is infinite;
false
otherwise.public final boolean isNaN()
true
if this complex is NaN;
false
otherwise.public final double real()
public final double imaginary()
public Complex negate()
-this
.public Complex add(Complex that)
that
- the complex to be added.
this + that
.public Complex subtract(Complex that)
that
- the complex to be subtracted.
this - that
.public Complex multiply(double k)
k
- the factor multiplier.
this * k
.public Complex multiply(Complex that)
that
- the complex multiplier.
this * that
.public Complex inverse()
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 static boolean equals(Matrix A, Matrix B, double tolerance)
A
- the first complex matrix.B
- the second complex matrix.tolerance
- the maximum difference between their complex elements
before they are considered not equal.
true
if A
and B
are
considered equal; false
otherwise.
java.lang.ClassCastException
- if A
or B
are not
exclusively composed of complex numbers.equals(Complex, double)
public boolean equals(java.lang.Object that)
that
- the object to compare with.
true
if the objects are the same;
false
otherwise.public int hashCode()
public java.lang.StringBuffer appendTo(java.lang.StringBuffer sb)
StringBuffer
argument.
For example: "1.0 + 2.0i"
, "1.3 - 2.5i"
).
sb
- the StrinBuffer
to append.
StrinBuffer
.public java.lang.String toString()
"1.0 + 2.0i"
, "1.3 - 2.5i"
).
public int intValue()
Complex
as an int
.
(int) magnitude()
public long longValue()
Complex
as a long
.
(long) magnitude()
public float floatValue()
Complex
as a float
.
(float) magnitude()
public double doubleValue()
Complex
as a double
.
magnitude()
public Operable plus(Operable that)
Operable
that
- the object to be added.
this + that
.public Operable opposite()
Operable
this.plus(this.opposite()) == ZERO
,
with ZERO
being the additive identity.
-this
.public Operable times(Operable that)
Operable
that
- the object multiplier.
this * that
.public Operable reciprocal()
Operable
this.times(this.reciprocal()) == ONE
,
with ONE
being the multiplicative identity.
ONE / this
.public void toXml(XmlElement xml)
Representable
xml
- the XML element to set according to this object's desired XML
representation.
|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |