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.SerializableComplex 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 doubleabs()Returns abs/modulus/magnitude.Complexconjugate()Returns the conjugate.Complexcos()Returns the complex cosine.Complexdiv(Complex b)Returns a / b.booleanequals(java.lang.Object o)Complexexp()Returns the complex exponential.inthashCode()doubleim()Returns the imaginary part.Complexminus(Complex b)Returns this - b.doublephase()Returns angle/phase/argument between -pi and pi.Complexplus(Complex b)Returns this + b.doublere()Returns the real part.Complexreciprocal()Returns the reciprocal.Complexsin()Returns the complex sine.Complextan()Returns the complex tangent.Complextimes(double b)Scalar multiplication.* Returns this * b.Complextimes(Complex b)Returns this * b.java.lang.StringtoString()
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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.
-
-