org.jscience.mathematics.algebraic.numbers
Class ExactComplex

java.lang.Object
  extended by java.lang.Number
      extended by org.jscience.mathematics.algebraic.numbers.ExactComplex
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Algebra.Member, BanachSpace.Member, CStarAlgebra.Member, Field.Member, Ring.Member, AbelianGroup.Member, Module.Member, VectorSpace.Member, Member

public final class ExactComplex
extends java.lang.Number
implements java.lang.Cloneable, java.io.Serializable, Field.Member, CStarAlgebra.Member

The ExactComplex class encapsulates complex numbers using ExactReals for real and imaginary part.

See Also:
Serialized Form

Field Summary
static ExactComplex HALF
          DOCUMENT ME!
static ExactComplex HALF_I
          DOCUMENT ME!
static ExactComplex I
          The complex number 0+1i.
static ExactComplex MINUS_HALF
          DOCUMENT ME!
static ExactComplex MINUS_HALF_I
          DOCUMENT ME!
static ExactComplex MINUS_I
          DOCUMENT ME!
static ExactComplex MINUS_ONE
          DOCUMENT ME!
static ExactComplex MINUS_PI_2
          This is the value of -PI/2 rounded to that same number of digits as given by -Math.PI/2
static ExactComplex MINUS_PI_2_I
          This is the value of -PI/2 as imaginary rounded to that same number of digits as given by -Math.PI/2
static ExactComplex MINUS_SQRT_HALF_I
          DOCUMENT ME!
static ExactComplex MINUS_TWO
          DOCUMENT ME!
static ExactComplex ONE
          The ExactComplex number 1+0i.
static ExactComplex PI
          This is the value of PI rounded to that same number of digits as given by Math.PI
static ExactComplex PI_2
          This is the value of PI/2 rounded to that same number of digits as given by Math.PI/2
static ExactComplex PI_2_I
          This is the value of PI/2 as imaginary rounded to that same number of digits as given by Math.PI/2
static ExactComplex PI_I
          This is the value of PI as imaginary rounded to that same number of digits as given by Math.PI
static ExactComplex SQRT_HALF
          DOCUMENT ME!
static ExactComplex SQRT_HALF_I
          DOCUMENT ME!
static ExactComplex TWO
          DOCUMENT ME!
static java.lang.Class TYPE
           
static ExactComplex ZERO
          The ExactComplex number 0+0i.
 
Constructor Summary
ExactComplex(Complex value)
          Constructs the complex number x+iy.
ExactComplex(double x)
          Constructs the complex number x+iy.
ExactComplex(double x, double y)
          Constructs the complex number x+iy.
ExactComplex(ExactComplex value)
          Constructs the complex number x+iy.
ExactComplex(ExactReal x)
          Constructs the complex number x+iy.
ExactComplex(ExactReal x, ExactReal y)
          Constructs the complex number x+iy.
