jumbo.euclid
Class Complex

java.lang.Object
  |
  +--jumbo.euclid.Status
        |
        +--jumbo.euclid.Real2
              |
              +--jumbo.euclid.Complex

public class Complex
extends Real2

Complex - complex number - derived from Real2

Complex represents a complex number. A reasonable number of arithmetic operations are included - DeMoivre's theorem is used for some of them so there may be quicker implementations elsewhere.


Fields inherited from class jumbo.euclid.Real2
x, y
 
Constructor Summary
Complex()
           
Complex(Complex a)
           
Complex(double a)
          real component only
Complex(double r, Angle th)
          in polar coords
Complex(double a, double b)
          from components
Complex(Polar p)
           
Complex(Real2 a)
          from base class
 
Method Summary
 Complex divideBy(Complex f)
          divide a complex by a complex
 Polar getPolar()
           
 double getR()
          get as polar coords
 double getReal()
          gets real part
 Angle getTheta()
           
 Complex multiply(Complex f)
          multiply a complex by a complex
 void negative()
          unary minus MODIFIES object
static Complex sqrt(Complex a)
          complex square root
 java.lang.String toString()
           
 
Methods inherited from class jumbo.euclid.Real2
addPolygonOnLine, clear, dotProduct, elementAt, equals, getAngle, getAngle, getLength, getMidPoint, getUnitVector, getX, getY, makePoint, multiplyBy, plus, setX, setY, sortAscending, sortDescending, subtract, swap, transformBy
 
Methods inherited from class jumbo.euclid.Status
NYI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Complex

public Complex()

Complex

public Complex(double a)
real component only

Complex

public Complex(double a,
               double b)
from components

Complex

public Complex(Real2 a)
from base class

Complex

public Complex(double r,
               Angle th)
in polar coords

Complex

public Complex(Polar p)

Complex

public Complex(Complex a)
Method Detail

getReal

public double getReal()
gets real part

negative

public void negative()
unary minus MODIFIES object
Overrides:
negative in class Real2

multiply

public Complex multiply(Complex f)
multiply a complex by a complex

divideBy

public Complex divideBy(Complex f)
                 throws java.lang.ArithmeticException
divide a complex by a complex

getR

public double getR()
get as polar coords

getTheta

public Angle getTheta()

getPolar

public Polar getPolar()

sqrt

public static Complex sqrt(Complex a)
complex square root

toString

public java.lang.String toString()
Overrides:
toString in class Real2