Class Complex
- All Implemented Interfaces:
Serializable,Cloneable
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleReturns the absolute value (modulus) of aComplex, |z|.static ComplexReturns the inverse cosine (arc cosine) of aComplex, 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 aComplex, with a branch cut at values less than one along the real axis.static ComplexReturns the sum of adoubleand aComplex, x+y.static ComplexReturns the sum of aComplexand adouble, x+y.static ComplexReturns the sum of twoComplexobjects, x+y.static doubleReturns the argument (phase) of aComplex, in radians, with a branch cut along the negative real axis.static Complex\( \DeclareMathOperator{\arcsinh}{arcsinh} \) Returns the inverse sine (arc sine) of aComplex, with branch cuts outside the interval [-1,1] along the real axis.static ComplexReturns the inverse hyperbolic sine (arc sinh) of aComplex, with branch cuts outside the interval [-i,i].static Complex\( \DeclareMathOperator{\arctanh}{arctanh} \) Returns the inverse tangent (arc tangent) of aComplex, with branch cuts outside the interval [-i,i] along the imaginary axis.static ComplexReturns the inverse hyperbolic tangent (arc tanh) of aComplex, with branch cuts outside the interval [-1,1] on the real axis.byteReturns the value of the real part as a byte.intCompares twoComplexobjects.intCompares thisComplexto another Object.static ComplexReturns the complex conjugate of aComplexobject.static ComplexReturns the cosine of aComplex.static ComplexReturns the hyperbolic cosh of aComplex.static ComplexReturns the result of adoubledivided by aComplexobject, x/y.static ComplexReturns the result of aComplexobject divided by adouble, x/y.static ComplexReturns the result of aComplexobject divided by aComplexobject, x/y.doubleReturns the value of the real part as adouble.booleanCompares with anotherComplex.booleanCompares this object against the specified object.static ComplexReturns the exponential of aComplexz, exp(z).floatReturns the value of the real part as a float.inthashCode()Returns a hashcode for thisComplex.doubleimag()Returns the imaginary part of aComplexobject.static doubleReturns the imaginary part of aComplexobject.intintValue()Returns the value of the real part as an int.static ComplexReturns the logarithm of aComplexz, with a branch cut along the negative real axis.longReturns the value of the real part as a long.static ComplexReturns the product of adoubleand aComplexobject, x * y.static ComplexReturns the product of aComplexobject and adouble, x * y.static ComplexReturns the product of twoComplexobjects, x * y.static ComplexmultiplyImag(double x, Complex y) Returns the product of a pure imaginarydoubleand aComplexobject, ix * y.static ComplexmultiplyImag(Complex x, double y) Returns the product of aComplexobject and a pure imaginarydouble, x * iy.static ComplexReturns the negative of aComplexobject, -z.static ComplexReturns theComplexz raised to the x power, with a branch cut for the first parameter (z) along the negative real axis.static ComplexReturns theComplexx raised to theComplexy power.doublereal()Returns the real part of aComplexobject.static doubleReturns the real part of aComplexobject.shortReturns the value of the real part as a short.static ComplexReturns the sine of aComplex.static ComplexReturns the hyperbolic sine of aComplex.static ComplexReturns the square root of aComplex, with a branch cut along the negative real axis.static ComplexReturns the difference of adoubleand aComplexobject, x-y.static ComplexReturns the difference of aComplexobject and adouble, x-y.static ComplexReturns the difference of twoComplexobjects, x-y.static ComplexReturns the tangent of aComplex.static ComplexReturns the hyperbolic tanh of aComplex.toString()Returns aStringrepresentation for the specifiedComplex.static ComplexParses aStringinto aComplex.
-
Field Details
-
i
The imaginary unit. This constant is set to new Complex(0,1). -
suffix
String used in convertingComplextoString. Default is i, but sometimes j is desired. Note that this is set for the class, not for a particular instance of aComplex.
-
-
Constructor Details
-
Complex
Constructs aComplexequal to the argument.- Parameters:
z- aComplexobject- Throws:
NullPointerException- is thrown if z is null
-
Complex
public Complex(double re, double im) Constructs aComplexwith real and imaginary parts given by the input arguments.- Parameters:
re- adoublevalue equal to the real part of theComplexobjectim- adoublevalue equal to the imaginary part of theComplexobject
-
Complex
public Complex(double re) Constructs aComplexwith a zero imaginary part.- Parameters:
re- adoublevalue equal to the real part of theComplexobject
-
Complex
public Complex()Constructs aComplexequal to zero.
-
-
Method Details
-
equals
Compares with anotherComplex.Note: To be useful in hashtables this method considers two NaN
doublevalues to be equal. This is not according to IEEE specification.- Parameters:
z- aComplexobject- Returns:
- true if the real and imaginary parts of this object are equal to their counterparts in the argument; false, otherwise
-
equals
Compares this object against the specified object.Note: To be useful in hashtables this method considers two NaN
doublevalues to be equal. This is not according to IEEE specification -
hashCode
public int hashCode()Returns a hashcode for thisComplex. -
compareTo
Compares thisComplexto another Object. If the Object is aComplex, this function behaves like compareTo(Complex). Otherwise, it throws a ClassCastException (asComplexobjects are comparable only to otherComplexobjects).- Parameters:
obj- anObjectto be compared- Returns:
- an
int, 0 if obj is equal to thisComplex; a value less than 0 if thisComplexis less than obj; and a value greater than 0 if thisComplexis greater than obj. - Throws:
ClassCastException- is thrown if obj is not aComplexobject
-
compareTo
Compares twoComplexobjects.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- aComplexto be compared- Returns:
- The value 0 if z is equal to this
Complex; a value less than 0 if thisComplexis less than z; and a value greater than 0 if thisComplexis greater than z.
-
byteValue
public byte byteValue()Returns the value of the real part as a byte. -
doubleValue
public double doubleValue()Returns the value of the real part as adouble.- Specified by:
doubleValuein classNumber- Returns:
- a
doublerepresenting the value of the real part of aComplexobject
-
floatValue
public float floatValue()Returns the value of the real part as a float.- Specified by:
floatValuein classNumber- Returns:
- a float representing the value of the real part of a
Complexobject
-
intValue
public int intValue()Returns the value of the real part as an int. -
longValue
public long longValue()Returns the value of the real part as a long. -
shortValue
public short shortValue()Returns the value of the real part as a short.- Overrides:
shortValuein classNumber- Returns:
- a short representing the value of the real part of a
Complexobject
-
real
public double real()Returns the real part of aComplexobject.- Returns:
- a
doublerepresenting the real part of aComplexobject, z
-
imag
public double imag()Returns the imaginary part of aComplexobject.- Returns:
- a
doublerepresenting the imaginary part of aComplexobject, z
-
real
Returns the real part of aComplexobject.- Parameters:
z- aComplexobject- Returns:
- a
doublerepresenting the real part of theComplexobject, z
-
imag
Returns the imaginary part of aComplexobject.- Parameters:
z- aComplexobject- Returns:
- a
doublerepresenting the imaginary part of theComplexobject, z
-
negate
Returns the negative of aComplexobject, -z.- Parameters:
z- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the negative of theComplexargument, z
-
conjugate
Returns the complex conjugate of aComplexobject.- Parameters:
z- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the complex conjugate ofComplexargument, z
-
add
Returns the sum of twoComplexobjects, x+y.- Parameters:
x- aComplexobjecty- aComplexobject- Returns:
- a newly constructed
Complexinitialized to x+y
-
add
Returns the sum of aComplexand adouble, x+y.- Parameters:
x- aComplexobjecty- adoublevalue- Returns:
- a newly constructed
Complexinitialized to x+y
-
add
Returns the sum of adoubleand aComplex, x+y.- Parameters:
x- adoublevaluey- aComplexobject- Returns:
- a newly constructed
Complexinitialized to x+y
-
subtract
Returns the difference of twoComplexobjects, x-y.- Parameters:
x- aComplexobjecty- aComplexobject- Returns:
- a newly constructed
Complexinitialized to x-y
-
subtract
Returns the difference of aComplexobject and adouble, x-y.- Parameters:
x- aComplexobjecty- adoublevalue- Returns:
- a newly constructed
Complexinitialized to x-y
-
subtract
Returns the difference of adoubleand aComplexobject, x-y.- Parameters:
x- adoublevaluey- aComplexobject- Returns:
- a newly constructed
Complexinitialized to x-y
-
multiply
Returns the product of twoComplexobjects, x * y.- Parameters:
x- aComplexobjecty- aComplexobject- Returns:
- a newly constructed
Complexinitialized to \(x \times y\)
-
multiply
Returns the product of aComplexobject and adouble, x * y.- Parameters:
x- aComplexobjecty- adoublevalue- Returns:
- a newly constructed
Complexinitialized to \(x \times y\)
-
multiply
Returns the product of adoubleand aComplexobject, x * y.- Parameters:
x- adoublevaluey- aComplexobject- Returns:
- a newly constructed
Complexinitialized to \(x \times y\)
-
multiplyImag
Returns the product of aComplexobject and a pure imaginarydouble, x * iy.- Parameters:
x- aComplexobjecty- adoublevalue representing a pure imaginary- Returns:
- a newly constructed
Complexinitialized to x * iy
-
multiplyImag
Returns the product of a pure imaginarydoubleand aComplexobject, ix * y.- Parameters:
x- adoublevalue representing a pure imaginaryy- aComplexobject- Returns:
- a newly constructed
Complexinitialized to \(ix \times y\).
-
divide
Returns the result of aComplexobject divided by aComplexobject, x/y.- Parameters:
x- aComplexobject representing the numeratory- aComplexobject representing the denominator- Returns:
- a newly constructed
Complexinitialized to x/y
-
divide
Returns the result of aComplexobject divided by adouble, x/y.- Parameters:
x- aComplexobject representing the numeratory- adoublerepresenting the denominator- Returns:
- a newly constructed
Complexinitialized to x/y
-
divide
Returns the result of adoubledivided by aComplexobject, x/y.- Parameters:
x- adoublevaluey- aComplexobject representing the denominator- Returns:
- a newly constructed
Complexinitialized to x/y
-
abs
Returns the absolute value (modulus) of aComplex, |z|.- Parameters:
z- aComplexobject- Returns:
- a
doublevalue equal to the absolute value of the argument
-
argument
Returns the argument (phase) of aComplex, in radians, with a branch cut along the negative real axis.- Parameters:
z- aComplexobject- Returns:
- A
doublevalue equal to the argument (or phase) of aComplex. It is in the interval \([-\pi,\pi]\).
-
sqrt
Returns the square root of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized to square root of z.
-
exp
Returns the exponential of aComplexz, 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- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the exponential of the argument
-
log
Returns the logarithm of aComplexz, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized to the logarithm of the argument. Its imaginary part is in the interval \([-i\pi,i\pi]\).
-
sin
Returns the sine of aComplex. The value of sin is defined in terms of the function sinh, by \(\sin(z) = -i \sinh(iz)\).- Parameters:
z- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the sine of the argument - See Also:
-
cos
Returns the cosine of aComplex. The value of cos is defined in terms of the function cosh, by \(\cos(z) = \cosh(iz)\).- Parameters:
z- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the cosine of the argument - See Also:
-
tan
Returns the tangent of aComplex. The value of tan is defined in terms of the function tanh, by \(\tan(z) = -i \tanh(iz)\).- Parameters:
z- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the tangent of the argument - See Also:
-
asin
\( \DeclareMathOperator{\arcsinh}{arcsinh} \) Returns the inverse sine (arc sine) of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized 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
Returns the inverse cosine (arc cosine) of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized to the inverse (arc) cosine of the argument. The real part of the result is in the interval \([0,\pi]\).
-
atan
\( \DeclareMathOperator{\arctanh}{arctanh} \) Returns the inverse tangent (arc tangent) of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized to the inverse (arc) tangent of the argument. Its real part is in the interval \([-\pi/2,\pi/2]\). - See Also:
-
sinh
Returns the hyperbolic sine of aComplex.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- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the hyperbolic sine of the argument
-
cosh
Returns the hyperbolic cosh of aComplex.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- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the hyperbolic cosine of the argument
-
tanh
Returns the hyperbolic tanh of aComplex.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- aComplexobject- Returns:
- a newly constructed
Complexinitialized to the hyperbolic tangent of the argument
-
asinh
Returns the inverse hyperbolic sine (arc sinh) of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized to the inverse (arc) hyperbolic sine of the argument. Its imaginary part is in the interval \([-i\pi/2,i\pi/2]\).
-
acosh
\( \DeclareMathOperator{\arccosh}{arccosh} \) Returns the inverse hyperbolic cosine (arc cosh) of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized 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
Returns the inverse hyperbolic tangent (arc tanh) of aComplex, 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- aComplexobject- Returns:
- A newly constructed
Complexinitialized 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
Returns theComplexz raised to the x power, with a branch cut for the first parameter (z) along the negative real axis.- Parameters:
z- aComplexobjectx- adoublevalue- Returns:
- a newly constructed
Complexinitialized to z to the power x
-
pow
Returns theComplexx raised to theComplexy 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- aComplexobjecty- aComplexobject- Returns:
- a newly constructed
Complexinitialized to \(x^y\). - See Also:
-
toString
Returns aStringrepresentation for the specifiedComplex. -
valueOf
Parses aStringinto aComplex.- Parameters:
s- theStringto be parsed- Returns:
- a newly constructed
Complexinitialized to the value represented by theStringargument - Throws:
NumberFormatException- if the string does not contain a parsableComplexnumberNullPointerException- if the input argument is null
-