org.jscience.mathematics.algebraic.numbers
Class Complex

java.lang.Object
  extended by java.lang.Number
      extended by org.jscience.mathematics.algebraic.numbers.Complex
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 Complex
extends java.lang.Number
implements java.lang.Cloneable, java.io.Serializable, Field.Member, CStarAlgebra.Member

The Complex class encapsulates complex numbers. It complements Java support for Byte, Integer, Long, Float, Double.,

See Also:
Serialized Form

Field Summary
static Complex HALF
          DOCUMENT ME!
static Complex HALF_I
          DOCUMENT ME!
static Complex I
          The complex number 0+1i.
static double MAX_IMAGINARY_VALUE
           
static double MAX_REAL_VALUE
           
static double MIN_IMAGINARY_VALUE
           
static double MIN_REAL_VALUE
           
static Complex MINUS_HALF
          DOCUMENT ME!
static Complex MINUS_HALF_I
          DOCUMENT ME!
static Complex MINUS_I
          DOCUMENT ME!
static Complex MINUS_ONE
          DOCUMENT ME!
static Complex MINUS_PI_2
          This is the value of -PI/2 rounded to that same number of digits as given by -Math.PI/2
static Complex 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 Complex MINUS_SQRT_HALF_I
          DOCUMENT ME!
static Complex MINUS_TWO
          DOCUMENT ME!
static double NaN
           
static double NEGATIVE_IMAGINARY_INFINITY
           
static double NEGATIVE_REAL_INFINITY
           
static Complex ONE
          The complex number 1+0i.
static Complex PI
          This is the value of PI rounded to that same number of digits as given by Math.PI
static Complex PI_2
          This is the value of PI/2 rounded to that same number of digits as given by Math.PI/2
static Complex 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 Complex PI_I
          This is the value of PI as imaginary rounded to that same number of digits as given by Math.PI
static double POSITIVE_IMAGINARY_INFINITY
           
static double POSITIVE_REAL_INFINITY
           
static Complex SQRT_HALF
          DOCUMENT ME!
static Complex SQRT_HALF_I
          DOCUMENT ME!
static Complex TWO
          DOCUMENT ME!
static java.lang.Class TYPE
           
static Complex ZERO
          The complex number 0+0i.
 
Constructor Summary
Complex(Complex num)
          Constructs a complex number using the supplied argument.
Complex(double num)
          Constructs a Complex number.
Complex(Double num)
          Constructs a complex number using the supplied argument for the real part.
Complex(double x, double y)
          Constructs the complex number x+iy.
Complex(Double x, Double y)
          Constructs the complex number x+iy.
Complex(float num)
          Constructs a Complex number.
Complex(Float num)
          Constructs a complex number using the supplied argument for the real part.
Complex(int num)
          Constructs a Complex number.
Complex(Integer num)
          Constructs a complex number using the supplied argument for the real part.
Complex(long num)
          Constructs a Complex number.
Complex(Long num)
          Constructs a complex number using the supplied argument for the real part.
Complex(Rational num)
          Constructs a complex number using the supplied argument for the real part.
Complex(java.lang.String s)
          Constructs the complex number represented by a string.
 
Method Summary
 double abs()
          this ‚Ì?
static Complex acos(Complex z)
          Returns the arc cosine of a complex number, in the range of (0.0 through pi, 0.0 through infinity).
static Complex acosh(Complex z)
          Returns the arc hyperbolic cosine of a complex number, in the range of (0.0 through infinity, 0.0 through pi).
 AbelianGroup.Member add(AbelianGroup.Member x)
          Returns the addition of this number and another.
 Complex add(Complex z)
          Returns the addition of this complex number and another.
 Complex addImag(double imag)
          Returns the addition of this complex number with an imaginary part.
 Complex addReal(double real)
          Returns the addition of this complex number with a real part.
 double arg()
          Returns the argument of this complex number.
static Complex asin(Complex z)
          Returns the arc sine of a complex number, in the range of (-pi/2 through pi/2, -infinity through infinity).
static Complex asinh(Complex z)
          Returns the arc hyperbolic sine of a complex number, in the range of (-infinity through infinity, -pi/2 through pi/2).
static Complex atan(Complex z)
          Returns the arc tangent of a complex number, in the range of (-pi/2 through pi/2, -infinity through infinity).
static Complex atanh(Complex z)
          Returns the arc hyperbolic tangent of a complex number, in the range of (-infinity through infinity, -pi/2 through pi/2).
 java.lang.Object clone()
           
 Complex conjugate()
          Returns the complex conjugate of this complex number.
static Complex cos(Complex z)
          Returns the trigonometric cosine of a complex angle.
