## Class Polynom

• All Implemented Interfaces:
Serializable

```public class Polynom
extends Object
implements Serializable```
The coefficients of a polynomial equation. The equation must be in the form ``` y = c0 + c1×x + c2×x2 + c3×x3 + ... + cn×xn```.

The static method `roots(double[])` can be used for computing the root of a polynomial equation without creating a `Polygon` object.

Since:
2.0
Author:
Martin Desruisseaux (IRD), Ken Turkiwski, for algorithmic inspiration
Serialized Form
• ### Constructor Summary

Constructors
Constructor and Description
`Polynom(double[] c)`
Constructs a polynom with the specified coefficients.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`boolean` `equals(Object object)`
Compares this polynom with the specified object for equality.
`int` `hashCode()`
Returns a hash value for this polynom.
`static void` `main(String... c)`
Display to the standard output the roots of a polynomial equation.
`double[]` `roots()`
Finds the roots of this polynome.
`static double[]` `roots(double[] c)`
Finds the roots of a polynomial equation.
`String` `toString()`
Returns a string representation of this polynom.
`double` `y(double x)`
Evaluates this polynomial equation for the specified x value.
• ### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### Polynom

`public Polynom(double[] c)`
Constructs a polynom with the specified coefficients.
Parameters:
`c` - The coefficients. This array is copied.
• ### Method Detail

• #### y

`public final double y(double x)`
Evaluates this polynomial equation for the specified x value. More specifically, this method compute ```c0 + c1×x + c2×x2 + c3×x3 + ... + cn×xn```.
• #### roots

`public double[] roots()`
Finds the roots of this polynome.
Returns:
The roots.
• #### roots

`public static double[] roots(double[] c)`
Finds the roots of a polynomial equation. More specifically, this method solve the following equation:
``` c + c*x + c*x2 + c*x3 + ... + c[n]*xn == 0 ```
where n is the array length minus 1.
Parameters:
`c` - The coefficients for the polynomial equation.
Returns:
The roots. This array may have any length up to `n-1`.
Throws:
`UnsupportedOperationException` - if there is more coefficients than this method can handle.
• #### main

`public static void main(String... c)`
Display to the standard output the roots of a polynomial equation. More specifically, this method solve the following equation:
``` c + c*x + c*x2 + c*x3 + ... + c[n]*xn == 0 ```
where n is the array length minus 1.
Parameters:
`c` - The coefficients for the polynomial equation.
• #### hashCode

`public int hashCode()`
Returns a hash value for this polynom.
Overrides:
`hashCode` in class `Object`
• #### equals

`public boolean equals(Object object)`
Compares this polynom with the specified object for equality.
Overrides:
`equals` in class `Object`
• #### toString

`public String toString()`
Returns a string representation of this polynom.
Overrides:
`toString` in class `Object`