Package org.apache.commons.math.complex
Class ComplexUtils
java.lang.Object
org.apache.commons.math.complex.ComplexUtils
Static implementations of common
Complex
utilities functions.- Version:
- $Revision: 990655 $ $Date: 2010-08-29 23:49:40 +0200 (dim. 29 août 2010) $
-
Method Summary
Modifier and TypeMethodDescriptionstatic Complex
polar2Complex
(double r, double theta) Creates a complex number from the given polar representation.
-
Method Details
-
polar2Complex
Creates a complex number from the given polar representation.The value returned is
r·ei·theta
, computed asr·cos(theta) + r·sin(theta)i
If either
r
ortheta
is NaN, ortheta
is infinite,Complex.NaN
is returned.If
r
is infinite andtheta
is finite, infinite or NaN values may be returned in parts of the result, following the rules for double arithmetic.Examples:
polar2Complex(INFINITY, π/4) = INFINITY + INFINITY i polar2Complex(INFINITY, 0) = INFINITY + NaN i polar2Complex(INFINITY, -π/4) = INFINITY - INFINITY i polar2Complex(INFINITY, 5π/4) = -INFINITY - INFINITY i
- Parameters:
r
- the modulus of the complex number to createtheta
- the argument of the complex number to create- Returns:
r·ei·theta
- Throws:
IllegalArgumentException
- if r is negative- Since:
- 1.1
-