|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object number.Complex
public final class Complex
This class stores a complex number, and allows the user to do arithmetic with these numbers. Note that our complex numbers are immutable. That is, once they are constructed, they will not change. In particular, all our algebraic operations create a new complex number rather than updating the current one.
Constructor Summary | |
---|---|
Complex(double real_part)
Construct a real number. |
|
Complex(double real_part,
double imaginary_part)
Construct a point from real and imaginary parts. |
Method Summary | |
---|---|
double |
abs()
Return the absolute value. |
double |
absSquared()
Return the square of the absolute value. |
Complex |
add(Complex z)
Add a complex number to this one. |
Complex |
conj()
Return the complex conjugate |
Complex |
div(Complex z)
Compute the quotient of two complex numbers. |
Complex |
div(double q)
Divide this complex number by a real number. |
boolean |
equals(Object obj)
Return true if the object is a complex number which is equal to this complex number. |
Complex |
exp()
Return the complex exponential of this complex number. |
int |
hashCode()
|
double |
im()
Return the imaginary part. |
Complex |
inv()
Return the multiplicative inverse. |
Complex |
minus(Complex z)
Subtract a complex number from this one. |
Complex |
mult(Complex z)
Compute the product of two complex numbers |
Complex |
neg()
Negate this complex number. |
double |
re()
Return the real part. |
String |
toString()
Returns this point as a string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Complex(double real_part, double imaginary_part)
public Complex(double real_part)
Method Detail |
---|
public double re()
public double im()
public Complex conj()
public double absSquared()
public double abs()
public Complex add(Complex z)
z
- The complex number to be added.
public Complex minus(Complex z)
z
- The complex number to be subtracted.
public Complex neg()
public Complex mult(Complex z)
z
- The complex number to be multiplied.
public Complex div(double q)
q
- The number to divide by.
public Complex inv()
public Complex div(Complex z)
z
- The complex number to divide this one by.
public Complex exp()
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |