MUQ  0.4.3
Legendre.cpp
Go to the documentation of this file.
2 
3 using namespace muq::Approximation;
4 
6 
8 
9 double Legendre::DerivativeEvaluate(int const polyOrder, int const derivOrder, double const x) const {
10 
11  if((derivOrder > polyOrder) || (polyOrder==0))
12  return 0.0;
13 
14  if(derivOrder==1){
15  return polyOrder / (x * x - 1.0) * (x * BasisEvaluate(polyOrder, x) - BasisEvaluate(polyOrder - 1, x));
16  }else{
17  // Use the fact that dp_{n+1}/dx = (2n+1) p_n + dp_{n-1} /dx
18  return (2*(polyOrder-1) + 1) * DerivativeEvaluate(polyOrder-1, derivOrder-1, x) + DerivativeEvaluate(polyOrder-2, derivOrder, x);
19  }
20 }
21 
22 double Legendre::ak(unsigned int k) const {
23  return (2.0*k-1.0) / k;
24 }
25 
26 double Legendre::bk(unsigned int k) const {
27  return 0.0;
28 }
29 
30 double Legendre::ck(unsigned int k) const {
31  return (k-1.0)/double(k);
32 }
33 
34 double Legendre::phi0(double x) const {
35  return 1.0;
36 }
37 
38 double Legendre::phi1(double x) const {
39  return x;
40 }
41 
42 double Legendre::Normalization(unsigned int polyOrder) const {
43  return 2.0/(2.0*polyOrder + 1.0);
44 }
45 
46 
47 REGISTER_SCALARBASIS_FAMILY(Legendre)
Family of Legendre orthogonal polynomials.
Definition: Legendre.h:13
virtual double ak(unsigned int k) const override
Implement .
Definition: Legendre.cpp:22
virtual double DerivativeEvaluate(int const polyOrder, int const derivOrder, double const x) const override
Definition: Legendre.cpp:9
virtual double phi1(double x) const override
Implement .
Definition: Legendre.cpp:38
virtual double bk(unsigned int k) const override
Implement .
Definition: Legendre.cpp:26
virtual double ck(unsigned int k) const override
Implement .
Definition: Legendre.cpp:30
virtual double Normalization(unsigned int polyOrder) const override
Definition: Legendre.cpp:42
virtual double phi0(double x) const override
Implement .
Definition: Legendre.cpp:34
Legendre()
A Legendre polynomial ( , , , ect. ...)
Definition: Legendre.cpp:5
virtual double BasisEvaluate(int const order, double const x) const override
Evaluate the specific polynomial type (must be implemented by the child)