Top Description Constructors Methods
org.apache.commons.math3.complex

public Class ComplexUtils

extends Object
Class Inheritance
Imports
org.apache.commons.math3.exception.MathIllegalArgumentException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.FastMath

Static implementations of common org.apache.commons.math3.complex.Complex utilities functions.

Constructor Summary

AccessConstructor and Description
private
ComplexUtils()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public static Complex[]

Returns:

an array of Complex objects.
convertToComplex
(double[]
Array of numbers to be converted to their Complex equivalent.
real
)

Convert an array of primitive doubles to an array of Complex objects.

public static Complex

Returns:

r·ei·theta
polar2Complex
(double
the modulus of the complex number to create
r
,
double
the argument of the complex number to create
theta
)

Creates a complex number from the given polar representation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ComplexUtilsback to summary
private ComplexUtils()

Default constructor.

Method Detail

convertToComplexback to summary
public static Complex[] convertToComplex(double[] real)

Convert an array of primitive doubles to an array of Complex objects.

Parameters
real:double[]

Array of numbers to be converted to their Complex equivalent.

Returns:Complex[]

an array of Complex objects.

Since
3.1
polar2Complexback to summary
public static Complex polar2Complex(double r, double theta) throws MathIllegalArgumentException

Creates a complex number from the given polar representation.

The value returned is r·ei·theta, computed as r·cos(theta) + r·sin(theta)i

If either r or theta is NaN, or theta is infinite, Complex#NaN is returned.

If r is infinite and theta 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:double

the modulus of the complex number to create

theta:double

the argument of the complex number to create

Returns:Complex

r·ei·theta

Exceptions
MathIllegalArgumentException:
if r is negative.
Since
1.1