JMSLTM Numerical Library 5.0.1

com.imsl.math
Class Complex

java.lang.Object
  extended by java.lang.Number
      extended by 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:
Example, Serialized Form

Field Summary
static Complex i
          The imaginary unit.
static String suffix
          String used in converting Complex to String.
 
Constructor Summary
Complex()
          Constructs a Complex equal to zero.
Complex(Complex z)
          Constructs a Complex equal to the argument.
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.
 
Method Summary
static double abs(Complex z)
          Returns the absolute value (modulus) of a Complex, |z|.
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.
static Complex acosh(Complex z)
          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(Complex x, Complex y)
          Returns the sum of two Complex objects, x+y.
static Complex add(Complex x, double y)
          Returns the sum of a Complex and a double, x+y.
static Complex add(double x, Complex y)
          Returns the sum of a double and a Complex, x+y.
static double argument(Complex z)
          Returns the argument (phase) of a Complex, in radians, with a branch cut along the negative real axis.
static Complex asin(Complex z)
          Returns the inverse sine (arc sine) of a Complex, with branch cuts outside the interval [-1,1] along the real axis.
static Complex asinh(Complex z)
          Returns the inverse hyperbolic sine (arc sinh) of a Complex, with branch cuts outside the interval [-i,i].
static Complex atan(Complex z)
          Returns the inverse tangent (arc tangent) of a Complex, with branch cuts outside the interval [-i,i] along the imaginary axis.
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.
 byte byteValue()
          Returns the value of the real part as a byte.
 int compareTo(Complex z)
          Compares two Complex objects.
 int compareTo(Object obj)
          Compares this Complex to another Object.
static Complex conjugate(Complex z)
          Returns the complex conjugate of a Complex object.
static Complex cos(Complex z)
          Returns the cosine of a Complex.
static Complex cosh(Complex z)
          Returns the hyperbolic cosh of a Complex.
static Complex divide(Complex x, Complex y)
          Returns the result of a Complex object 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 divide(double x, Complex y)
          Returns the result of a double divided by a Complex object, x/y.
 double doubleValue()
          Returns the value of the real part as a double.
 boolean equals(Complex z)
          Compares with another Complex.
 boolean equals(Object obj)
          Compares this object against the specified object.
static Complex exp(Complex z)
          Returns the exponential of a Complex z, exp(z).
 float floatValue()
          Returns the value of the real part as a float.
 int hashCode()
          Returns a hashcode for this Complex.
 double imag()
          Returns the imaginary part of a Complex object.
static double imag(Complex z)
          Returns the imaginary part of a Complex object.
 int intValue()
          Returns the value of the real part as an int.
static Complex log(Complex z)
          Returns the logarithm of a Complex z, with a branch cut along the negative real axis.
 long longValue()
          Returns the value of the real part as a long.
static Complex multiply(Complex x, Complex y)
          Returns the product of two Complex objects, x * y.
static Complex multiply(Complex x, double y)
          Returns the product of a Complex object and a double, x * y.
static Complex multiply(double x, Complex y)
          Returns the product of a double and a Complex object, x * y.
static Complex multiplyImag(Complex x, double y)
          Returns the product of a Complex object and a pure imaginary double, x * iy.
static Complex multiplyImag(double x, Complex y)
          Returns the product of a pure imaginary double and a Complex object, ix * y.
static Complex negate(Complex z)
          Returns the negative of a Complex object, -z.
static Complex pow(Complex x, Complex y)
          Returns the Complex x raised to the Complex y power.
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.
 double real()
          Returns the real part of a Complex object.
static double real(Complex z)
          Returns the real part of a Complex object.
 short shortValue()
          Returns the value of the real part as a short.
static Complex sin(Complex z)
          Returns the sine of a Complex.
static Complex sinh(Complex z)
          Returns the hyperbolic sine of a Complex.
static Complex sqrt(Complex z)
          Returns the square root of a Complex, with a branch cut along the negative real axis.
static Complex subtract(Complex x, Complex y)
          Returns the difference of two Complex objects, x-y.
static Complex subtract(Complex x, double y)
          Returns the difference of a Complex object and a double, x-y.
static Complex subtract(double x, Complex y)
          Returns the difference of a double and a Complex object, x-y.
static Complex tan(Complex z)
          Returns the tangent of a Complex.
static Complex tanh(Complex z)
          Returns the hyperbolic tanh of a Complex.
 String toString()
          Returns a String representation for the specified Complex.
static Complex valueOf(String s)
          Parses a String into a Complex.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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 Detail

Complex

