Package com.imsl.math

Class Complex

java.lang.Object
java.lang.Number
com.imsl.math.Complex
All Implemented Interfaces:
Serializable, Cloneable

public class Complex extends Number implements Serializable, Cloneable
Set of mathematical functions for complex numbers. It provides the basic operations (addition, subtraction, multiplication, division) as well as a set of complex functions. The binary operations have the form, where op is add, subtract, multiply or divide.
        public static Complex op(Complex x, Complex y)   // x op y
        public static Complex op(Complex x, double y)    // x op y
        public static Complex op(double x, Complex y)    // x op y
 
Complex objects are immutable. Once created there is no way to change their value. The functions in this class follow the rules for complex arithmetic as defined C9x Annex G: IEC 559-compatible complex arithmetic. The API is not the same, but handling of infinities, NaNs, and positive and negative zeros is intended to follow the same rules.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Complex
    The imaginary unit.
    static String
    String used in converting Complex to String.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a Complex equal to zero.
    Complex(double re)
    Constructs a Complex with a zero imaginary part.
    Complex(double re, double im)
    Constructs a Complex with real and imaginary parts given by the input arguments.
    Constructs a Complex equal to the argument.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    Returns the absolute value (modulus) of a Complex, |z|.
    static Complex
    Returns the inverse cosine (arc cosine) of a Complex, with branch cuts outside the interval [-1,1] along the real axis.
    static Complex
    \( \DeclareMathOperator{\arccosh}{arccosh} \) Returns the inverse hyperbolic cosine (arc cosh) of a Complex, with a branch cut at values less than one along the real axis.
    static Complex
    add(double x, Complex y)
    Returns the sum of a double and a Complex, x+y.
    static Complex
    add(Complex x, double y)
    Returns the sum of a Complex and a double, x+y.
    static Complex
    Returns the sum of two Complex objects, x+y.
    static double
    Returns the argument (phase) of a Complex, in radians, with a branch cut along the negative real axis.
    static Complex
    \( \DeclareMathOperator{\arcsinh}{arcsinh} \) Returns the inverse sine (arc sine) of a Complex, with branch cuts outside the interval [-1,1] along the real axis.
    static Complex
    Returns the inverse hyperbolic sine (arc sinh) of a Complex, with branch cuts outside the interval [-i,i].
    static Complex
    \( \DeclareMathOperator{\arctanh}{arctanh} \) Returns the inverse tangent (arc tangent) of a Complex, with branch cuts outside the interval [-i,i] along the imaginary axis.
    static Complex
    Returns the inverse hyperbolic tangent (arc tanh) of a Complex, with branch cuts outside the interval [-1,1] on the real axis.
    byte
    Returns the value of the real part as a byte.
    int
    Compares two Complex objects.
    int
    Compares this Complex to another Object.
    static Complex
    Returns the complex conjugate of a Complex object.
    static Complex
    Returns the cosine of a Complex.
    static Complex
    Returns the hyperbolic cosh of a Complex.
    static Complex
    divide(double x, Complex y)
    Returns the result of a double divided by a Complex object, x/y.
    static Complex
    divide(Complex x, double y)
    Returns the result of a Complex object divided by a double, x/y.
    static Complex
    Returns the result of a Complex object divided by a Complex object, x/y.
    double
    Returns the value of the real part as a double.
    boolean
    Compares with another Complex.
    boolean
    Compares this object against the specified object.
    static Complex
    Returns the exponential of a Complex z, exp(z).
    float
    Returns the value of the real part as a float.
    int
    Returns a hashcode for this Complex.
    double
    Returns the imaginary part of a Complex object.
    static double
    Returns the imaginary part of a Complex object.
    int
    Returns the value of the real part as an int.
    static Complex
    Returns the logarithm of a Complex z, with a branch cut along the negative real axis.
    long
    Returns the value of the real part as a long.
    static Complex
    multiply(double x, Complex y)
    Returns the product of a double and a Complex object, x * y.
    static Complex
    multiply(Complex x, double y)
    Returns the product of a Complex object and a double, x * y.
    static Complex
    Returns the product of two Complex objects, x * y.
    static Complex
    multiplyImag(double x, Complex y)
    Returns the product of a pure imaginary double and a Complex object, ix * y.
    static Complex
    multiplyImag(Complex x, double y)
    Returns the product of a Complex object and a pure imaginary double, x * iy.
    static Complex
    Returns the negative of a Complex object, -z.
    static Complex
    pow(Complex z, double x)
    Returns the Complex z raised to the x power, with a branch cut for the first parameter (z) along the negative real axis.
    static Complex
    Returns the Complex x raised to the Complex y power.
    double
    Returns the real part of a Complex object.
    static double
    Returns the real part of a Complex object.
    short
    Returns the value of the real part as a short.
    static Complex
    Returns the sine of a Complex.
    static Complex
    Returns the hyperbolic sine of a Complex.
    static Complex
    Returns the square root of a Complex, with a branch cut along the negative real axis.
    static Complex
    subtract(double x, Complex y)
    Returns the difference of a double and a Complex object, x-y.
    static Complex
    subtract(Complex x, double y)
    Returns the difference of a Complex object and a double, x-y.
    static Complex
    Returns the difference of two Complex objects, x-y.
    static Complex
    Returns the tangent of a Complex.
    static Complex
    Returns the hyperbolic tanh of a Complex.
    Returns a String representation for the specified Complex.
    static Complex
    Parses a String into a Complex.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • i

      public static final Complex i
      The imaginary unit. This constant is set to new Complex(0,1).
    • suffix

      public static String suffix
      String used in converting Complex to String. Default is i, but sometimes j is desired. Note that this is set for the class, not for a particular instance of a Complex.
  • Constructor Details

    • Complex

      public Complex(Complex z)
      Constructs a Complex equal to the argument.
      Parameters:
      z - a Complex object
      Throws:
      NullPointerException - is thrown if z is null
    • Complex

      public Complex(double re, double im)
      Constructs a Complex with real and imaginary parts given by the input arguments.
      Parameters:
      re - a double value equal to the real part of the Complex object
      im - a double value equal to the imaginary part of the Complex object
    • Complex

      public Complex(double re)
      Constructs a Complex with a zero imaginary part.
      Parameters:
      re - a double value equal to the real part of the Complex object
    • Complex

      public Complex()
      Constructs a Complex equal to zero.
  • Method Details

    • equals

      public boolean equals(Complex z)
      Compares with another Complex.

      Note: To be useful in hashtables this method considers two NaN double values to be equal. This is not according to IEEE specification.

      Parameters:
      z - a Complex object
      Returns:
      true if the real and imaginary parts of this object are equal to their counterparts in the argument; false, otherwise
    • equals

      public boolean equals(Object obj)
      Compares this object against the specified object.

      Note: To be useful in hashtables this method considers two NaN double values to be equal. This is not according to IEEE specification

      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare with
      Returns:
      true if the objects are the same; false otherwise
    • hashCode

      public int hashCode()
      Returns a hashcode for this Complex.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object
    • compareTo

      public int compareTo(Object obj)
      Compares this Complex to another Object. If the Object is a Complex, this function behaves like compareTo(Complex). Otherwise, it throws a ClassCastException (as Complex objects are comparable only to other Complex objects).
      Parameters:
      obj - an Object to be compared
      Returns:
      an int, 0 if obj is equal to this Complex; a value less than 0 if this Complex is less than obj; and a value greater than 0 if this Complex is greater than obj.
      Throws:
      ClassCastException - is thrown if obj is not a Complex object
    • compareTo

      public int compareTo(Complex z)
      Compares two Complex objects.

      A lexagraphical ordering is used. First the real parts are compared in the sense of Double.compareTo. If the real parts are unequal this is the return value. If the return parts are equal then the comparison of the imaginary parts is returned.

      Parameters:
      z - a Complex to be compared
      Returns:
      The value 0 if z is equal to this Complex; a value less than 0 if this Complex is less than z; and a value greater than 0 if this Complex is greater than z.
    • byteValue

      public byte byteValue()
      Returns the value of the real part as a byte.
      Overrides:
      byteValue in class Number
      Returns:
      a byte representing the value of the real part of a Complex object
    • doubleValue

      public double doubleValue()
      Returns the value of the real part as a double.
      Specified by:
      doubleValue in class Number
      Returns:
      a double representing the value of the real part of a Complex object
    • floatValue

      public float floatValue()
      Returns the value of the real part as a float.
      Specified by:
      floatValue in class Number
      Returns:
      a float representing the value of the real part of a Complex object
    • intValue

      public int intValue()
      Returns the value of the real part as an int.
      Specified by:
      intValue in class Number
      Returns:
      an int representing the value of the real part of a Complex object
    • longValue

      public long longValue()
      Returns the value of the real part as a long.
      Specified by:
      longValue in class Number
      Returns:
      a long representing the value of the real part of a Complex object
    • shortValue

      public short shortValue()
      Returns the value of the real part as a short.
      Overrides:
      shortValue in class Number
      Returns:
      a short representing the value of the real part of a Complex object
    • real

      public double real()
      Returns the real part of a Complex object.
      Returns:
      a double representing the real part of a Complex object, z
    • imag

      public double imag()
      Returns the imaginary part of a Complex object.
      Returns:
      a double representing the imaginary part of a Complex object, z
    • real

      public static double real(Complex z)
      Returns the real part of a Complex object.
      Parameters:
      z - a Complex object
      Returns:
      a double representing the real part of the Complex object, z
    • imag

      public static double imag(Complex z)
      Returns the imaginary part of a Complex object.
      Parameters:
      z - a Complex object
      Returns:
      a double representing the imaginary part of the Complex object, z
    • negate

      public static Complex negate(Complex z)
      Returns the negative of a Complex object, -z.
      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the negative of the Complex argument, z
    • conjugate

      public static Complex conjugate(Complex z)
      Returns the complex conjugate of a Complex object.
      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the complex conjugate of Complex argument, z
    • add

      public static Complex add(Complex x, Complex y)
      Returns the sum of two Complex objects, x+y.
      Parameters:
      x - a Complex object
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to x+y
    • add

      public static Complex add(Complex x, double y)
      Returns the sum of a Complex and a double, x+y.
      Parameters:
      x - a Complex object
      y - a double value
      Returns:
      a newly constructed Complex initialized to x+y
    • add

      public static Complex add(double x, Complex y)
      Returns the sum of a double and a Complex, x+y.
      Parameters:
      x - a double value
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to x+y
    • subtract

      public static Complex subtract(Complex x, Complex y)
      Returns the difference of two Complex objects, x-y.
      Parameters:
      x - a Complex object
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to x-y
    • subtract

      public static Complex subtract(Complex x, double y)
      Returns the difference of a Complex object and a double, x-y.
      Parameters:
      x - a Complex object
      y - a double value
      Returns:
      a newly constructed Complex initialized to x-y
    • subtract

      public static Complex subtract(double x, Complex y)
      Returns the difference of a double and a Complex object, x-y.
      Parameters:
      x - a double value
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to x-y
    • multiply

      public static Complex multiply(Complex x, Complex y)
      Returns the product of two Complex objects, x * y.
      Parameters:
      x - a Complex object
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to \(x \times y\)
    • multiply

      public static Complex multiply(Complex x, double y)
      Returns the product of a Complex object and a double, x * y.
      Parameters:
      x - a Complex object
      y - a double value
      Returns:
      a newly constructed Complex initialized to \(x \times y\)
    • multiply

      public static Complex multiply(double x, Complex y)
      Returns the product of a double and a Complex object, x * y.
      Parameters:
      x - a double value
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to \(x \times y\)
    • multiplyImag

      public static Complex multiplyImag(Complex x, double y)
      Returns the product of a Complex object and a pure imaginary double, x * iy.
      Parameters:
      x - a Complex object
      y - a double value representing a pure imaginary
      Returns:
      a newly constructed Complex initialized to x * iy
    • multiplyImag

      public static Complex multiplyImag(double x, Complex y)
      Returns the product of a pure imaginary double and a Complex object, ix * y.
      Parameters:
      x - a double value representing a pure imaginary
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to \(ix \times y\).
    • divide

      public static Complex divide(Complex x, Complex y)
      Returns the result of a Complex object divided by a Complex object, x/y.
      Parameters:
      x - a Complex object representing the numerator
      y - a Complex object representing the denominator
      Returns:
      a newly constructed Complex initialized to x/y
    • divide

      public static Complex divide(Complex x, double y)
      Returns the result of a Complex object divided by a double, x/y.
      Parameters:
      x - a Complex object representing the numerator
      y - a double representing the denominator
      Returns:
      a newly constructed Complex initialized to x/y
    • divide

      public static Complex divide(double x, Complex y)
      Returns the result of a double divided by a Complex object, x/y.
      Parameters:
      x - a double value
      y - a Complex object representing the denominator
      Returns:
      a newly constructed Complex initialized to x/y
    • abs

      public static double abs(Complex z)
      Returns the absolute value (modulus) of a Complex, |z|.
      Parameters:
      z - a Complex object
      Returns:
      a double value equal to the absolute value of the argument
    • argument

      public static double argument(Complex z)
      Returns the argument (phase) of a Complex, in radians, with a branch cut along the negative real axis.
      Parameters:
      z - a Complex object
      Returns:
      A double value equal to the argument (or phase) of a Complex. It is in the interval \([-\pi,\pi]\).
    • sqrt

      public static Complex sqrt(Complex z)
      Returns the square root of a Complex, with a branch cut along the negative real axis.

      Specifically, if z = x+iy,
      \({\rm sqrt}(\bar{z}) = \overline{{\rm sqrt}(z)}\).
      \({\rm sqrt}(\pm 0 + i0)\) returns \(+0 + i0\).
      \({\rm sqrt}(-\infty + iy)\) returns \(+0 + i\infty\), for finite positive-signed y.
      \({\rm sqrt}(+\infty + iy)\) returns \(+ \infty + i0\), for finite positive-signed y.
      \({\rm sqrt}(x+i\infty)\) returns \(+ \infty + i \infty\), for all x (including NaN).
      \({\rm sqrt}(-\infty + i \mathrm{NaN})\) returns \(\mathrm{NaN} \pm i \infty\) (where the sign of the imaginary part of the result is unspecified).
      \({\rm sqrt}(+\infty + i \mathrm{NaN})\) returns \(+\infty + i \mathrm{NaN}\).
      \({\rm sqrt}(x + i \mathrm{NaN})\) returns \(\mathrm{NaN} + i \mathrm{NaN}\) and optionally raises the invalid exception, for finite x.
      \({\rm sqrt}(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i \mathrm{NaN}\) and optionally raises the invalid exception, for finite y.
      \({\rm sqrt}(\mathrm{NaN} + i \mathrm{NaN})\) returns \(\mathrm{NaN} + i \mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to square root of z.
    • exp

      public static Complex exp(Complex z)
      Returns the exponential of a Complex z, exp(z).

      Specifically, if z = x+iy,
      \(\exp(\bar{z}) = \overline{\exp(z)}\).
      \(\exp(\pm 0 + i0)\) returns \(1 + i0\).
      \(\exp(+\infty + i0)\) returns \(+\infty + i0\).
      \(\exp(-\infty + i\infty )\) returns \(\pm 0 \pm i0\) (where the signs of the real and imaginary parts of the result are unspecified).
      \(\exp(+\infty + i\infty )\) returns \(\pm \infty + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\exp(x + i\infty )\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.
      \(\exp(-\infty + iy)\) returns \(+0 [\cos(y)+i\sin(y)]\), for finite y.
      \(\exp(+\infty + iy)\) returns \(+\infty [\cos(y)+i\sin(y)]\), for finite nonzero y.
      \(\exp(-\infty + i\mathrm{NaN})\) returns \(\pm 0 \pm i0\) (where the signs of the real and imaginary parts of the result are unspecified).
      \(\exp(+\infty + i\mathrm{NaN})\) returns \(\pm \infty + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\exp(\mathrm{NaN} + i0)\) returns \(\mathrm{NaN} + i0\).
      \(\exp(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for all non-zero numbers y.
      \(\exp(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.

      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the exponential of the argument
    • log

      public static Complex log(Complex z)
      Returns the logarithm of a Complex z, with a branch cut along the negative real axis.

      Specifically, if z = x+iy,
      \(\log(\bar{z}) = \overline{\log(z)}\).
      \(\log(0 + i0)\) returns \(- \infty + i\pi\).
      \(\log(+0 + i0)\) returns \(- \infty + i0\).
      \(\log(-\infty + i \infty )\) returns \(+ \infty + i3 \pi/4\).
      \(\log(+\infty + i \infty )\) returns \(+ \infty + i \pi/4\).
      \(\log(x + i \infty )\) returns \(+ \infty + i \pi/2\), for finite x.
      \(\log(-\infty + iy)\) returns \(+ \infty + i \pi\), for finite positive-signed y.
      \(\log(+\infty + iy)\) returns \(+ \infty + i0\), for finite positive-signed y.
      \(\log(\pm \infty + i\mathrm{NaN})\) returns \(+ \infty + i\mathrm{NaN}\).
      \(\log(\mathrm{NaN} + i \infty )\) returns \(+ \infty + i\mathrm{NaN}\).
      \(\log(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.
      \(\log(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite y.
      \(\log(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the logarithm of the argument. Its imaginary part is in the interval \([-i\pi,i\pi]\).
    • sin

      public static Complex sin(Complex z)
      Returns the sine of a Complex. The value of sin is defined in terms of the function sinh, by \(\sin(z) = -i \sinh(iz)\).
      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the sine of the argument
      See Also:
    • cos

      public static Complex cos(Complex z)
      Returns the cosine of a Complex. The value of cos is defined in terms of the function cosh, by \(\cos(z) = \cosh(iz)\).
      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the cosine of the argument
      See Also:
    • tan

      public static Complex tan(Complex z)
      Returns the tangent of a Complex. The value of tan is defined in terms of the function tanh, by \(\tan(z) = -i \tanh(iz)\).
      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the tangent of the argument
      See Also:
    • asin

      public static Complex asin(Complex z)
      \( \DeclareMathOperator{\arcsinh}{arcsinh} \) Returns the inverse sine (arc sine) of a Complex, with branch cuts outside the interval [-1,1] along the real axis. The value of asin is defined in terms of the function asinh, by \(\arcsin(z) = -i \arcsinh(iz)\).
      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the inverse (arc) sine of the argument. The real part of the result is in the interval \([-\pi/2,+\pi/2]\).
      See Also:
    • acos

      public static Complex acos(Complex z)
      Returns the inverse cosine (arc cosine) of a Complex, with branch cuts outside the interval [-1,1] along the real axis.

      Specifically, if z = x+iy,
      \(\arccos(\bar{z}) = \overline{\arccos(z)}\).
      \(\arccos(\pm 0 + i0)\) returns \(\pi/2 - i0\).
      \(\arccos(-\infty + i\infty)\) returns \(3 \pi/4 - i\infty\).
      \(\arccos(+\infty + i\infty)\) returns \(\pi/4 - i\infty\).
      \(\arccos(x + i\infty )\) returns \(\pi/2 - i\infty\), for finite x.
      \(\arccos(-\infty + iy)\) returns \(\pi- i\infty\), for positive-signed finite y.
      \(\arccos(+\infty + iy)\) returns \(+0 - i\infty\), for positive-signed finite y.
      \(\arccos(\pm \infty + i\mathrm{NaN})\) returns \(\mathrm{NaN} \pm i\infty\) (where the sign of the imaginary part of the result is unspecified).
      \(\arccos(\pm 0 + i\mathrm{NaN})\) returns \(\pi/2 + i\mathrm{NaN}\).
      \(\arccos(\mathrm{NaN} + i\infty)\) returns \(\mathrm{NaN} - i\infty\).
      \(\arccos(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for nonzero finite x.
      \(\arccos(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite y.
      \(\arccos(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the inverse (arc) cosine of the argument. The real part of the result is in the interval \([0,\pi]\).
    • atan

      public static Complex atan(Complex z)
      \( \DeclareMathOperator{\arctanh}{arctanh} \) Returns the inverse tangent (arc tangent) of a Complex, with branch cuts outside the interval [-i,i] along the imaginary axis. The value of atan is defined in terms of the function atanh, by \(\arctan(z) = -i \arctanh(iz)\).
      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the inverse (arc) tangent of the argument. Its real part is in the interval \([-\pi/2,\pi/2]\).
      See Also:
    • sinh

      public static Complex sinh(Complex z)
      Returns the hyperbolic sine of a Complex.

      If z = x+iy,
      \(\sinh(\bar{z}) = \overline{\sinh(z)}\) and sinh is odd.
      \(\sinh(+0 + i0)\) returns \(+0 + i0\).
      \(\sinh(+0 + i\infty )\) returns \(\pm 0 + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\sinh(+\infty + i0)\) returns \(+\infty + i0\).
      \(\sinh(+\infty + i\infty )\) returns \(\pm \infty + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\sinh(+\infty + iy)\) returns \(+\infty [\cos(y)+i\sin(y)]\), for positive finite y.
      \(\sinh(x + i\infty )\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for positive finite x.
      \(\sinh(+0 + i\mathrm{NaN})\) returns \(\pm 0 + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\sinh(+\infty + i\mathrm{NaN})\) returns \(\pm \infty + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\sinh(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite nonzero x.
      \(\sinh(\mathrm{NaN} + i0)\) returns \(\mathrm{NaN} + i0\).
      \(\sinh(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for all nonzero numbers y.
      \(\sinh(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the hyperbolic sine of the argument
    • cosh

      public static Complex cosh(Complex z)
      Returns the hyperbolic cosh of a Complex.

      If z = x+iy,
      \(\cosh(\bar{z}) = \overline{\cosh(z)}\) and cosh is even.
      \(\cosh(+0 + i0)\) returns \(1 + i0\).
      \(\cosh(+0 + i\infty )\) returns \(\mathrm{NaN} \pm i0\) (where the sign of the imaginary part of the result is unspecified).
      \(\cosh(+\infty + i0)\) returns \(+\infty + i0\).
      \(\cosh(+\infty + i\infty )\) returns \(+\infty + i\mathrm{NaN}\).
      \(\cosh(x + i\infty )\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite nonzero x.
      \(\cosh(+\infty + iy)\) returns \(+\infty [\cos(y)+i\sin(y)]\), for finite nonzero y.
      \(\cosh(+0 + i\mathrm{NaN})\) returns \(\mathrm{NaN} \pm i0\) (where the sign of the imaginary part of the result is unspecified).
      \(\cosh(+\infty + i\mathrm{NaN})\) returns \(+\infty + i\mathrm{NaN}\).
      \(\cosh(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite nonzero x.
      \(\cosh(\mathrm{NaN} + i0)\) returns \(\mathrm{NaN} \pm i0\) (where the sign of the imaginary part of the result is unspecified).
      \(\cosh(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for all nonzero numbers y.
      \(\cosh(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the hyperbolic cosine of the argument
    • tanh

      public static Complex tanh(Complex z)
      Returns the hyperbolic tanh of a Complex.

      If z = x+iy,
      \(\tanh(\bar{z}) = \overline{\tanh(z)}\) and tanh is odd.
      \(\tanh(+0 + i0)\) returns \(+0 + i0\).
      \(\tanh(+\infty + iy)\) returns \(1 + i0\), for all positive-signed numbers y.
      \(\tanh(x + i\infty )\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.
      \(\tanh(+\infty + i\mathrm{NaN})\) returns \(1 \pm i0\) (where the sign of the imaginary part of the result is unspecified).
      \(\tanh(\mathrm{NaN} + i0)\) returns \(\mathrm{NaN} + i0\).
      \(\tanh(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for all nonzero numbers y.
      \(\tanh(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.
      \(\tanh(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      a newly constructed Complex initialized to the hyperbolic tangent of the argument
    • asinh

      public static Complex asinh(Complex z)
      Returns the inverse hyperbolic sine (arc sinh) of a Complex, with branch cuts outside the interval [-i,i].

      Specifically, if z = x+iy,
      \(\arcsinh(\bar{z}) = \overline{\arcsinh(z)}\) and asinh is odd.
      \(\arcsinh(+0 + i0)\) returns \(0 + i0\).
      \(\arcsinh(\infty + i\infty )\) returns \(+\infty + i \pi/4\).
      \(\arcsinh(x + i\infty )\) returns \(+\infty + i \pi/2\) for positive-signed finite x.
      \(\arcsinh(+\infty + iy)\) returns \(+\infty + i0\) for positive-signed finite y.
      \(\arcsinh(\mathrm{NaN} + i\infty )\) returns \(\pm \infty + i\mathrm{NaN}\) (where the sign of the real part of the result is unspecified).
      \(\arcsinh(+\infty + i\mathrm{NaN})\) returns \(+\infty + i\mathrm{NaN}\).
      \(\arcsinh(\mathrm{NaN} + i0)\) returns \(\mathrm{NaN} + i0\).
      \(\arcsinh(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite nonzero y.
      \(\arcsinh(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.
      \(\arcsinh(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the inverse (arc) hyperbolic sine of the argument. Its imaginary part is in the interval \([-i\pi/2,i\pi/2]\).
    • acosh

      public static Complex acosh(Complex z)
      \( \DeclareMathOperator{\arccosh}{arccosh} \) Returns the inverse hyperbolic cosine (arc cosh) of a Complex, with a branch cut at values less than one along the real axis.

      Specifically, if z = x+iy,
      \(\arccosh(\bar{z}) = \overline{\arccosh(z)}\).
      \(\arccosh(\pm 0 + i0)\) returns \(+0 + i\pi/2\).
      \(\arccosh(-\infty + i\infty )\) returns \(+\infty + i3 \pi/4\).
      \(\arccosh(+\infty + i\infty )\) returns \(+\infty + i \pi/4\).
      \(\arccosh(x + i\infty )\) returns \(+\infty + i \pi/2\), for finite x.
      \(\arccosh(-\infty + iy)\) returns \(+\infty + i \pi\), for positive-signed finite y.
      \(\arccosh(+\infty + iy)\) returns \(+\infty + i0\), for positive-signed finite y.
      \(\arccosh(\mathrm{NaN} + i\infty )\) returns \(+\infty + i\mathrm{NaN}\).
      \(\arccosh(\pm \infty + i\mathrm{NaN})\) returns \(+\infty + i\mathrm{NaN}\).
      \(\arccosh(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite x.
      \(\arccosh(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite y.
      \(\arccosh(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the inverse (arc) hyperbolic cosine of the argument. The real part of the result is non-negative and its imaginary part is in the interval \([-i\pi,i\pi]\).
    • atanh

      public static Complex atanh(Complex z)
      Returns the inverse hyperbolic tangent (arc tanh) of a Complex, with branch cuts outside the interval [-1,1] on the real axis.

      Specifically, if z = x+iy,
      \(\arctanh(\bar{z}) = \overline{\arctanh(z)}\) and atanh is odd.
      \(\arctanh(+0 + i0)\) returns \(+0 + i0\).
      \(\arctanh(+\infty + i\infty )\) returns \(+0 + i\pi/2\).
      \(\arctanh(+\infty + iy)\) returns \(+0 + i\pi/2\), for finite positive-signed y.
      \(\arctanh(x + i\infty )\) returns \(+0 + i\pi/2\), for finite positive-signed x.
      \(\arctanh(+0 + i\mathrm{NaN})\) returns \(+0 + i\mathrm{NaN}\).
      \(\arctanh(\mathrm{NaN} + i\infty )\) returns \(\pm 0 + i pi/2\) (where the sign of the real part of the result is unspecified).
      \(\arctanh(+\infty + i\mathrm{NaN})\) returns \(+0 + i\mathrm{NaN}\).
      \(\arctanh(\mathrm{NaN} + iy)\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for finite y.
      \(\arctanh(x + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\), for nonzero finite x.
      \(\arctanh(\mathrm{NaN} + i\mathrm{NaN})\) returns \(\mathrm{NaN} + i\mathrm{NaN}\).

      Parameters:
      z - a Complex object
      Returns:
      A newly constructed Complex initialized to the inverse (arc) hyperbolic tangent of the argument. The imaginary part of the result is in the interval \([-i\pi/2,i\pi/2]\).
    • pow

      public static Complex pow(Complex z, double x)
      Returns the Complex z raised to the x power, with a branch cut for the first parameter (z) along the negative real axis.
      Parameters:
      z - a Complex object
      x - a double value
      Returns:
      a newly constructed Complex initialized to z to the power x
    • pow

      public static Complex pow(Complex x, Complex y)
      Returns the Complex x raised to the Complex y power. The value of pow is defined in terms of the functions exp and log, by \({\rm pow}(x,y) = \exp(y \log(x))\).
      Parameters:
      x - a Complex object
      y - a Complex object
      Returns:
      a newly constructed Complex initialized to \(x^y\).
      See Also:
    • toString

      public String toString()
      Returns a String representation for the specified Complex.
      Overrides:
      toString in class Object
      Returns:
      a String representation for this object
    • valueOf

      public static Complex valueOf(String s) throws NumberFormatException
      Parses a String into a Complex.
      Parameters:
      s - the String to be parsed
      Returns:
      a newly constructed Complex initialized to the value represented by the String argument
      Throws:
      NumberFormatException - if the string does not contain a parsable Complex number
      NullPointerException - if the input argument is null