ExactComplex(java.lang.String s)
          Constructs the complex number represented by a string.
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member x)
          Returns the addition of this number and another.
 ExactComplex add(ExactComplex z)
          Returns the addition of this complex number and another.
 ExactComplex addImag(double imag)
          Returns the addition of this complex number with an imaginary part.
 ExactComplex addImag(ExactReal imag)
          Returns the addition of this complex number with an imaginary part.
 ExactComplex addReal(double real)
          Returns the addition of this complex number with a real part.
 ExactComplex addReal(ExactReal real)
          Returns the addition of this complex number with a real part.
 double arg()
          Returns the argument of this complex number.
 java.lang.Object clone()
          Returns the arc hyperbolic tangent of a complex number, in the range of (-infinity through infinity, -pi/2 through pi/2).
 ExactComplex conjugate()
          Returns the complex conjugate of this complex number.
 ExactComplex divide(double x)
          Returns the division of this complex number by a scalar.
 ExactComplex divide(ExactComplex z)
          Returns the division of this complex number by another.
 ExactComplex divide(ExactReal x)
          Returns the division of this complex number by a scalar.
 Field.Member divide(Field.Member x)
          Returns the division of this number and another.
 double doubleValue()
           
 boolean equals(java.lang.Object obj)
          Compares two complex numbers for equality.
 float floatValue()
           
 int hashCode()
          Returns a hashcode for this complex number.
 ExactReal imag()
          Returns the imaginary part of this complex number.
 int intValue()
           
 Field.Member inverse()
          Returns the inverse of this complex number.
 CStarAlgebra.Member involution()
          Returns the involution of this complex number.
 boolean isInfinite()
          Check if this number is infinite whether on its imaginary or its real part.
 boolean isNaN()
          Check if this number is NaN.
 long longValue()
           
 double mod()
          Returns the modulus of this complex number.
 ExactComplex multiply(double x)
          Returns the multiplication of this complex number by a scalar.
 ExactComplex multiply(ExactComplex z)
          Returns the multiplication of this complex number and another.
 ExactComplex multiply(ExactReal x)
          Returns the multiplication of this complex number by a scalar.
 Ring.Member multiply(Ring.Member x)
          Returns the multiplication of this number and another.
 AbelianGroup.Member negate()
          Returns the negative of this complex number.
 double norm()
          Returns the C* norm.
static ExactComplex polar(double mod, double arg)
          Creates a complex number with the given modulus and argument.
 ExactComplex pow(int x)
          Returns this complex number raised to the power of a scalar.
 ExactReal real()
          Returns the real part of this complex number.
 VectorSpace.Member scalarDivide(Field.Member x)
          Returns the division of this number by a complex scalar.
 Module.Member scalarMultiply(Ring.Member x)
          Returns the multiplication of this number by a complex scalar.
 ExactComplex sqr()
          Returns the square of this complex number.
 AbelianGroup.Member subtract(AbelianGroup.Member x)
          Returns the subtraction of this number and another.
 ExactComplex subtract(ExactComplex z)
          Returns the subtraction of this complex number and another.
 ExactComplex subtractImag(double imag)
          Returns the subtraction of this complex number with an imaginary part.
 ExactComplex subtractImag(ExactReal imag)
          Returns the subtraction of this complex number with an imaginary part.
 ExactComplex subtractReal(double real)
          Returns the subtraction of this complex number with a real part.
 ExactComplex subtractReal(ExactReal real)
          Returns the subtraction of this complex number with a real part.
 java.lang.String toString()
          Returns a string representing the value of this complex number.
 
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

I

public static final ExactComplex I
The complex number 0+1i.


ONE

public static final ExactComplex ONE
The ExactComplex number 1+0i.


ZERO

public static final ExactComplex ZERO
The ExactComplex number 0+0i.


MINUS_ONE

public static final ExactComplex MINUS_ONE
DOCUMENT ME!


MINUS_I

public static final ExactComplex MINUS_I
DOCUMENT ME!


HALF

public static final ExactComplex HALF
DOCUMENT ME!


MINUS_HALF

public static final ExactComplex MINUS_HALF
DOCUMENT ME!


HALF_I

public static final ExactComplex HALF_I
DOCUMENT ME!


MINUS_HALF_I

public static final ExactComplex MINUS_HALF_I
DOCUMENT ME!


TWO

public static final ExactComplex TWO
DOCUMENT ME!


MINUS_TWO

public static final ExactComplex MINUS_TWO
DOCUMENT ME!


SQRT_HALF

public static final ExactComplex SQRT_HALF
DOCUMENT ME!


SQRT_HALF_I

public static final ExactComplex SQRT_HALF_I
DOCUMENT ME!


MINUS_SQRT_HALF_I

public static final ExactComplex MINUS_SQRT_HALF_I
DOCUMENT ME!


PI

public static final ExactComplex PI
This is the value of PI rounded to that same number of digits as given by Math.PI


PI_I

public static final ExactComplex PI_I
This is the value of PI as imaginary rounded to that same number of digits as given by Math.PI


