org.apache.commons.math3.analysis.polynomials

## Class PolynomialsUtils

• java.lang.Object
• org.apache.commons.math3.analysis.polynomials.PolynomialsUtils

• public class PolynomialsUtils
extends Object
A collection of static methods that operate on or return polynomials.
Since:
2.0
• ### Method Summary

Methods
Modifier and Type Method and Description
static PolynomialFunction createChebyshevPolynomial(int degree)
Create a Chebyshev polynomial of the first kind.
static PolynomialFunction createHermitePolynomial(int degree)
Create a Hermite polynomial.
static PolynomialFunction createJacobiPolynomial(int degree, int v, int w)
Create a Jacobi polynomial.
static PolynomialFunction createLaguerrePolynomial(int degree)
Create a Laguerre polynomial.
static PolynomialFunction createLegendrePolynomial(int degree)
Create a Legendre polynomial.
static double[] shift(double[] coefficients, double shift)
Compute the coefficients of the polynomial $$P_s(x)$$ whose values at point x will be the same as the those from the original polynomial $$P(x)$$ when computed at x + shift.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Method Detail

• #### createChebyshevPolynomial

public static PolynomialFunction createChebyshevPolynomial(int degree)
Create a Chebyshev polynomial of the first kind.

Chebyshev polynomials of the first kind are orthogonal polynomials. They can be defined by the following recurrence relations:

$$T_0(x) = 1 \\ T_1(x) = x \\ T_{k+1}(x) = 2x T_k(x) - T_{k-1}(x)$$

Parameters:
degree - degree of the polynomial
Returns:
Chebyshev polynomial of specified degree
• #### createHermitePolynomial

public static PolynomialFunction createHermitePolynomial(int degree)
Create a Hermite polynomial.

Hermite polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

$$H_0(x) = 1 \\ H_1(x) = 2x \\ H_{k+1}(x) = 2x H_k(X) - 2k H_{k-1}(x)$$

Parameters:
degree - degree of the polynomial
Returns:
Hermite polynomial of specified degree
• #### createLaguerrePolynomial

public static PolynomialFunction createLaguerrePolynomial(int degree)
Create a Laguerre polynomial.

Laguerre polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

$$L_0(x) = 1 \\ L_1(x) = 1 - x \\ (k+1) L_{k+1}(x) = (2k + 1 - x) L_k(x) - k L_{k-1}(x)$$

Parameters:
degree - degree of the polynomial
Returns:
Laguerre polynomial of specified degree
• #### createLegendrePolynomial

public static PolynomialFunction createLegendrePolynomial(int degree)
Create a Legendre polynomial.

Legendre polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

$$P_0(x) = 1 \\ P_1(x) = x \\ (k+1) P_{k+1}(x) = (2k+1) x P_k(x) - k P_{k-1}(x)$$

Parameters:
degree - degree of the polynomial
Returns:
Legendre polynomial of specified degree
• #### createJacobiPolynomial

public static PolynomialFunction createJacobiPolynomial(int degree,
int v,
int w)
Create a Jacobi polynomial.

Jacobi polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

$$P_0^{vw}(x) = 1 \\ P_{-1}^{vw}(x) = 0 \\ 2k(k + v + w)(2k + v + w - 2) P_k^{vw}(x) = \\ (2k + v + w - 1)[(2k + v + w)(2k + v + w - 2) x + v^2 - w^2] P_{k-1}^{vw}(x) \\ - 2(k + v - 1)(k + w - 1)(2k + v + w) P_{k-2}^{vw}(x)$$

Parameters:
degree - degree of the polynomial
v - first exponent
w - second exponent
Returns:
Jacobi polynomial of specified degree
• #### shift

public static double[] shift(double[] coefficients,
double shift)
Compute the coefficients of the polynomial $$P_s(x)$$ whose values at point x will be the same as the those from the original polynomial $$P(x)$$ when computed at x + shift.

More precisely, let $$\Delta =$$ shift and let $$P_s(x) = P(x + \Delta)$$. The returned array consists of the coefficients of $$P_s$$. So if $$a_0, ..., a_{n-1}$$ are the coefficients of $$P$$, then the returned array $$b_0, ..., b_{n-1}$$ satisfies the identity $$\sum_{i=0}^{n-1} b_i x^i = \sum_{i=0}^{n-1} a_i (x + \Delta)^i$$ for all $$x$$.

Parameters:
coefficients - Coefficients of the original polynomial.
shift - Shift value.
Returns:
the coefficients $$b_i$$ of the shifted polynomial.