Class Complex
java.lang.Object
talonsoalbi_at_gmail_dot_com.ssoxmatch.ephem.moons.Complex
- All Implemented Interfaces:
Serializable
A support class for complex numbers, used in class Mars07
- Author:
- talonso
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Complex
public Complex(double r, double i) Explicit constructor.- Parameters:
r- Real.i- Imaginary.
-
-
Method Details
-
getReal
public double getReal()Real part- Returns:
- the real
-
getImaginary
public double getImaginary()Imaginary part- Returns:
- the imaginary
-
add
Add operation.- Parameters:
a- A complex number.- Returns:
- The sum of both.
-
multiply
Multiplies a complex by a scalar.- Parameters:
x- A number.- Returns:
- this*x.
-
exponential
Returns the exponential function of certain Complex.- Returns:
- Exp(this) as a new Complex.
-
toString
Converts a Complex into a String of the form ( a + bi).
This enables the Complex to be easily printed. For example, if z was 2 - 5i, thenSystem.out.println("z = " + z);would printz = (2 - 5i)
-