9#include "hierarchic_fe.h"
27double legendre(
unsigned n,
double x,
double t) {
35 double Pi = 2 * x - t;
36 for (
unsigned i = 2; i <= n; ++i) {
38 (2 * i - 1) * (2 * x - t) / i * Pi - (i - 1) * t * t / i * Pim1;
145double jacobi(
unsigned n,
double alpha,
double beta,
double x) {
153 return 0.5 * (alpha - beta + x * (alpha + beta + 2));
156 double p1 = 0.5 * (alpha - beta + x * (alpha + beta + 2));
158 for (
unsigned j = 1; j < n; ++j) {
159 const double alpha1 =
160 2 * (j + 1) * (j + alpha + beta + 1) * (2 * j + alpha + beta);
161 const double alpha2 =
162 (2 * j + alpha + beta + 1) * (alpha * alpha - beta * beta);
163 const double alpha3 = (2 * j + alpha + beta) * (2 * j + alpha + beta + 1) *
164 (2 * j + alpha + beta + 2);
165 const double alpha4 =
166 2 * (j + alpha) * (j + beta) * (2 * j + alpha + beta + 2);
167 p2 = 1. / alpha1 * ((alpha2 + alpha3 * x) * p1 - alpha4 * p0);
181double jacobi(
unsigned n,
double alpha,
double x) {
182 return jacobi(n, alpha, 0, x);
206double ijacobi(
unsigned n,
double alpha,
double x) {
215 double ajp1P = 2 * 2 * (2 + alpha) * (2 * 2 + alpha - 2);
216 double bjp1P = 2 * 2 + alpha - 1;
217 double cjp1P = (2 * 2 + alpha) * (2 * 2 + alpha - 2);
218 double djp1P = 2 * (2 + alpha - 1) * (2 - 1) * (2 * 2 + alpha);
220 double Pjm1 = (2 + alpha) * x - 1;
222 (bjp1P * (cjp1P * (2 * x - 1) + alpha * alpha) * Pjm1 - djp1P * Pjm2) /
224 for (
unsigned j = 2; j < n; ++j) {
225 ajp1P = 2 * (j + 1) * ((j + 1) + alpha) * (2 * (j + 1) + alpha - 2);
226 bjp1P = 2 * (j + 1) + alpha - 1;
227 cjp1P = (2 * (j + 1) + alpha) * (2 * (j + 1) + alpha - 2);
228 djp1P = 2 * ((j + 1) + alpha - 1) * ((j + 1) - 1) * (2 * (j + 1) + alpha);
230 (bjp1P * (cjp1P * (2 * x - 1) + alpha * alpha) * Pj - djp1P * Pjm1) /
237 const double anL = (n + alpha) / ((2 * n + alpha - 1) * (2 * n + alpha));
238 const double bnL = alpha / ((2 * n + alpha - 2) * (2 * n + alpha));
239 const double cnL = (n - 1) / ((2 * n + alpha - 2) * (2 * n + alpha - 1));
240 return anL * Pj + bnL * Pjm1 - cnL * Pjm2;
254 return jacobi(n - 1, alpha, x);
273 return jacobi(n - 1, alpha + 1, 1, x) * (alpha + n + 1);
Collects data structures and algorithms designed for scalar finite element methods primarily meant fo...
double ilegendre_dt(unsigned n, double x, double t)
Computes .
double ilegendre_dx(unsigned n, double x, double t)
Computes .
double ijacobi(unsigned n, double alpha, double x)
Evaluate the integral of the (n-1)-th degree Jacobi Polynomial for .
double jacobi_dx(unsigned n, double alpha, double x)
Computes the derivative of the n-th degree Jacobi Polynomial for .
double ilegendre(unsigned n, double x, double t)
computes the integral of the (n-1)-th degree scaled Legendre Polynomial
double legendre_dx(unsigned n, double x, double t)
Computes the derivative of the n-th degree scaled Legendre polynomial.
double jacobi(unsigned n, double alpha, double beta, double x)
Computes the n-th degree shifted Jacobi polynomial.
double legendre(unsigned n, double x, double t)
computes the n-th degree scaled Legendre Polynomial
double ijacobi_dx(unsigned n, double alpha, double x)
Computes the derivative of the n-th integrated scaled Jacobi polynomial.