JSci.maths.polynomials
Class RealPolynomial

java.lang.Object
  extended by JSci.maths.polynomials.RealPolynomial
All Implemented Interfaces:
java.io.Serializable, Ring.Member, AbelianGroup.Member, Member, Polynomial

public class RealPolynomial
extends java.lang.Object
implements Polynomial

A Polynomial as a Ring.Member over a real Field

Author:
b.dietrich
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface JSci.maths.polynomials.Polynomial
POLYEPS
 
Constructor Summary
RealPolynomial(double[] coeff)
          Creates a new instance of RealPolynomial
RealPolynomial(Field.Member[] f)
          Creates a new RealPolynomial object.
 
Method Summary
 AbelianGroup.Member add(AbelianGroup.Member g)
          The group composition law.
 int degree()
          The degree
 RealPolynomial differentiate()
          Differentiate the real polynomial.
 RealPolynomial divide(double a)
          return a new real Polynomial with coefficients divided by a
 Polynomial divide(Field.Member f)
          return a new real Polynomial with coefficients divided by f
 boolean equals(java.lang.Object o)
          Is this-o == Null ?
 Field.Member getCoefficient(int n)
          Get the coefficient of degree k, i.e.
 double getCoefficientAsDouble(int n)
          Get the coefficient of degree k, i.e.
 Field.Member[] getCoefficients()
          Get the coefficients as an array
 double[] getCoefficientsAsDoubles()
          Get the coefficients as an array of doubles
 int hashCode()
          Some kind of hashcode...
 RealPolynomial integrate()
          "inverse" operation for differentiate
 boolean isNull()
          Does this polynomial represent a "NULL".
 boolean isOne()
          Does this polynomial represent a "ONE".
 RealPolynomial multiply(double a)
          Returns the multiplication of this polynomial by a scalar
 Polynomial multiply(Field.Member f)
          Returns the multiplication of this polynomial by a scalar
 Ring.Member multiply(Ring.Member r)
          The multiplication law.
 AbelianGroup.Member negate()
          Returns the inverse member.
 AbelianGroup.Member subtract(AbelianGroup.Member g)
          The group composition law with inverse.
 java.lang.String toString()
          String representation P(x) = a_k x^k +...
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RealPolynomial

public RealPolynomial(double[] coeff)
Creates a new instance of RealPolynomial


RealPolynomial

public RealPolynomial(Field.Member[] f)
Creates a new RealPolynomial object.

Parameters:
f -
Method Detail

getCoefficient

public Field.Member getCoefficient(int n)
Get the coefficient of degree k, i.e. a_k if P(x) := sum_{k=0}^n a_k x^k

Specified by:
getCoefficient in interface Polynomial
Parameters:
k - degree
Returns:
coefficient as described above

getCoefficientAsDouble

public double getCoefficientAsDouble(int n)
Get the coefficient of degree k, i.e. a_k if P(x) := sum_{k=0}^n a_k x^k as a real number

Parameters:
k - degree
Returns:
coefficient as described above

getCoefficients

public Field.Member[] getCoefficients()
Get the coefficients as an array

Specified by:
getCoefficients in interface Polynomial
Returns:
the coefficients as an array

getCoefficientsAsDoubles

public double[] getCoefficientsAsDoubles()
Get the coefficients as an array of doubles

Returns:
the coefficients as an array

degree

public int degree()
The degree

Specified by:
degree in interface Polynomial
Returns:
the degree

isNull

public boolean isNull()
Does this polynomial represent a "NULL". This does not coincide with grade==0. All Coefficients are tested for |a_k| < POLYEPS

Returns:
true if all coefficients < POLYEPS

isOne

public boolean isOne()
Does this polynomial represent a "ONE". This does not necessarily mean grade==1. It is tested, whether |a_0 -1. | <=POLYEPS and the remaining coefficients are |a_k| < POLYEPS

Returns:
true if so

add

public AbelianGroup.Member add(AbelianGroup.Member g)
The group composition law. Returns a new polynom with grade = max( this.grade, g.grade)

Specified by:
add in interface AbelianGroup.Member
Parameters:
g - a group member

differentiate

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

Returns:
a new polynomial with degree = max(this.degree-1 , 1)

divide

public Polynomial divide(Field.Member f)
return a new real Polynomial with coefficients divided by f

Specified by:
divide in interface Polynomial
Parameters:
f - divisor
Returns:
new Polynomial with coefficients /= f

divide

public RealPolynomial divide(double a)
return a new real Polynomial with coefficients divided by a

Parameters:
a - divisor
Returns:
new Polynomial with coefficients /= a

equals

public boolean equals(java.lang.Object o)
Is this-o == Null ?

Overrides:
equals in class java.lang.Object
Parameters:
o - the other polynomial
Returns:
true if so

hashCode

public int hashCode()
Some kind of hashcode... (Since I have an equals)

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode

integrate

public RealPolynomial integrate()
"inverse" operation for differentiate

Returns:
the integrated polynomial

multiply

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

Specified by:
multiply in interface Polynomial
Parameters:
f -
Returns:
new Polynomial with coefficients *= a

multiply

public RealPolynomial multiply(double a)
Returns the multiplication of this polynomial by a scalar

Parameters:
a - factor
Returns:
new Polynomial with coefficients *= a

multiply

public Ring.Member multiply(Ring.Member r)
The multiplication law. Multiplies this Polynomial with another

Specified by:
multiply in interface Ring.Member
Parameters:
r - a ring member
Returns:
a new Polynomial with grade = max( this.grade, r.grade) + min( this.grade, r.grade) -1

negate

public AbelianGroup.Member negate()
Returns the inverse member. (That is mult(-1))

Specified by:
negate in interface AbelianGroup.Member
Returns:
inverse

subtract

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

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
g - a group member

toString

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

Overrides:
toString in class java.lang.Object
Returns:
String