org.jscience.mathematics.analysis.polynomials
Class ComplexPolynomial

java.lang.Object
  extended by org.jscience.mathematics.analysis.ComplexFunction
      extended by org.jscience.mathematics.analysis.polynomials.ComplexPolynomial
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Field.Member, Ring.Member, AbelianGroup.Member, AbstractMapping, C1Function, ComplexMapping, NumberMapping, Polynomial, Member

public class ComplexPolynomial
extends ComplexFunction
implements Polynomial, java.io.Serializable, java.lang.Cloneable

A Polynomial over the complex field. For a description of the methods

See Also:
DoublePolynomial, Serialized Form

Constructor Summary
ComplexPolynomial(Complex[] coeff)
          Creates a new instance of ComplexPolynomial, polynom is always simplified discarding every trailing zeros and array copied (but not contents of elements).
ComplexPolynomial(ComplexPolynomial polynomial)
          Creates a new instance of ComplexPolynomial, polynom is always simplified discarding every trailing zeros.
ComplexPolynomial(Field.Member[] f)
          Creates a new ComplexPolynomial object, polynom is always simplified discarding every trailing zeros and array copied (but not contents of elements).
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member g)
          The group composition law.
 java.lang.Object clone()
          DOCUMENT ME!
static Complex[] cubic(Complex d, Complex c, Complex b, Complex a)
          DOCUMENT ME!
static Complex[] cubic(double d, double c, double b, double a)
          DOCUMENT ME!
 int degree()
          DOCUMENT ME!
 ComplexFunction differentiate()
          Differentiate the complex polynomial.
 boolean equals(java.lang.Object o)
          DOCUMENT ME!
 Field.Member getCoefficient(int n)
          DOCUMENT ME!
 Complex getCoefficientAsComplex(int n)
          DOCUMENT ME!
 Field.Member[] getCoefficients()
          Get the coefficients as an array
 Complex[] getCoefficientsAsComplexes()
          Return the coefficients as an array of ExactComplex numbers.
 java.lang.Object getSet()
          DOCUMENT ME!
 int hashCode()
           
 ComplexPolynomial integrate()
          "inverse" operation for differentiate, zero degree constant set to zero
 boolean isOne()
          DOCUMENT ME!
 boolean isZero()
          DOCUMENT ME!
 Complex map(Complex z)
          Evaluates this polynomial.
 Complex map(double x, double y)
          Evaluates this polynomial.
 Ring.Member multiply(Ring.Member r)
          The multiplication law.
 AbelianGroup.Member negate()
          Returns the inverse member.
static Complex[] quadratic(Complex c, Complex b, Complex a)
          DOCUMENT ME!
static Complex[] quadratic(double c, double b, double a)
          DOCUMENT ME!
 Complex[] roots()
          DOCUMENT ME!
static ComplexPolynomial rootsToPolynomial(Complex[] roots)
          DOCUMENT ME!
 ComplexPolynomial scalarDivide(Complex a)
          Returns the division of this polynomial by a scalar.
 ComplexPolynomial scalarDivide(double a)
          Returns the division of this polynomial by a scalar.
 Polynomial scalarDivide(Field.Member f)
          Returns the division of this polynomial by a scalar.
 ComplexPolynomial scalarMultiply(Complex a)
          Returns the multiplication of this polynomial by a scalar.
 ComplexPolynomial scalarMultiply(double a)
          Returns the multiplication of this polynomial by a scalar.
 Polynomial scalarMultiply(Field.Member f)
          Returns the multiplication of this polynomial by a scalar.
 void setCoefficient(int n, Field.Member c)
          DOCUMENT ME!
 void setCoefficientAsComplex(int n, Complex c)
          DOCUMENT ME!
 AbelianGroup.Member subtract(AbelianGroup.Member g)
          The group composition law with inverse.
 ExactComplexPolynomial toExactComplexPolynomial()
          DOCUMENT ME!
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String unknown)
          String representation P(x) = a_k x^k +...
 