PI_2

public static final ExactComplex PI_2
This is the value of PI/2 rounded to that same number of digits as given by Math.PI/2


MINUS_PI_2

public static final ExactComplex MINUS_PI_2
This is the value of -PI/2 rounded to that same number of digits as given by -Math.PI/2


PI_2_I

public static final ExactComplex PI_2_I
This is the value of PI/2 as imaginary rounded to that same number of digits as given by Math.PI/2


MINUS_PI_2_I

public static final ExactComplex MINUS_PI_2_I
This is the value of -PI/2 as imaginary rounded to that same number of digits as given by -Math.PI/2


TYPE

public static final java.lang.Class TYPE
Constructor Detail

ExactComplex

public ExactComplex(ExactReal x,
                    ExactReal y)
Constructs the complex number x+iy.

Parameters:
x - the real value of a complex number.
y - the imaginary value of a complex number.

ExactComplex

public ExactComplex(ExactReal x)
Constructs the complex number x+iy.

Parameters:
x - the real value of a complex number.

ExactComplex

public ExactComplex(double x,
                    double y)
Constructs the complex number x+iy.

Parameters:
x - the real value of a complex number.
y - the imaginary value of a complex number.

ExactComplex

public ExactComplex(double x)
Constructs the complex number x+iy.

Parameters:
x - the real value of a complex number.

ExactComplex

public ExactComplex(ExactComplex value)
Constructs the complex number x+iy.

Parameters:
value - the complex number to get values from

ExactComplex

public ExactComplex(Complex value)
Constructs the complex number x+iy.

Parameters:
value - the complex number to get values from

ExactComplex

public ExactComplex(java.lang.String s)
             throws java.lang.NumberFormatException
Constructs the complex number represented by a string.

Parameters:
s - a string representing a complex number.
Throws:
java.lang.NumberFormatException - if the string does not contain a parsable number.
Method Detail

polar

public static ExactComplex polar(double mod,
                                 double arg)
Creates a complex number with the given modulus and argument.

Parameters:
mod - the modulus of a complex number.
arg - the argument of a complex number.

isNaN

public boolean isNaN()
Check if this number is NaN.


isInfinite

public boolean isInfinite()
Check if this number is infinite whether on its imaginary or its real part.


equals

public boolean equals(java.lang.Object obj)
Compares two complex numbers for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a complex number.

toString

public java.lang.String toString()
Returns a string representing the value of this complex number.

Overrides:
toString in class java.lang.Object

intValue

public int intValue()
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Specified by:
longValue in class java.lang.Number

floatValue

public float floatValue()
Specified by:
floatValue in class java.lang.Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class java.lang.Number

hashCode

public int hashCode()
Returns a hashcode for this complex number.

Overrides:
hashCode in class java.lang.Object

real

public ExactReal real()
Returns the real part of this complex number.


imag

public ExactReal imag()
Returns the imaginary part of this complex number.


mod

public double mod()
Returns the modulus of this complex number.


arg

public double arg()
Returns the argument of this complex number.


norm

public double norm()
Returns the C* norm.

Specified by:
norm in interface BanachSpace.Member
Returns:
DOCUMENT ME!

negate

public AbelianGroup.Member negate()
Returns the negative of this complex number.

Specified by:
negate in interface AbelianGroup.Member
Returns:
DOCUMENT ME!

inverse

public Field.Member inverse()
Returns the inverse of this complex number.

Specified by:
inverse in interface Field.Member
Returns:
DOCUMENT ME!

involution

public CStarAlgebra.Member involution()
Returns the involution of this complex number.

Specified by:
involution in interface CStarAlgebra.Member
Returns:
DOCUMENT ME!

conjugate

public ExactComplex conjugate()
Returns the complex conjugate of this complex number.


add

public AbelianGroup.Member add(AbelianGroup.Member x)
Returns the addition of this number and another.

Specified by:
add in interface AbelianGroup.Member
Parameters:
x - a group member
Returns:
DOCUMENT ME!