static Complex cosh(Complex z)
          Returns the hyperbolic cosine of a complex number.
 Complex divide(Complex z)
          Returns the division of this complex number by another.
 Complex divide(double 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(double real, double imag)
          Compares two complex numbers for equality.
 boolean equals(java.lang.Object obj)
          Compares two complex numbers for equality.
static Complex exp(Complex z)
          Returns the exponential number e (2.718...) raised to the power of a complex number.
 float floatValue()
           
 Complex getEpsilon()
          ‚±‚Ì•¡‘f?”
 int hashCode()
          Returns a hashcode for this complex number.
 double 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 isImag()
          Returns true for pure imaginary numbers.
 boolean isInfinite()
          Returns true if either the real or imaginary part is infinite.
 boolean isNaN()
          Returns true if either the real or imaginary part is NaN.
 boolean isReal()
          Returns true for pure real numbers.
static Complex log(Complex z)
          Returns the natural logarithm (base e) of a complex number.
 long longValue()
           
 double mod()
          Returns the modulus of this complex number.
 Complex multiply(Complex z)
          Returns the multiplication of this complex number and another.
 Complex multiply(double 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 Complex polar(double mod, double arg)
          Creates a complex number with the given modulus and argument.
 Complex pow(Complex z)
          Returns this complex number raised to the power of another.
 Complex pow(double x)
          Returns this complex number raised to the power of a scalar.
 double 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.
static Complex sin(Complex z)
          Returns the trigonometric sine of a complex angle.
static Complex sinh(Complex z)
          Returns the hyperbolic sine of a complex number.
 Complex sqr()
          Returns the square of this complex number.
 Complex sqrt()
          Returns the square root of this complex number.
 AbelianGroup.Member subtract(AbelianGroup.Member x)
          Returns the subtraction of this number and another.
 Complex subtract(Complex z)
          Returns the subtraction of this complex number by another.
 Complex subtractImag(double imag)
          Returns the subtraction of this complex number by an imaginary part.
 Complex subtractReal(double real)
          Returns the subtraction of this complex number by a real part.
static Complex tan(Complex z)
          Returns the trigonometric tangent of a complex angle.
static Complex tanh(Complex z)
          Returns the hyperbolic tangent of a complex number.
 java.lang.String toString()
          Returns a string representing the value of this complex number.
static java.lang.String toString(double real, double imag)
          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 Complex I
The complex number 0+1i.


ONE

public static final Complex ONE
The complex number 1+0i.


ZERO

public static final Complex ZERO
The complex number 0+0i.


MINUS_ONE

public static final Complex MINUS_ONE
DOCUMENT ME!


MINUS_I

public static final Complex MINUS_I
DOCUMENT ME!


HALF

public static final Complex HALF
DOCUMENT ME!


MINUS_HALF

public static final Complex MINUS_HALF
DOCUMENT ME!


HALF_I

public static final Complex HALF_I
DOCUMENT ME!


MINUS_HALF_I

public static final Complex MINUS_HALF_I
DOCUMENT ME!


TWO

public static final Complex TWO
DOCUMENT ME!


MINUS_TWO

public static final Complex MINUS_TWO
DOCUMENT ME!


SQRT_HALF

public static final Complex SQRT_HALF
DOCUMENT ME!


SQRT_HALF_I

public static final Complex SQRT_HALF_I
DOCUMENT ME!


MINUS_SQRT_HALF_I

public static final Complex MINUS_SQRT_HALF_I
DOCUMENT ME!


PI

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


PI_I

public static final Complex 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 Complex 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 Complex 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 Complex 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 Complex 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


MAX_REAL_VALUE

public static final double MAX_REAL_VALUE
See Also:
Constant Field Values

MIN_REAL_VALUE

public static final double MIN_REAL_VALUE
See Also:
Constant Field Values

MAX_IMAGINARY_VALUE

public static final double MAX_IMAGINARY_VALUE
See Also:
Constant Field Values

MIN_IMAGINARY_VALUE

public static final double MIN_IMAGINARY_VALUE
See Also:
Constant Field Values

NaN

public static final double NaN
See Also:
Constant Field Values

NEGATIVE_REAL_INFINITY

public static final double NEGATIVE_REAL_INFINITY
See Also:
Constant Field Values

POSITIVE_REAL_INFINITY

public static final double POSITIVE_REAL_INFINITY
See Also:
Constant Field Values

NEGATIVE_IMAGINARY_INFINITY

public static final double NEGATIVE_IMAGINARY_INFINITY
See Also:
Constant Field Values

POSITIVE_IMAGINARY_INFINITY

public static final double POSITIVE_IMAGINARY_INFINITY
See Also:
Constant Field Values

TYPE

public static final java.lang.Class TYPE
Constructor Detail

Complex

public Complex(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.

Complex

public Complex(double num)
Constructs a Complex number.


Complex

public Complex(float num)
Constructs a Complex number.


Complex

public Complex(long num)
Constructs a Complex number.


Complex

public Complex(int num)
Constructs a Complex number.


Complex

public Complex(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.

Complex

public Complex(Complex num)
Constructs a complex number using the supplied argument.


Complex

public Complex(Double num)
Constructs a complex number using the supplied argument for the real part.


Complex

public Complex(Float num)
Constructs a complex number using the supplied argument for the real part.


Complex

public Complex(Rational num)
Constructs a complex number using the supplied argument for the real part.


Complex

public Complex(Long num)
Constructs a complex number using the supplied argument for the real part.


Complex

public Complex(Integer num)
Constructs a complex number using the supplied argument for the real part.


Complex

public Complex(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 Complex 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.

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.

equals

public boolean equals(double real,
                      double imag)
Compares two complex numbers for equality.


toString

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

Overrides:
toString in class java.lang.Object

toString

public static java.lang.String toString(double real,
                                        double imag)
Returns a string representing the value of this complex number.


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

isNaN

public boolean isNaN()
Returns true if either the real or imaginary part is NaN.


isInfinite

public boolean isInfinite()
Returns true if either the real or imaginary part is infinite.


real

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


imag

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


isReal

public boolean isReal()
Returns true for pure real numbers.


isImag

public boolean isImag()
Returns true for pure imaginary numbers.


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 Complex 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 Complex add(Complex z)
Returns the addition of this complex number and another.

Parameters:
z - a complex number.

addReal

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

Parameters:
real - a real part.

addImag

public Complex 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 Complex subtract(Complex z)
Returns the subtraction of this complex number by another.

Parameters:
z - a complex number.

subtractReal

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

Parameters:
real - a real part.

subtractImag

public Complex subtractImag(double imag)
Returns the subtraction of this complex number by 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 Complex multiply(Complex z)
Returns the multiplication of this complex number and another.

Parameters:
z - a complex number.

multiply

public Complex multiply(double 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 Complex divide(Complex 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 Complex 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.

pow

public Complex pow(Complex z)
Returns this complex number raised to the power of another.

Parameters:
z - a complex number.

pow

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

Parameters:
x - a real number.

abs

public double abs()
this ‚Ì?â‘Î’l‚ð•Ô‚·?B

Returns:
this ‚Ì?â‘Î’l

sqr

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


sqrt

public Complex sqrt()
Returns the square root of this complex number.


exp

public static Complex exp(Complex z)
Returns the exponential number e (2.718...) raised to the power of a complex number.

Parameters:
z - a complex number.

log

public static Complex log(Complex z)
Returns the natural logarithm (base e) of a complex number.

Parameters:
z - a complex number.

sin

public static Complex sin(Complex z)
Returns the trigonometric sine of a complex angle.

Parameters:
z - an angle that is measured in radians.

cos

public static Complex cos(Complex z)
Returns the trigonometric cosine of a complex angle.

Parameters:
z - an angle that is measured in radians.

tan

public static Complex tan(Complex z)
Returns the trigonometric tangent of a complex angle.

Parameters:
z - an angle that is measured in radians.

sinh

public static Complex sinh(Complex z)
Returns the hyperbolic sine of a complex number.

Parameters:
z - a complex number.

cosh

public static Complex cosh(Complex z)
Returns the hyperbolic cosine of a complex number.

Parameters:
z - a complex number.

tanh

public static Complex tanh(Complex z)
Returns the hyperbolic tangent of a complex number.

Parameters:
z - a complex number.

asin

public static Complex asin(Complex z)
Returns the arc sine of a complex number, in the range of (-pi/2 through pi/2, -infinity through infinity).

Parameters:
z - a complex number.

acos

public static Complex acos(Complex z)
Returns the arc cosine of a complex number, in the range of (0.0 through pi, 0.0 through infinity).

Parameters:
z - a complex number.

atan

public static Complex atan(Complex z)
Returns the arc tangent of a complex number, in the range of (-pi/2 through pi/2, -infinity through infinity).

Parameters:
z - a complex number.

asinh

public static Complex asinh(Complex z)
Returns the arc hyperbolic sine of a complex number, in the range of (-infinity through infinity, -pi/2 through pi/2).

Parameters:
z - a complex number.

acosh

public static Complex acosh(Complex z)
Returns the arc hyperbolic cosine of a complex number, in the range of (0.0 through infinity, 0.0 through pi).

Parameters:
z - a complex number.

atanh

public static Complex atanh(Complex z)
Returns the arc hyperbolic tangent of a complex number, in the range of (-infinity through infinity, -pi/2 through pi/2).

Parameters:
z - a complex number.

getEpsilon

public final Complex getEpsilon()
‚±‚Ì•¡‘f?”‚Ì•„?†‚ɑΉž‚µ‚½?u•¡‘f?”‚̊ۂߌë?·?v‚ð•Ô‚·?B

Returns:
‚±‚Ì•¡‘f?”‚Ì•„?†‚ɑΉž‚µ‚½?u•¡‘f?”‚̊ۂߌë?·?v

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object