Class Polynom

java.lang.Object
   |
   +----Polynom

public class Polynom
extends Object
This class implements polynom. It used to calculate the equations while the calculations are done The class itself contains coefficient of polynom, and calculates equation's (polynom's) roots.


Constructor Index

 o Polynom()
Constructs empty polynom.

Method Index

 o addPolynom(Polynom)
Adds two polynoms (one is given as argument).
 o calculateRoots()
Calculates polynom's roots (run appropriate function according to coefficients).
 o getCoef(int)
Returns coefficient's value by its index.
 o getResult(double)
Calculates result with given x.
 o reset()
Resets polynom to unit polynom.
 o setCoef(int, double)
Sets coefficient's value by its index.
 o toString()
Returns a string representation of the object.

Constructors

 o Polynom
 public Polynom()
Constructs empty polynom.

Methods

 o reset
 public void reset()
Resets polynom to unit polynom.

 o setCoef
 public void setCoef(int coefNum,
                     double value)
Sets coefficient's value by its index.

Parameters:
coefNum - coefficient index.
value - coefficient value.
 o getCoef
 public double getCoef(int coefNum)
Returns coefficient's value by its index.

Returns:
coefficient.
 o addPolynom
 public void addPolynom(Polynom p)
Adds two polynoms (one is given as argument).

Parameters:
p - polynom to add.
 o calculateRoots
 public double[] calculateRoots()
Calculates polynom's roots (run appropriate function according to coefficients).

Returns:
array with roots.
 o getResult
 public double getResult(double x)
Calculates result with given x.

Parameters:
x - x.
Returns:
value of polynom in x.
 o toString
 public String toString()
Returns a string representation of the object.

Returns:
a string representation of the object.
Overrides:
toString in class Object