Modifier and Type | Field and Description |
---|---|
double |
im
The imaginary part
|
double |
re
The real part
|
Constructor and Description |
---|
Complex()
Create a complex number with real and imaginary parts set to 0.
|
Complex(double re,
double im)
Create a complex number with the specified real and
imaginary values.
|
Modifier and Type | Method and Description |
---|---|
double |
getIM()
Return the imaginary part.
|
double |
getMagnitude()
Return the magnitude of this complex number.
|
double |
getRE()
Return the real part.
|
void |
setIM(double im)
Set the imaginary part.
|
void |
setRE(double re)
Set the real part.
|
String |
toString()
Text representation of this complex number.
|
public Complex()
public Complex(double re, double im)
re
- the real partim
- the imaginary partpublic void setRE(double re)
re
- the real partpublic void setIM(double im)
im
- the imaginary part;public double getRE()
public double getIM()
public double getMagnitude()