jm.jigl
Class Complex

java.lang.Object
  |
  +--java.lang.Number
        |
        +--jm.jigl.Complex
All Implemented Interfaces:
java.io.Serializable

public class Complex
extends java.lang.Number

Complex Number Operation

See Also:
jigl.math.Complex, Serialized Form

Field Summary
protected  float x
          the real part of the Complex number
protected  float y
          imaginary part of the Complex number
 
Constructor Summary
Complex()
          Sets the real and imaginary part of the complex number to zero
Complex(Complex z)
          Initilizes the complex number to z
Complex(double a, double b)
          Initilizes the real and imaginary part to a and b repectively
 
Method Summary
 Complex add(Complex z)
          Adds this complex number to another complex number
static Complex add(Complex z1, Complex z2)
          Adds two complex numbers
 Complex add(double a)
          Adds a constant to the real part of this complex number
 double arg()
          Performs the function on the complex number
 Complex conj()
          Performs the conjuction function on the complex number
 Complex cos()
          Returns the cosine of this complex number
 Complex cosh()
          Returns the hyperbolic cosine of this complex number
 Complex div(Complex z)
          Divides this complex number by another complex number
static Complex div(Complex z1, Complex z2)
          Divides two complex numbers
 Complex div(double a)
          Divides this complex number by a constant
 double doubleValue()
          Returns the double value of this complex number
 boolean equals(Complex z)
          Compares this complex number to another Complex number
 Complex exp()
          Returns the exponential function of this complex number
 float floatValue()
          Returns the float value of this complex number
 double imag()
          Return the imaginary part of the imaginary number
 double imag(double a)
          Set the imaginary part of the complex number and returns old value
 int intValue()
          Returns the integer value of this complex number
 Complex log()
          Returns the logarithmic function of this complex number
 long longValue()
          Returns the long value of this complex number
 double mod()
          Performs the mod function on the complex number
 Complex mult(Complex z)
          Multiplies this complex number by another complex number
static Complex mult(Complex z1, Complex z2)
          Multiplies two complex numbers
 Complex mult(double a)
          Multiplies this complex number by a constant
 void polar(double r, double t)
          Performs the polar function on the complex number
 Complex pow(double a)
          Returns this complex number raised to the a complex number
 double real()
          Returns the real part of the complex number
 double real(double a)
          Set the real part of the complex number and returns old value
 Complex sign()
          Performs the function on the complex number
 Complex sin()
          Returns the sine of this complex number
 Complex sinh()
          Returns the hyperbolic sine of this complex number
 Complex sqrt()
          Returns the square root of this complex number
 Complex sub(Complex z)
          Subtracts another complex number from this complex number
static Complex sub(Complex z1, Complex z2)
          Subtracts two complex numbers
 Complex sub(double a)
          Subtracts a constant from the real part of this complex number
 java.lang.String toString()
          Return the string representation of this complex number
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

protected float x
the real part of the Complex number


y

protected float y
imaginary part of the Complex number

Constructor Detail

Complex

public Complex()
Sets the real and imaginary part of the complex number to zero


Complex

public Complex(double a,
               double b)
Initilizes the real and imaginary part to a and b repectively

Parameters:
a - Real part of the complex number
b - the imaginary part of the complex number

Complex

public Complex(Complex z)
Initilizes the complex number to z

Method Detail

real

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


real

public double real(double a)
Set the real part of the complex number and returns old value


imag

public double imag()
Return the imaginary part of the imaginary number


imag

public double imag(double a)
Set the imaginary part of the complex number and returns old value


mod

public double mod()
Performs the mod function on the complex number


arg

public double arg()
Performs the function on the complex number


sign

public Complex sign()
Performs the function on the complex number


conj

public Complex conj()
Performs the conjuction function on the complex number


polar

public void polar(double r,
                  double t)
Performs the polar function on the complex number


equals

public boolean equals(Complex z)
Compares this complex number to another Complex number


toString

public java.lang.String toString()
Return the string representation of this complex number

Overrides:
toString in class java.lang.Object

add

public Complex add(Complex z)
Adds this complex number to another complex number


sub

public Complex sub(Complex z)
Subtracts another complex number from this complex number


mult

public Complex mult(Complex z)
Multiplies this complex number by another complex number


div

public Complex div(Complex z)
Divides this complex number by another complex number


add

public Complex add(double a)
Adds a constant to the real part of this complex number

Parameters:
a - constant to add

sub

public Complex sub(double a)
Subtracts a constant from the real part of this complex number

Parameters:
a - constant to add

mult

public Complex mult(double a)
Multiplies this complex number by a constant

Parameters:
a - constant to add

div

public Complex div(double a)
Divides this complex number by a constant

Parameters:
a - constant to divide by

sqrt

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


exp

public Complex exp()
Returns the exponential function of this complex number


log

public Complex log()
Returns the logarithmic function of this complex number


pow

public Complex pow(double a)
Returns this complex number raised to the a complex number


cosh

public Complex cosh()
Returns the hyperbolic cosine of this complex number


sinh

public Complex sinh()
Returns the hyperbolic sine of this complex number


cos

public Complex cos()
Returns the cosine of this complex number


sin

public Complex sin()
Returns the sine of this complex number


doubleValue

public double doubleValue()
Returns the double value of this complex number

Specified by:
doubleValue in class java.lang.Number

floatValue

public float floatValue()
Returns the float value of this complex number

Specified by:
floatValue in class java.lang.Number

intValue

public int intValue()
Returns the integer value of this complex number

Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Returns the long value of this complex number

Specified by:
longValue in class java.lang.Number

add

public static Complex add(Complex z1,
                          Complex z2)
Adds two complex numbers

Parameters:
z1 - first complex number
z2 - second complex number

sub

public static Complex sub(Complex z1,
                          Complex z2)
Subtracts two complex numbers

Parameters:
z1 - first complex number
z2 - second complex number (subtracted from the first)

mult

public static Complex mult(Complex z1,
                           Complex z2)
Multiplies two complex numbers

Parameters:
z1 - first complex number
z2 - second complex number

div

public static Complex div(Complex z1,
                          Complex z2)
Divides two complex numbers

Parameters:
z1 - first complex number
z2 - second complex number