public class Complex extends Object
Modifier and Type | Field and Description |
---|---|
double |
imag
The imaginary part of this value
|
double |
real
The real part of this value
|
Constructor and Description |
---|
Complex(Complex c)
Creates a copy of a complex object
|
Complex(double real,
double imag)
Creates a complex number
|
Modifier and Type | Method and Description |
---|---|
void |
add(Complex c)
Add a complex value
|
void |
div(Complex c)
Div this value by a complex value
|
double |
getImaginaryPart()
Gets the imaginary part of this value
|
double |
getRealPart()
Gets the real part of this complex value
|
void |
mul(Complex c)
Multiply this value with a complex value
|
void |
setImaginaryPart(double imag)
Sets the imaginary part of this value
|
void |
setRealPart(double real)
Sets the real part of this complex value
|
void |
sub(Complex c)
Subtracs a complex value
|
String |
toString()
Create a string of the content of this class
|
public double real
public double imag
public Complex(double real, double imag)
real
- the real partimag
- the imaginary partpublic Complex(Complex c)
public void setRealPart(double real)
public double getRealPart()
public void setImaginaryPart(double imag)
public double getImaginaryPart()
public void add(Complex c)
public void sub(Complex c)
public void mul(Complex c)
public void div(Complex c)