Class ImmutableComplex
- All Implemented Interfaces:
Serializable
conj()
or add(Complex)
will also return an ImmutableComplex.- Since:
- Jep 4.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.standard.Complex
Complex.NonPropagatingImmutableComplex
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionacos()
Returns the arccos of this complex number.acosh()
Returns the inverse hyperbolic cosine of this complex number.Adds the complex number with another complex value.asin()
Returns the arcsin of this complex number.asinh()
Returns the inverse hyperbolic sine of this complex number.atan()
Returns the arc tangent of this complex number.atanh()
Returns the inverse hyperbolic tangent of this complex number.conj()
Returns the complex conjugate.cos()
Returns the cosine of this complex number.cosh()
Returns the hyperbolic cosine of this complex number.Returns the result of dividing this complex number by the parameter.fastPower
(int n) Calculate integer powers by repeated multiplications.log()
Returns the logarithm of this complex number.mul
(double b) Multiply the complex number with a double value.Multiply the complex number with another complex value.neg()
Returns the negative value of this complex number.static ImmutableComplex
polarValueOf
(Number r, Number theta) power
(double exponent) Returns this complex number raised to a double argument.power
(int n) Raise this complex to an integer power.Returns the value of this complex number raised to the power of a complex exponent If this is zero return this.powerD
(double exponent) Returns the value of this complex number raised to the power of a real component (in double precision).powerI
(int n) Raise a complex number to an integer power.Returns the reciprocal of a complex number 1/z.sin()
Returns the sine of this complex number.sinh()
Returns the hyperbolic sine of this complex number.sqrt()
Calculates the square root of this object.Subtracts a complex number from thistan()
Returns the tangent of this complex number.tanh()
Returns the hyperbolic tangent of this complex number.Methods inherited from class com.singularsys.jep.standard.Complex.NonPropagatingImmutableComplex
set, set, setIm, setRe
-
Field Details
-
U_ZERO
Unmodifiable constant 0+0 i -
U_ONE
Unmodifiable constant 1+0 i -
U_MINUS_ONE
Unmodifiable constant -1+0 i -
U_I
Unmodifiable constant 0+1 i -
U_MINUS_I
Unmodifiable constant 0-1 i
-
-
Constructor Details
-
ImmutableComplex
public ImmutableComplex() -
ImmutableComplex
-
ImmutableComplex
public ImmutableComplex(double x, double y) -
ImmutableComplex
public ImmutableComplex(double x) -
ImmutableComplex
-
-
Method Details
-
polarValueOf
-
neg
Description copied from class:Complex
Returns the negative value of this complex number. -
mul
Description copied from class:Complex
Multiply the complex number with a double value. -
add
Description copied from class:Complex
Adds the complex number with another complex value. -
sub
Description copied from class:Complex
Subtracts a complex number from this -
mul
Description copied from class:Complex
Multiply the complex number with another complex value. -
div
Description copied from class:Complex
Returns the result of dividing this complex number by the parameter. Algorithm adapted from Numerical Recipes in C - The Art of Scientific Computing ISBN 0-521-43108-5 -
reciprocal
Description copied from class:Complex
Returns the reciprocal of a complex number 1/z. This was broken in version < 4.0.- Overrides:
reciprocal
in classComplex
- Returns:
- 1/(this)
-
power
Description copied from class:Complex
Raise this complex to an integer power. For small power use theComplex.fastPower(int)
method which does not do repeated multiplication and is generally faster. For larger power useComplex.powerI(int)
which can be more accurate. -
powerI
Description copied from class:Complex
Raise a complex number to an integer power. Uses the polar form[r;th]^n -> [r^n;n th]
and the efficient power method fromPower.power(double, int)
Slower than -
fastPower
Description copied from class:Complex
Calculate integer powers by repeated multiplications. Soz^5 = z*(z*z)*(z*z)
. This routine is generally faster but can accumulate errors for large exponents. -
powerD
Description copied from class:Complex
Returns the value of this complex number raised to the power of a real component (in double precision).This method considers special cases where a simpler algorithm would return "ugly" results.
For example when the expression (-1e40)^0.5 is evaluated without considering the special case, the argument of the base is the double number closest to pi. When sin and cos are used for the final evaluation of the result, the slight difference of the argument from pi causes a non-zero value for the real component of the result. Because the value of the base is so high, the error is magnified. Although the error is normal for floating point calculations, the consideration of commonly occurring special cases improves the accuracy and aesthetics of the results.If you know a more elegant way to solve this problem, please let me know at [email protected] .
Testing with roots of unity show errors are typically within 128 * ulp, so |actual-result|/|actual| < 1e-13.
-
power
Description copied from class:Complex
Returns this complex number raised to a double argument. If the exponent is an integer returnsComplex.power(int)
otherwise callsComplex.powerD(double)
. -
power
Description copied from class:Complex
Returns the value of this complex number raised to the power of a complex exponent If this is zero return this. If the exponent has zero imaginary part use -
conj
Description copied from class:Complex
Returns the complex conjugate. -
log
Description copied from class:Complex
Returns the logarithm of this complex number. The real part is Math.log(this.abs()) and the complex part is this.arg(), in the range -pi .. pi. -
sqrt
Description copied from class:Complex
Calculates the square root of this object. Adapted from Numerical Recipes in C - The Art of Scientific Computing (ISBN 0-521-43108-5) -
sin
Description copied from class:Complex
Returns the sine of this complex number. -
cos
Description copied from class:Complex
Returns the cosine of this complex number. -
tan
Description copied from class:Complex
Returns the tangent of this complex number. -
asin
Description copied from class:Complex
Returns the arcsin of this complex number. -
acos
Description copied from class:Complex
Returns the arccos of this complex number. -
atan
Description copied from class:Complex
Returns the arc tangent of this complex number. -
sinh
Description copied from class:Complex
Returns the hyperbolic sine of this complex number. -
cosh
Description copied from class:Complex
Returns the hyperbolic cosine of this complex number. -
tanh
Description copied from class:Complex
Returns the hyperbolic tangent of this complex number. -
asinh
Description copied from class:Complex
Returns the inverse hyperbolic sine of this complex number. -
acosh
Description copied from class:Complex
Returns the inverse hyperbolic cosine of this complex number. -
atanh
Description copied from class:Complex
Returns the inverse hyperbolic tangent of this complex number.
-