Methods inherited from class org.jscience.mathematics.analysis.ComplexFunction
add, compose, cos, divide, divide, exp, getIntervalsLists, inverse, log, map, multiply, power, setIntervalsLists, sin, sqrt, subtract, taylorExpand
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComplexPolynomial

public ComplexPolynomial(Complex[] coeff)
Creates a new instance of ComplexPolynomial, polynom is always simplified discarding every trailing zeros and array copied (but not contents of elements).


ComplexPolynomial

public ComplexPolynomial(ComplexPolynomial polynomial)
Creates a new instance of ComplexPolynomial, polynom is always simplified discarding every trailing zeros.

Parameters:
polynomial - DOCUMENT ME!

ComplexPolynomial

public ComplexPolynomial(Field.Member[] f)
Creates a new ComplexPolynomial object, polynom is always simplified discarding every trailing zeros and array copied (but not contents of elements).

Parameters:
f -
Method Detail

getCoefficient

public Field.Member getCoefficient(int n)
DOCUMENT ME!

Specified by:
getCoefficient in interface Polynomial
Parameters:
n -
Returns:
DOCUMENT ME!

getCoefficientAsComplex

public Complex getCoefficientAsComplex(int n)
DOCUMENT ME!

Parameters:
n -
Returns:
DOCUMENT ME!

getCoefficients

public Field.Member[] getCoefficients()
Description copied from interface: Polynomial
Get the coefficients as an array

Specified by:
getCoefficients in interface Polynomial
Returns:
DOCUMENT ME!

getCoefficientsAsComplexes

public Complex[] getCoefficientsAsComplexes()
Return the coefficients as an array of ExactComplex numbers.

Returns:
DOCUMENT ME!

setCoefficient

public void setCoefficient(int n,
                           Field.Member c)
DOCUMENT ME!

Parameters:
n -
c - DOCUMENT ME!

setCoefficientAsComplex

public void setCoefficientAsComplex(int n,
                                    Complex c)
DOCUMENT ME!

Parameters:
n -
c - DOCUMENT ME!

map

public Complex map(Complex z)
Evaluates this polynomial.

Specified by:
map in interface ComplexMapping
Specified by:
map in class ComplexFunction
Parameters:
z - DOCUMENT ME!
Returns:
DOCUMENT ME!
See Also:
org.jscience.mathematics.analysis.Domain.

map

public Complex map(double x,
                   double y)
Evaluates this polynomial.

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
Returns:
DOCUMENT ME!

degree

public int degree()
DOCUMENT ME!

Specified by:
degree in interface Polynomial
Returns:
the degree

getSet

public java.lang.Object getSet()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isZero

public boolean isZero()
DOCUMENT ME!

Returns:
true if this is equal to zero.

isOne

public boolean isOne()
DOCUMENT ME!

Returns:
true if this is equal to one.

add

public AbelianGroup.Member add(AbelianGroup.Member g)
The group composition law.

Specified by:
add in interface AbelianGroup.Member
Overrides:
add in class ComplexFunction
Parameters:
g - a group member
Returns:
DOCUMENT ME!

differentiate

public ComplexFunction differentiate()
Differentiate the complex polynomial. Only useful iff the polynomial is built over a banach space and an appropriate multiplication law is provided.

Specified by:
differentiate in interface C1Function
Specified by:
differentiate in class ComplexFunction
Returns:
a new polynomial with degree = max(this.degree-1 , 0)

scalarDivide

public Polynomial scalarDivide(Field.Member f)
Returns the division of this polynomial by a scalar.

Specified by:
scalarDivide in interface Polynomial
Parameters:
f -
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

scalarDivide

public ComplexPolynomial scalarDivide(Complex a)
Returns the division of this polynomial by a scalar.

Parameters:
a -
Returns:
DOCUMENT ME!

