jsci.maths.polynomials
Class RealPolynomial
- java.lang.Object
-
- jsci.maths.analysis.RealFunction
-
- jsci.maths.polynomials.RealPolynomial
-
- All Implemented Interfaces:
- java.io.Serializable, Ring.Member, AbelianGroup.Member, Mapping, Member, Polynomial
public class RealPolynomial extends RealFunction implements Polynomial
A Polynomial as aRing.Memberover a realField- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description RealPolynomial(double[] coeff)Creates a new instance of RealPolynomialRealPolynomial(Field.Member[] f)Creates a new RealPolynomial object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RealFunctionadd(RealFunction g)The group composition law.intdegree()The degreeRealFunctiondifferentiate()Differentiate the real polynomial.booleanequals(java.lang.Object o)Returns true if this polynomial is equal to another.Field.MembergetCoefficient(int k)Get the coefficient of degree k, i.e.doublegetCoefficientAsDouble(int k)Get the coefficient of degree k, i.e.Field.Member[]getCoefficients()Get the coefficients as an arraydouble[]getCoefficientsAsDoubles()Get the coefficients as an array of doublesjava.lang.ObjectgetSet()inthashCode()Some kind of hashcode...RealPolynomialintegrate()"inverse" operation for differentiatebooleanisOne()Returns true if this polynomial is equal to one.booleanisZero()Returns true if this polynomial is equal to zero.doublemap(double x)Evaluates this polynomial.RealFunctionmultiply(RealFunction r)The multiplication law.AbelianGroup.Membernegate()Returns the inverse member.RealPolynomialscalarDivide(double a)return a new real Polynomial with coefficients divided by aPolynomialscalarDivide(Field.Member f)return a new real Polynomial with coefficients divided by fRealPolynomialscalarMultiply(double a)Returns the multiplication of this polynomial by a scalarPolynomialscalarMultiply(Field.Member f)Returns the multiplication of this polynomial by a scalarRealFunctionsubtract(RealFunction g)The group composition law with inverse.java.lang.StringtoString()String representation P(x) = a_k x^k +...-
Methods inherited from class jsci.maths.analysis.RealFunction
add, compose, constant, dimension, divide, divide, inverse, multiply, subtract, taylorExpand, tensor
-
Methods inherited from interface jsci.maths.fields.Ring.Member
multiply
-
Methods inherited from interface jsci.maths.groups.AbelianGroup.Member
add, subtract
-
-
-
-
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 k)
Get the coefficient of degree k, i.e. a_k if P(x) := sum_{k=0}^n a_k x^k- Specified by:
getCoefficientin interfacePolynomial- Parameters:
k- degree- Returns:
- coefficient as described above
-
getCoefficientAsDouble
public double getCoefficientAsDouble(int k)
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:
getCoefficientsin interfacePolynomial- 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:
degreein interfacePolynomial- Returns:
- the degree
-
getSet
public java.lang.Object getSet()
- Specified by:
getSetin interfaceMember- Overrides:
getSetin classRealFunction
-
isZero
public boolean isZero()
Returns true if this polynomial is equal to zero. All coefficients are tested for |a_k| < GlobalSettings.ZERO_TOL.- Returns:
- true if all coefficients < GlobalSettings.ZERO_TOL
-
isOne
public boolean isOne()
Returns true if this polynomial is equal to one. It is tested, whether |a_0 - 1| <= GlobalSettings.ZERO_TOL and the remaining coefficients are |a_k| < GlobalSettings.ZERO_TOL.- Returns:
- true if this is equal to one.
-
add
public RealFunction add(RealFunction g)
The group composition law. Returns a new polynom with grade = max( this.grade, g.grade)- Overrides:
addin classRealFunction- Parameters:
g- a group member
-
differentiate
public RealFunction differentiate()
Differentiate the real polynomial. Only useful iff the polynomial is built over a Banach space and an appropriate multiplication law is provided.- Specified by:
differentiatein classRealFunction- Returns:
- a new polynomial with degree = max(this.degree-1 , 0)
-
scalarDivide
public Polynomial scalarDivide(Field.Member f)
return a new real Polynomial with coefficients divided by f- Specified by:
scalarDividein interfacePolynomial- Parameters:
f- divisor- Returns:
- new Polynomial with coefficients /= f
-
scalarDivide
public RealPolynomial scalarDivide(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)
Returns true if this polynomial is equal to another.- Overrides:
equalsin classjava.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:
hashCodein classjava.lang.Object- Returns:
- a hashcode
-
integrate
public RealPolynomial integrate()
"inverse" operation for differentiate- Returns:
- the integrated polynomial
-
scalarMultiply
public Polynomial scalarMultiply(Field.Member f)
Returns the multiplication of this polynomial by a scalar- Specified by:
scalarMultiplyin interfacePolynomial- Parameters:
f-- Returns:
- new Polynomial with coefficients *= a
-
scalarMultiply
public RealPolynomial scalarMultiply(double a)
Returns the multiplication of this polynomial by a scalar- Parameters:
a- factor- Returns:
- new Polynomial with coefficients *= a
-
multiply
public RealFunction multiply(RealFunction r)
The multiplication law. Multiplies this Polynomial with another- Overrides:
multiplyin classRealFunction- Parameters:
r- a polynomial- Returns:
- a new Polynomial with grade = max( this.grade, r.grade) + min( this.grade, r.grade)
-
negate
public AbelianGroup.Member negate()
Returns the inverse member. (That is mult(-1))- Specified by:
negatein interfaceAbelianGroup.Member- Overrides:
negatein classRealFunction- Returns:
- inverse
-
subtract
public RealFunction subtract(RealFunction g)
The group composition law with inverse.- Overrides:
subtractin classRealFunction- Parameters:
g- a group member
-
toString
public java.lang.String toString()
String representation P(x) = a_k x^k +...- Overrides:
toStringin classjava.lang.Object- Returns:
- String
-
-
DMelt 3.0 © DataMelt by jWork.ORG