/** * Create a Hermite polynomial. * <p><a href="http://mathworld.wolfram.com/HermitePolynomial.html">Hermite * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * H_0(x) = 1 \\ * H_1(x) = 2x \\ * H_{k+1}(x) = 2x H_k(X) - 2k H_{k-1}(x) * \) * </p> * @param degree degree of the polynomial * @return Hermite polynomial of specified degree */ public static PolynomialFunction createHermitePolynomial(final int degree) { return buildPolynomial(degree, HERMITE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { return new BigFraction[] { BigFraction.ZERO, BigFraction.TWO, new BigFraction(2 * k)}; } }); }
/** * Create a Chebyshev polynomial of the first kind. * <p><a href="https://en.wikipedia.org/wiki/Chebyshev_polynomials">Chebyshev * polynomials of the first kind</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * T_0(x) = 1 \\ * T_1(x) = x \\ * T_{k+1}(x) = 2x T_k(x) - T_{k-1}(x) * \) * </p> * @param degree degree of the polynomial * @return Chebyshev polynomial of specified degree */ public static PolynomialFunction createChebyshevPolynomial(final int degree) { return buildPolynomial(degree, CHEBYSHEV_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** Fixed recurrence coefficients. */ private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE }; /** {@inheritDoc} */ public BigFraction[] generate(int k) { return coeffs; } }); }
/** * Create a Laguerre polynomial. * <p><a href="http://mathworld.wolfram.com/LaguerrePolynomial.html">Laguerre * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * 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) * \) * </p> * @param degree degree of the polynomial * @return Laguerre polynomial of specified degree */ public static PolynomialFunction createLaguerrePolynomial(final int degree) { return buildPolynomial(degree, LAGUERRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { new BigFraction(2 * k + 1, kP1), new BigFraction(-1, kP1), new BigFraction(k, kP1)}; } }); }
/** * Create a Legendre polynomial. * <p><a href="http://mathworld.wolfram.com/LegendrePolynomial.html">Legendre * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * 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) * \) * </p> * @param degree degree of the polynomial * @return Legendre polynomial of specified degree */ public static PolynomialFunction createLegendrePolynomial(final int degree) { return buildPolynomial(degree, LEGENDRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { BigFraction.ZERO, new BigFraction(k + kP1, kP1), new BigFraction(k, kP1)}; } }); }
return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key), new RecurrenceCoefficientsGenerator() {
/** * Create a Chebyshev polynomial of the first kind. * <p><a href="https://en.wikipedia.org/wiki/Chebyshev_polynomials">Chebyshev * polynomials of the first kind</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * T_0(x) = 1 \\ * T_1(x) = x \\ * T_{k+1}(x) = 2x T_k(x) - T_{k-1}(x) * \) * </p> * @param degree degree of the polynomial * @return Chebyshev polynomial of specified degree */ public static PolynomialFunction createChebyshevPolynomial(final int degree) { return buildPolynomial(degree, CHEBYSHEV_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** Fixed recurrence coefficients. */ private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE }; /** {@inheritDoc} */ public BigFraction[] generate(int k) { return coeffs; } }); }
/** * Create a Legendre polynomial. * <p><a href="http://mathworld.wolfram.com/LegendrePolynomial.html">Legendre * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * 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) * \) * </p> * @param degree degree of the polynomial * @return Legendre polynomial of specified degree */ public static PolynomialFunction createLegendrePolynomial(final int degree) { return buildPolynomial(degree, LEGENDRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { BigFraction.ZERO, new BigFraction(k + kP1, kP1), new BigFraction(k, kP1)}; } }); }
/** * Create a Hermite polynomial. * <p><a href="http://mathworld.wolfram.com/HermitePolynomial.html">Hermite * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * H_0(x) = 1 \\ * H_1(x) = 2x \\ * H_{k+1}(x) = 2x H_k(X) - 2k H_{k-1}(x) * \) * </p> * @param degree degree of the polynomial * @return Hermite polynomial of specified degree */ public static PolynomialFunction createHermitePolynomial(final int degree) { return buildPolynomial(degree, HERMITE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { return new BigFraction[] { BigFraction.ZERO, BigFraction.TWO, new BigFraction(2 * k)}; } }); }
/** * Create a Laguerre polynomial. * <p><a href="http://mathworld.wolfram.com/LaguerrePolynomial.html">Laguerre * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * 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) * \) * </p> * @param degree degree of the polynomial * @return Laguerre polynomial of specified degree */ public static PolynomialFunction createLaguerrePolynomial(final int degree) { return buildPolynomial(degree, LAGUERRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { new BigFraction(2 * k + 1, kP1), new BigFraction(-1, kP1), new BigFraction(k, kP1)}; } }); }
/** * Create a Chebyshev polynomial of the first kind. * <p><a href="https://en.wikipedia.org/wiki/Chebyshev_polynomials">Chebyshev * polynomials of the first kind</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * T_0(x) = 1 \\ * T_1(x) = x \\ * T_{k+1}(x) = 2x T_k(x) - T_{k-1}(x) * \) * </p> * @param degree degree of the polynomial * @return Chebyshev polynomial of specified degree */ public static PolynomialFunction createChebyshevPolynomial(final int degree) { return buildPolynomial(degree, CHEBYSHEV_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** Fixed recurrence coefficients. */ private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE }; /** {@inheritDoc} */ public BigFraction[] generate(int k) { return coeffs; } }); }
/** * Create a Hermite polynomial. * <p><a href="http://mathworld.wolfram.com/HermitePolynomial.html">Hermite * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * H_0(x) = 1 \\ * H_1(x) = 2x \\ * H_{k+1}(x) = 2x H_k(X) - 2k H_{k-1}(x) * \) * </p> * @param degree degree of the polynomial * @return Hermite polynomial of specified degree */ public static PolynomialFunction createHermitePolynomial(final int degree) { return buildPolynomial(degree, HERMITE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { return new BigFraction[] { BigFraction.ZERO, BigFraction.TWO, new BigFraction(2 * k)}; } }); }
/** * Create a Laguerre polynomial. * <p><a href="http://mathworld.wolfram.com/LaguerrePolynomial.html">Laguerre * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * 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) * \) * </p> * @param degree degree of the polynomial * @return Laguerre polynomial of specified degree */ public static PolynomialFunction createLaguerrePolynomial(final int degree) { return buildPolynomial(degree, LAGUERRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { new BigFraction(2 * k + 1, kP1), new BigFraction(-1, kP1), new BigFraction(k, kP1)}; } }); }
/** * Create a Legendre polynomial. * <p><a href="http://mathworld.wolfram.com/LegendrePolynomial.html">Legendre * polynomials</a> are orthogonal polynomials. * They can be defined by the following recurrence relations:</p><p> * \( * 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) * \) * </p> * @param degree degree of the polynomial * @return Legendre polynomial of specified degree */ public static PolynomialFunction createLegendrePolynomial(final int degree) { return buildPolynomial(degree, LEGENDRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { BigFraction.ZERO, new BigFraction(k + kP1, kP1), new BigFraction(k, kP1)}; } }); }
return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key), new RecurrenceCoefficientsGenerator() {
return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key), new RecurrenceCoefficientsGenerator() {