org.apache.commons.math.complex
Class Complex

java.lang.Object
  extended byorg.apache.commons.math.complex.Complex
All Implemented Interfaces:
Serializable

public class Complex
extends Object
implements Serializable

Reference: http://myweb.lmu.edu/dmsmith/ZMLIB.pdf

Version:
$Revision: 1.4 $ $Date: 2003/11/19 03:28:25 $
See Also:
Serialized Form

Field Summary
static Complex I
          The square root of -1.
protected  double imaginary
          The imaginary part.
static Complex NaN
           
static Complex ONE
          1.
protected  double real
          The real part.
 
Constructor Summary
Complex(double real, double imaginary)
          Create a complex number given the real and imaginary parts.
 
Method Summary
 double abs()
          Return the absolute value of this complex number.
 Complex add(Complex rhs)
          Return the sum of this complex number and the given complex number.
 Complex conjugate()
          Return the conjugate of this complex number.
 Complex divide(Complex rhs)
          Return the quotient of this complex number and the given complex number.
 boolean equals(Object other)
           
 double getImaginary()
          Access the imaginary part.
 double getReal()
          Access the real part.
 boolean isNaN()
          Returns true if this complex number is the special Not-a-Number (NaN) value.
 Complex multiply(Complex rhs)
          Return the product of this complex number and the given complex number.
 Complex negate()
          Return the additive inverse of this complex number.
 Complex subtract(Complex rhs)
          Return the difference between this complex number and the given complex number.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

I

public static final Complex I
The square root of -1.


NaN

public static final Complex NaN

ONE

public static final Complex ONE
1.


imaginary

protected double imaginary
The imaginary part.


real

protected double real
The real part.

Constructor Detail

Complex

public Complex(double real,
               double imaginary)
Create a complex number given the real and imaginary parts.

Parameters:
real - the real part.
imaginary - the imaginary part.
Method Detail

abs

public double abs()
Return the absolute value of this complex number.

Returns:
the absolute value.

add

public Complex add(Complex rhs)
Return the sum of this complex number and the given complex number.

Parameters:
rhs - the other complex number.
Returns:
the complex number sum.

conjugate

public Complex conjugate()
Return the conjugate of this complex number.

Returns:
the conjugate.

divide

public Complex divide(Complex rhs)
Return the quotient of this complex number and the given complex number.

Parameters:
rhs - the other complex number.
Returns:
the complex number quotient.

equals

public boolean equals(Object other)

getImaginary

public double getImaginary()
Access the imaginary part.

Returns:
the imaginary part.

getReal

public double getReal()
Access the real part.

Returns:
the real part.

isNaN

public boolean isNaN()
Returns true if this complex number is the special Not-a-Number (NaN) value.

Returns:
true if the value represented by this object is NaN; false otherwise.

multiply

public Complex multiply(Complex rhs)
Return the product of this complex number and the given complex number.

Parameters:
rhs - the other complex number.
Returns:
the complex number product.

negate

public Complex negate()
Return the additive inverse of this complex number.

Returns:
the negation of this complex number.

subtract

public Complex subtract(Complex rhs)
Return the difference between this complex number and the given complex number.

Parameters:
rhs - the other complex number.
Returns:
the complex number difference.


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.