add

public ExactComplex add(ExactComplex z)
Returns the addition of this complex number and another.

Parameters:
z - a complex number.

addReal

public ExactComplex addReal(ExactReal real)
Returns the addition of this complex number with a real part.

Parameters:
real - a real part.

addImag

public ExactComplex addImag(ExactReal imag)
Returns the addition of this complex number with an imaginary part.

Parameters:
imag - an imaginary part.

addReal

public ExactComplex addReal(double real)
Returns the addition of this complex number with a real part.

Parameters:
real - a real part.

addImag

public ExactComplex addImag(double imag)
Returns the addition of this complex number with an imaginary part.

Parameters:
imag - an imaginary part.

subtract

public AbelianGroup.Member subtract(AbelianGroup.Member x)
Returns the subtraction of this number and another.

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
x - a group member
Returns:
DOCUMENT ME!

subtract

public ExactComplex subtract(ExactComplex z)
Returns the subtraction of this complex number and another.

Parameters:
z - a complex number.

subtractReal

public ExactComplex subtractReal(ExactReal real)
Returns the subtraction of this complex number with a real part.

Parameters:
real - a real part.

subtractImag

public ExactComplex subtractImag(ExactReal imag)
Returns the subtraction of this complex number with an imaginary part.

Parameters:
imag - an imaginary part.

subtractReal

public ExactComplex subtractReal(double real)
Returns the subtraction of this complex number with a real part.

Parameters:
real - a real part.

subtractImag

public ExactComplex subtractImag(double imag)
Returns the subtraction of this complex number with an imaginary part.

Parameters:
imag - an imaginary part.

scalarMultiply

public Module.Member scalarMultiply(Ring.Member x)
Returns the multiplication of this number by a complex scalar.

Specified by:
scalarMultiply in interface Module.Member
Parameters:
x - a ring member
Returns:
DOCUMENT ME!

multiply

public Ring.Member multiply(Ring.Member x)
Returns the multiplication of this number and another.

Specified by:
multiply in interface Ring.Member
Parameters:
x - a ring member
Returns:
DOCUMENT ME!

multiply

public ExactComplex multiply(ExactComplex z)
Returns the multiplication of this complex number and another.

Parameters:
z - a complex number.

multiply

public ExactComplex multiply(double x)
Returns the multiplication of this complex number by a scalar.

Parameters:
x - a real number.

multiply

public ExactComplex multiply(ExactReal x)
Returns the multiplication of this complex number by a scalar.

Parameters:
x - a real number.

scalarDivide

public VectorSpace.Member scalarDivide(Field.Member x)
Returns the division of this number by a complex scalar.

Specified by:
scalarDivide in interface VectorSpace.Member
Parameters:
x - a field member
Returns:
DOCUMENT ME!

divide

public Field.Member divide(Field.Member x)
Returns the division of this number and another.

Specified by:
divide in interface Field.Member
Parameters:
x - a field member
Returns:
DOCUMENT ME!

divide

public ExactComplex divide(ExactComplex z)
Returns the division of this complex number by another.

Parameters:
z - a complex number.
Throws:
java.lang.ArithmeticException - If divide by zero.

divide

public ExactComplex divide(double x)
Returns the division of this complex number by a scalar.

Parameters:
x - a real number.
Throws:
java.lang.ArithmeticException - If divide by zero.

divide

public ExactComplex divide(ExactReal x)
Returns the division of this complex number by a scalar.

Parameters:
x - a real number.
Throws:
java.lang.ArithmeticException - If divide by zero.

pow

public ExactComplex pow(int x)
Returns this complex number raised to the power of a scalar.

Parameters:
x - a real number.

sqr

public ExactComplex sqr()
Returns the square of this complex number.


clone

public java.lang.Object clone()
Returns the arc hyperbolic tangent of a complex number, in the range of (-infinity through infinity, -pi/2 through pi/2).

Overrides:
clone in class java.lang.Object
Parameters:
z - a complex number.