public Complex()
Constructs a Complex equal to zero.


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)
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(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
Method Detail

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

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,
acos(bar{z}) = overline{acos(z)}.
acos(pm 0 + i0) returns pi/2 - i0.
acos(-infty + iinfty) returns 3 pi/4 - iinfty.
acos(+infty + iinfty) returns pi/4 - iinfty.
acos(x + iinfty ) returns pi/2 - iinfty, for finite x.
acos(-infty + iy) returns pi- iinfty, for positive-signed finite y.
acos(+infty + iy) returns +0 - iinfty, for positive-signed finite y.
acos(pm infty + iNaN) returns NaN pm  iinfty (where the sign of the imaginary part of the result is unspecified).
acos(pm 0 + iNaN) returns pi/2 + iNaN.
acos(NaN + iinfty) returns NaN - iinfty.
acos(x + iNaN) returns NaN + iNaN, for nonzero finite x.
acos(NaN + iy) returns NaN + iNaN, for finite y.
acos(NaN + iNaN) returns NaN + iNaN.

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].

acosh

public static Complex acosh(Complex z)
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,
acosh(bar{z}) = overline{acosh(z)}.
acosh(pm 0 + i0) returns +0 + ipi/2.
acosh(-infty + iinfty ) returns +infty + i3 pi/4.
acosh(+infty + iinfty ) returns +infty + i pi/4.
acosh(x + iinfty ) returns +infty + i pi/2, for finite x.
acosh(-infty + iy) returns +infty + i pi, for positive-signed finite y.
acosh(+infty + iy) returns +infty + i0, for positive-signed finite y.
acosh(NaN + iinfty ) returns +infty + iNaN.
acosh(pm infty + iNaN) returns +infty + iNaN.
acosh(x + iNaN) returns NaN + iNaN, for finite x.
acosh(NaN + iy) returns NaN + iNaN, for finite y.
acosh(NaN + iNaN) returns NaN + iNaN.

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 [-ipi,ipi].

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

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].

asin

public static Complex asin(Complex z)
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 asin(z) = -i asinh(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:
asinh(com.imsl.math.Complex)

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,
asinh(bar{z}) = overline{asinh(z)} and asinh is odd.
asinh(+0 + i0) returns 0 + i0.
asinh(infty + iinfty ) returns +infty + i pi/4.
asinh(x + iinfty ) returns +infty + i pi/2 for positive-signed finite x.
asinh(+infty + iy) returns +infty + i0 for positive-signed finite y.
asinh(NaN + iinfty ) returns pm infty + iNaN (where the sign of the real part of the result is unspecified).
asinh(+infty + iNaN) returns +infty + iNaN.
asinh(NaN + i0) returns NaN + i0.
asinh(NaN + iy) returns NaN + iNaN, for finite nonzero y.
asinh(x + iNaN) returns NaN + iNaN, for finite x.
asinh(NaN + iNaN) returns NaN + iNaN.

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 [-ipi/2,ipi/2].

atan

public static Complex atan(Complex z)
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 atan(z) = -i atanh(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:
atanh(com.imsl.math.Complex)

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,
atanh(bar{z}) = overline{atanh(z)} and atanh is odd.
atanh(+0 + i0) returns +0 + i0.
atanh(+infty + iinfty ) returns +0 + ipi/2.
atanh(+infty + iy) returns +0 + ipi/2, for finite positive-signed y.
atanh(x + iinfty ) returns +0 + ipi/2, for finite positive-signed x.
atanh(+0 + iNaN) returns +0 + iNaN.
atanh(NaN + iinfty ) returns pm 0 + i pi/2 (where the sign of the real part of the result is unspecified).
atanh(+infty + iNaN) returns +0 + iNaN.
atanh(NaN + iy) returns NaN + iNaN, for finite y.
atanh(x + iNaN) returns NaN + iNaN, for nonzero finite x.
atanh(NaN + iNaN) returns NaN + iNaN.

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 [-ipi/2,ipi/2].

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

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.

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

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

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:
cosh(com.imsl.math.Complex)

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 + iinfty ) returns NaN pm  i0 (where the sign of the imaginary part of the result is unspecified).
cosh(+infty + i0) returns +infty + i0.
cosh(+infty + iinfty ) returns +infty + iNaN.
cosh(x + iinfty ) returns NaN + iNaN, for finite nonzero x.
cosh(+infty + iy) returns +infty [cos(y)+isin(y)], for finite nonzero y.
cosh(+0 + iNaN) returns NaN pm  i0 (where the sign of the imaginary part of the result is unspecified).
cosh(+infty + iNaN) returns +infty + iNaN.
cosh(x + iNaN) returns NaN + iNaN, for finite nonzero x.
cosh(NaN + i0) returns NaN pm  i0 (where the sign of the imaginary part of the result is unspecified).
cosh(NaN + iy) returns NaN + iNaN, for all nonzero numbers y.
cosh(NaN + iNaN) returns NaN + iNaN.

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

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

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

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

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 + iinfty ) returns pm 0 pm  i0 (where the signs of the real and imaginary parts of the result are unspecified).
exp(+infty + iinfty ) returns pm infty + iNaN (where the sign of the real part of the result is unspecified).
exp(x + iinfty ) returns NaN + iNaN, for finite x.
exp(-infty + iy) returns +0 [cos(y)+isin(y)], for finite y.
exp(+infty + iy) returns +infty [cos(y)+isin(y)], for finite nonzero y.
exp(-infty + iNaN) returns pm 0 pm  i0 (where the signs of the real and imaginary parts of the result are unspecified).
exp(+infty + iNaN) returns pm infty + iNaN (where the sign of the real part of the result is unspecified).
exp(NaN + i0) returns NaN + i0.
exp(NaN + iy) returns NaN + iNaN, for all non-zero numbers y.
exp(x + iNaN) returns NaN + iNaN, for finite x.

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

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

