Provides an implementation for a univariate polynomial P(x)
.
More...
Public Member Functions | |
Polynomial (int highestDegree) | |
Constructing the univariate polynomial with a given highest degree that the polynomial can have. | |
Polynomial (BigInteger[] coefficients) | |
Constructing the univariate polynomial with given coefficients in Java BigInteger type. | |
Polynomial (int[] coefficients) | |
Constructing the univariate polynomial with given coefficients in integer type. | |
int | degree () |
Returns the polynomial degree. | |
BigInteger | getCoefficient (int degree) |
Returns coefficient corresponding the given degree. | |
BigInteger[] | getCoefficients () |
Returns all coefficients of the polynomial. | |
void | setCoefficient (int degree, BigInteger coeff) |
Sets coefficient at a specified degree with given value in Java BigInteger type. | |
void | setCoefficient (int degree, int coeff) |
Sets coefficient of a specified degree with given value in integer type. | |
BigInteger | value (BigInteger x) |
Evaluates the polynomial at a given point. | |
Polynomial | add (Polynomial p) |
Returns a new univariate polynomial as the sum of this polynomial and another polynomial. | |
Polynomial | subtract (Polynomial p) |
Returns a new univariate polynomial as the result of subtracting this polynomial by another polynomial. | |
Polynomial | negate () |
Returns a new univariate polynomial by negating this polynomial. | |
Polynomial | multiply (BigInteger k) |
Returns a new univariate polynomial by multiplying this polynomial with a scalar value in Java BigInteger type. | |
Polynomial | multiply (int k) |
Returns a new univariate polynomial by multiplying this polynomial with a scalar value in integer type. | |
Polynomial | multiply (Polynomial p) |
Returns a new univariate polynomial by multiplying this polynomial with another polynomial. | |
Polynomial | pow (int exponent) |
Returns a new univariate polynomial as an exponentiation of this polynomial. | |
Polynomial | mod (BigInteger m) |
Returns a new univariate polynomial by mod-ing all coefficients of this polynomial by a given modulus. | |
String | toString () |
Returns a string representing this polynomial. | |
Static Public Member Functions | |
static Polynomial | createLagrange (int[] x, int i) |
Creates a univariate polynomial in Lagrange form. | |
static void | main (String args[]) |
For testing purpose. |
Provides an implementation for a univariate polynomial P(x)
.
common.Polynomial.Polynomial | ( | int | highestDegree | ) | [inline] |
Constructing the univariate polynomial with a given highest degree that the polynomial can have.
At initialization, all coefficients are set to 0, and the polynomial degree is 0.
highestDegree | the highest degree. |
common.Polynomial.Polynomial | ( | BigInteger[] | coefficients | ) | [inline] |
Constructing the univariate polynomial with given coefficients in Java BigInteger type.
The polynomial degree is determined based on the values of the given coefficients.
coefficients | given coefficients. |
common.Polynomial.Polynomial | ( | int[] | coefficients | ) | [inline] |
Constructing the univariate polynomial with given coefficients in integer type.
The polynomial degree is determined based on the values of the given coefficients.
coefficients | given coefficients. |
Polynomial common.Polynomial.add | ( | Polynomial | p | ) | [inline] |
Returns a new univariate polynomial as the sum of this polynomial and another polynomial.
p | another polynomial. |
static Polynomial common.Polynomial.createLagrange | ( | int[] | x, |
int | i | ||
) | [inline, static] |
Creates a univariate polynomial in Lagrange form.
x | array of all points ![]() |
i | index ![]() ![]() |
int common.Polynomial.degree | ( | ) | [inline] |
Returns the polynomial degree.
BigInteger common.Polynomial.getCoefficient | ( | int | degree | ) | [inline] |
Returns coefficient corresponding the given degree.
degree | degree of the queried coefficient. |
BigInteger [] common.Polynomial.getCoefficients | ( | ) | [inline] |
Returns all coefficients of the polynomial.
static void common.Polynomial.main | ( | String | args[] | ) | [inline, static] |
For testing purpose.
args |
Polynomial common.Polynomial.mod | ( | BigInteger | m | ) | [inline] |
Returns a new univariate polynomial by mod-ing all coefficients of this polynomial by a given modulus.
m | the modulus. |
Polynomial common.Polynomial.multiply | ( | BigInteger | k | ) | [inline] |
Returns a new univariate polynomial by multiplying this polynomial with a scalar value in Java BigInteger type.
k | scalar value. |
Polynomial common.Polynomial.multiply | ( | int | k | ) | [inline] |
Returns a new univariate polynomial by multiplying this polynomial with a scalar value in integer type.
k | scalar value. |
Polynomial common.Polynomial.multiply | ( | Polynomial | p | ) | [inline] |
Returns a new univariate polynomial by multiplying this polynomial with another polynomial.
The multiplication is done among coefficients of two polynomials.
p | another polynomial. |
Polynomial common.Polynomial.negate | ( | ) | [inline] |
Returns a new univariate polynomial by negating this polynomial.
Polynomial common.Polynomial.pow | ( | int | exponent | ) | [inline] |
Returns a new univariate polynomial as an exponentiation of this polynomial.
exponent | desired exponent. |
void common.Polynomial.setCoefficient | ( | int | degree, |
BigInteger | coeff | ||
) | [inline] |
Sets coefficient at a specified degree with given value in Java BigInteger type.
degree | specified degree. |
coeff | new value for the coefficient. |
void common.Polynomial.setCoefficient | ( | int | degree, |
int | coeff | ||
) | [inline] |
Sets coefficient of a specified degree with given value in integer type.
degree | specified degree. |
coeff | new value for the coefficient. |
Polynomial common.Polynomial.subtract | ( | Polynomial | p | ) | [inline] |
Returns a new univariate polynomial as the result of subtracting this polynomial by another polynomial.
p | another polynomial. |
BigInteger common.Polynomial.value | ( | BigInteger | x | ) | [inline] |
Evaluates the polynomial at a given point.
x | given value x . |
P(x)
.