|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectComplex
An implementation of complex numbers as pairs of
doubles.
| Field Summary | |
static Complex |
I
The constant i. |
static Complex |
NEG_I
The constant -i. |
static Complex |
NEG_ONE
The constant -1. |
static Complex |
ONE
The constant 1. |
static Complex |
ZERO
The constant 0. |
| Constructor Summary | |
Complex(double re)
|
|
Complex(double re,
double im)
|
|
Complex(int re)
|
|
| Method Summary | |
Complex |
add(Complex w)
|
Complex |
add(double real)
|
Complex |
add(int real)
|
double |
arg()
Returns the arg, in the range -pi to pi. |
Complex |
conjugate()
|
static Complex |
getRootOf1(int j,
int n)
Returns the jth power of the primitive nth root of unity e^(2 pi i / n). |
double |
Im()
|
static void |
main(String[] args)
For testing. |
Complex |
mult(Complex w)
|
Complex |
mult(double real)
|
Complex |
mult(int real)
|
Complex |
multByConj(Complex w)
Returns this times the conjugate of
w. |
double |
norm()
|
String |
printAsGaussianInteger()
Rounds the real and imaginary parts to the nearest integer ( long), then prints as if by toString(). |
double |
Re()
|
long |
roundToLong()
Returns the real part rounded to the nearest integer. |
Complex |
subtract(Complex w)
|
Complex |
subtract(double real)
|
Complex |
subtract(int real)
|
String |
toString()
|
| Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Complex ZERO
public static final Complex ONE
public static final Complex I
public static final Complex NEG_ONE
public static final Complex NEG_I
| Constructor Detail |
public Complex(double re,
double im)
public Complex(double re)
public Complex(int re)
| Method Detail |
public final double Re()
public final double Im()
public Complex add(Complex w)
public Complex add(double real)
public Complex add(int real)
public Complex subtract(Complex w)
public Complex subtract(double real)
public Complex subtract(int real)
public Complex mult(Complex w)
public Complex mult(double real)
public Complex mult(int real)
public Complex multByConj(Complex w)
this times the conjugate of
w.
public Complex conjugate()
public static Complex getRootOf1(int j,
int n)
IllegalArgumentException - If n is less than or
equal to 0.public double norm()
public double arg()
ArithmeticException - if this = 0.public long roundToLong()
public String toString()
public String printAsGaussianInteger()
long), then prints as if by toString().
public static void main(String[] args)
double arguments.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||