hashCode

public int hashCode()
Returns a hashcode for this Complex.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object

imag

public double imag()
Returns the imaginary part of a Complex object.

Returns:
a double representing the imaginary part of a 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

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

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 + ipi.
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 + iNaN) returns + infty + iNaN.
log(NaN + i infty ) returns + infty + iNaN.
log(x + iNaN) returns NaN + iNaN, for finite x.
log(NaN + iy) returns NaN + iNaN, for finite y.
log(NaN + iNaN) returns NaN + iNaN.

Parameters:
z - a Complex object
Returns:
A newly constructed Complex initialized to the logarithm of the argument. Its imaginary part is in the interval [-ipi,ipi].

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

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.

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

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:
exp(com.imsl.math.Complex), log(com.imsl.math.Complex)

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

real

public double real()
Returns the real part of a Complex object.

Returns:
a double representing the real 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

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

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:
sinh(com.imsl.math.Complex)

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 + iinfty ) returns pm 0 + iNaN (where the sign of the real part of the result is unspecified).
sinh(+infty + i0) returns +infty + i0.
sinh(+infty + iinfty ) returns pm infty + iNaN (where the sign of the real part of the result is unspecified).
sinh(+infty + iy) returns +infty [cos(y)+isin(y)], for positive finite y.
sinh(x + iinfty ) returns NaN + iNaN, for positive finite x.
sinh(+0 + iNaN) returns pm 0 + iNaN (where the sign of the real part of the result is unspecified).
sinh(+infty + iNaN) returns pm infty + iNaN (where the sign of the real part of the result is unspecified).
sinh(x + iNaN) returns NaN + iNaN, for finite nonzero x.
sinh(NaN + i0) returns NaN + i0.
sinh(NaN + iy) returns NaN + iNaN, for all nonzero numbers y.
sinh(NaN + iNaN) returns NaN + iNaN.

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

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 + iinfty, for finite positive-signed y.
{rm sqrt}(+infty + iy) returns + infty + i0, for finite positive-signed y.
{rm sqrt}(x+iinfty) returns + infty + i infty, for all x (including NaN).
{rm sqrt}(-infty + i NaN) returns NaN pm  i infty (where the sign of the imaginary part of the result is unspecified).
{rm sqrt}(+infty + i NaN) returns +infty + i NaN.
{rm sqrt}(x + i NaN) returns NaN + i NaN and optionally raises the invalid exception, for finite x.
{rm sqrt}(NaN + iy) returns NaN + i NaN and optionally raises the invalid exception, for finite y.
{rm sqrt}(NaN + i NaN) returns NaN + i NaN.

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

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

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:
tanh(com.imsl.math.Complex)

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 + iinfty ) returns NaN + iNaN, for finite x.
tanh(+infty + iNaN) returns 1 pm  i0 (where the sign of the imaginary part of the result is unspecified).
tanh(NaN + i0) returns NaN + i0.
tanh(NaN + iy) returns NaN + iNaN, for all nonzero numbers y.
tanh(x + iNaN) returns NaN + iNaN, for finite x.
tanh(NaN + iNaN) returns NaN + iNaN.

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

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

JMSLTM Numerical Library 5.0.1

Copyright © 1970-2008 Visual Numerics, Inc.
Built July 8 2008.