scalarDivide

public ComplexPolynomial scalarDivide(double a)
Returns the division of this polynomial by a scalar.

Parameters:
a -
Returns:
DOCUMENT ME!

equals

public boolean equals(java.lang.Object o)
DOCUMENT ME!

Overrides:
equals in class java.lang.Object
Parameters:
o -
Returns:
DOCUMENT ME!

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
DOCUMENT ME!

integrate

public ComplexPolynomial integrate()
"inverse" operation for differentiate, zero degree constant set to zero

Returns:
the integrated polynomial

scalarMultiply

public Polynomial scalarMultiply(Field.Member f)
Returns the multiplication of this polynomial by a scalar.

Specified by:
scalarMultiply in interface Polynomial
Parameters:
f -
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!

scalarMultiply

public ComplexPolynomial scalarMultiply(double a)
Returns the multiplication of this polynomial by a scalar.

Parameters:
a -
Returns:
DOCUMENT ME!

scalarMultiply

public ComplexPolynomial scalarMultiply(Complex a)
Returns the multiplication of this polynomial by a scalar.

Parameters:
a -
Returns:
DOCUMENT ME!

multiply

public Ring.Member multiply(Ring.Member r)
The multiplication law.

Specified by:
multiply in interface Ring.Member
Overrides:
multiply in class ComplexFunction
Parameters:
r - a ring member
Returns:
DOCUMENT ME!

negate

public AbelianGroup.Member negate()
Returns the inverse member.

Specified by:
negate in interface AbelianGroup.Member
Overrides:
negate in class ComplexFunction
Returns:
DOCUMENT ME!

subtract

public AbelianGroup.Member subtract(AbelianGroup.Member g)
The group composition law with inverse.

Specified by:
subtract in interface AbelianGroup.Member
Overrides:
subtract in class ComplexFunction
Parameters:
g - a group member
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
DOCUMENT ME!

toString

public java.lang.String toString(java.lang.String unknown)
String representation P(x) = a_k x^k +...

Parameters:
unknown - The name of the unkwown
Returns:
String

toExactComplexPolynomial

public ExactComplexPolynomial toExactComplexPolynomial()
DOCUMENT ME!

Returns:
DOCUMENT ME!

clone

public java.lang.Object clone()
DOCUMENT ME!

Overrides:
clone in class java.lang.Object
Returns:
DOCUMENT ME!

rootsToPolynomial

public static ComplexPolynomial rootsToPolynomial(Complex[] roots)
DOCUMENT ME!

Parameters:
roots - DOCUMENT ME!
Returns:
DOCUMENT ME!

roots

public Complex[] roots()
DOCUMENT ME!

Returns:
DOCUMENT ME!

quadratic

public static Complex[] quadratic(Complex c,
                                  Complex b,
                                  Complex a)
DOCUMENT ME!

Parameters:
c - DOCUMENT ME!
b - DOCUMENT ME!
a - DOCUMENT ME!
Returns:
DOCUMENT ME!

quadratic

public static Complex[] quadratic(double c,
                                  double b,
                                  double a)
DOCUMENT ME!

Parameters:
c - DOCUMENT ME!
b - DOCUMENT ME!
a - DOCUMENT ME!
Returns:
DOCUMENT ME!

cubic

public static Complex[] cubic(Complex d,
                              Complex c,
                              Complex b,
                              Complex a)
DOCUMENT ME!

Parameters:
d - DOCUMENT ME!
c - DOCUMENT ME!
b - DOCUMENT ME!
a - DOCUMENT ME!
Returns:
DOCUMENT ME!

cubic

public static Complex[] cubic(double d,
                              double c,
                              double b,
                              double a)
DOCUMENT ME!

Parameters:
d - DOCUMENT ME!
c - DOCUMENT ME!
b - DOCUMENT ME!
a - DOCUMENT ME!
Returns:
DOCUMENT ME!