opale.mathtools
Class Polynomial

java.lang.Object
  |
  +--opale.mathtools.Polynomial

public final class Polynomial
extends java.lang.Object

This class represents a Polynom with real coefficients. The storage of coefficients is full storage, i.e. all the coefficients are stored.

Since:
Opale-Mathtools 0.13
See Also:
PolynomModel

Constructor Summary
Polynomial(int n)
          Constructs a polynom of degree n initialized to zero.
Polynomial(int n, double[] tab)
          Constructs a polynom of degree n, with the coefficients in the array tab.
 
Method Summary
 void construct(int n)
          Constructs a polynom of degree n initialized to zero.
 void construct(int n, double[] tab)
          Constructs a polynom of degree n, with the coefficients in the array tab.
 int deg()
          Return the degree.
 double eval(double x)
          Evaluates the polynom at the point x by the Horner's method.
 double get(int i)
          Returns the coefficient 'i'.
static void main(java.lang.String[] arfg)
           
 void set(int i, double x)
          Sets the coefficient i with the value x.
 java.lang.String toString()
          Generic méthod to print the polynom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Polynomial

public Polynomial(int n)
Constructs a polynom of degree n initialized to zero.
Parameters:
int - n, the degree

Polynomial

public Polynomial(int n,
                  double[] tab)
Constructs a polynom of degree n, with the coefficients in the array tab.
Parameters:
int - n, the degree
double[] - tab, the array of coefficients
Method Detail

construct

public void construct(int n)
Constructs a polynom of degree n initialized to zero.
Parameters:
int - n, the degree

construct

public void construct(int n,
                      double[] tab)
Constructs a polynom of degree n, with the coefficients in the array tab.
Parameters:
int - n, the degree
double[] - tab, the array of coefficients

get

public double get(int i)
Returns the coefficient 'i'.
Parameters:
int - i, the coefficient to get
Returns:
double, the value of the coefficient

set

public void set(int i,
                double x)
Sets the coefficient i with the value x.
Parameters:
int - i, the coefficient to set
double - x, the value

deg

public int deg()
Return the degree.
Returns:
int, the degree

eval

public double eval(double x)
Evaluates the polynom at the point x by the Horner's method.
Parameters:
double - x, the point x
Returns:
double, the value of the polynom

toString

public java.lang.String toString()
Generic méthod to print the polynom.
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] arfg)