Package smile.math
Class Complex
- java.lang.Object
-
- smile.math.Complex
-
- All Implemented Interfaces:
java.io.Serializable
public class Complex extends java.lang.Object implements java.io.Serializable
Complex number. The object is immutable so once you create and initialize a Complex object, you cannot modify it.- Author:
- Haifeng Li
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Complex(double real, double imag)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
abs()
Returns abs/modulus/magnitude.Complex
conjugate()
Returns the conjugate.Complex
cos()
Returns the complex cosine.Complex
div(Complex b)
Returns a / b.boolean
equals(java.lang.Object o)
Complex
exp()
Returns the complex exponential.int
hashCode()
double
im()
Returns the imaginary part.Complex
minus(Complex b)
Returns this - b.double
phase()
Returns angle/phase/argument between -pi and pi.Complex
plus(Complex b)
Returns this + b.double
re()
Returns the real part.Complex
reciprocal()
Returns the reciprocal.Complex
sin()
Returns the complex sine.Complex
tan()
Returns the complex tangent.Complex
times(double b)
Scalar multiplication.* Returns this * b.Complex
times(Complex b)
Returns this * b.java.lang.String
toString()
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
abs
public double abs()
Returns abs/modulus/magnitude.
-
phase
public double phase()
Returns angle/phase/argument between -pi and pi.
-
times
public Complex times(double b)
Scalar multiplication.* Returns this * b.
-
conjugate
public Complex conjugate()
Returns the conjugate.
-
reciprocal
public Complex reciprocal()
Returns the reciprocal.
-
re
public double re()
Returns the real part.
-
im
public double im()
Returns the imaginary part.
-
exp
public Complex exp()
Returns the complex exponential.
-
sin
public Complex sin()
Returns the complex sine.
-
cos
public Complex cos()
Returns the complex cosine.
-
tan
public Complex tan()
Returns the complex tangent.
-
-