Package smile.math

Class 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 Detail

      • Complex

        public Complex​(double real,
                       double imag)
        Constructor.
        Parameters:
        real - real part
        imag - imaginary part
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.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.