Legendre_poly Class Reference
[Orthogonal polynomials]

Legendre polynomials. More...

#include <ortho_poly.h>

Inheritance diagram for Legendre_poly:

Ortho_poly List of all members.

Public Member Functions

 Legendre_poly (int ni)
 Standard constructor.
 Legendre_poly (const Legendre_poly &)
 Copy constructor.
virtual ~Legendre_poly ()
 Destructor.
void operator= (const Legendre_poly &)
 Assignment to another Legendre_poly.
virtual double weight (double x) const
 Weight function $w$.
virtual double operator() (int i, double x) const
 Value of the polynomial $p_i$.
virtual const Gridgauss_nodes () const
 Gauss nodes.
virtual double gauss_weight (int i) const
 Gauss weights.
virtual double gauss_gamma (int i) const
 Gamma factor $\gamma_i$ (square of the polynomial no.
virtual const Gridgauss_lobatto_nodes () const
 Gauss-Lobatto nodes.
virtual double gauss_lobatto_weight (int i) const
 Gauss-Lobatto weights.
virtual double gauss_lobatto_gamma (int i) const
 Gamma factor $\gamma_i$ (square of the polynomial no.
virtual void coef_projection (double(*f)(double), double *cf) const
 Coefficients of the expansion over the Legendre polynomials of the orthogonal projection on the space of polynomials of maximum degree N.
int n () const
 returns N, i.e. the maximum degree of the polynomials
void coef_interpolant_Gauss (double(*f)(double), double *cf) const
 Coefficients of the interpolant polynomial through the Gauss nodes.
void coef_interpolant_GL (double(*f)(double), double *cf) const
 Coefficients of the interpolant polynomial through the Gauss-Lobatto nodes.
double series (const double *a, double x) const
 Value of some expansion over the polynomials: $\sum_{i=0}^N a_i\, p_i(x)$.

Protected Attributes

const int nn
 N = maximum degree of the polynomials
const Gridp_gauss_nodes
 Pointer on the Gauss nodes.
double * p_gauss_weights
 Pointer on the Gauss weights.
double * p_gauss_gamma
 Pointer on the gamma factors (squares of the polynomials with respect to the discrete scalar product associated with the Gauss nodes).
const Gridp_gauss_lobatto_nodes
 Pointer on the Gauss-Lobatto nodes.
double * p_gauss_lobatto_weights
 Pointer on the Gauss-Lobatto weights.
double * p_gauss_lobatto_gamma
 Pointer on the gamma factors (square of the polynomials with respect to the discrete scalar product associated with the Gauss-Lobatto nodes).

Detailed Description

Legendre polynomials.

() Each instance of this class represents a family of Legendre polynomials $(T_i)$ up to a given degree N.

Definition at line 341 of file ortho_poly.h.


Constructor & Destructor Documentation

Legendre_poly::Legendre_poly int  ni  ) 
 

Standard constructor.

Parameters:
ni maximum degree of the polynomials

Definition at line 59 of file legendre_poly.C.

Legendre_poly::Legendre_poly const Legendre_poly  ) 
 

Copy constructor.

Definition at line 65 of file legendre_poly.C.

Legendre_poly::~Legendre_poly  )  [virtual]
 

Destructor.

Definition at line 72 of file legendre_poly.C.


Member Function Documentation

void Ortho_poly::coef_interpolant_Gauss double(*)(double)  f,
double *  cf
const [inherited]
 

Coefficients of the interpolant polynomial through the Gauss nodes.

Parameters:
(*f)(double) function to be interpolated
cf [output] array containing the N+1 coefficients of the expansion of the interpolant on the basis polynomials. This array must be of size at least N+1 and must have been allocated by the user prior to the call of this method.

Definition at line 128 of file ortho_poly.C.

References Ortho_poly::gauss_nodes(), Ortho_poly::gauss_weight(), and Ortho_poly::nn.

void Ortho_poly::coef_interpolant_GL double(*)(double)  f,
double *  cf
const [inherited]
 

Coefficients of the interpolant polynomial through the Gauss-Lobatto nodes.

Parameters:
(*f)(double) function to be interpolated
cf [output] array containing the N+1 coefficients of the expansion of the interpolant on the basis polynomials. This array must be of size at least N+1 and must have been allocated by the user prior to the call of this method.

Definition at line 156 of file ortho_poly.C.

References Ortho_poly::gauss_lobatto_nodes(), Ortho_poly::gauss_lobatto_weight(), and Ortho_poly::nn.

void Legendre_poly::coef_projection double(*)(double)  f,
double *  cf
const [virtual]
 

Coefficients of the expansion over the Legendre polynomials of the orthogonal projection on the space of polynomials of maximum degree N.

Parameters:
(*f)(double) function to be projected
cf [output] array containing the N+1 coefficients of the expansion over the Legendre polynomials of the orthogonal projection on the space of polynomials of maximum degree N. This array must be of size at least N+1 and must have been allocated by the user prior to the call of this method.

Implements Ortho_poly.

Definition at line 234 of file legendre_poly.C.

References Ortho_poly::coef_interpolant_GL(), and Ortho_poly::nn.

double Legendre_poly::gauss_gamma int  i  )  const [virtual]
 

Gamma factor $\gamma_i$ (square of the polynomial no.

i with respect to the discrete scalar product associated with the Gauss nodes)

Implements Ortho_poly.

Definition at line 164 of file legendre_poly.C.

References Ortho_poly::nn, and Ortho_poly::p_gauss_gamma.

double Legendre_poly::gauss_lobatto_gamma int  i  )  const [virtual]
 

Gamma factor $\gamma_i$ (square of the polynomial no.

i with respect to the discrete scalar product associated with the Gauss-Lobatto nodes)

Implements Ortho_poly.

Definition at line 212 of file legendre_poly.C.

References Ortho_poly::nn, and Ortho_poly::p_gauss_lobatto_gamma.

const Grid & Legendre_poly::gauss_lobatto_nodes  )  const [virtual]
 

Gauss-Lobatto nodes.

Implements Ortho_poly.

Definition at line 179 of file legendre_poly.C.

References Ortho_poly::nn, and Ortho_poly::p_gauss_lobatto_nodes.

double Legendre_poly::gauss_lobatto_weight int  i  )  const [virtual]
 

Gauss-Lobatto weights.

Parameters:
i index of the weight
Returns:
weight $w_i$

Implements Ortho_poly.

Definition at line 190 of file legendre_poly.C.

References Ortho_poly::nn, and Ortho_poly::p_gauss_lobatto_weights.

const Grid & Legendre_poly::gauss_nodes  )  const [virtual]
 

Gauss nodes.

Implements Ortho_poly.

Definition at line 139 of file legendre_poly.C.

References Ortho_poly::nn, and Ortho_poly::p_gauss_nodes.

double Legendre_poly::gauss_weight int  i  )  const [virtual]
 

Gauss weights.

Parameters:
i index of the weight
Returns:
weight $w_i$

Implements Ortho_poly.

Definition at line 150 of file legendre_poly.C.

References Ortho_poly::p_gauss_weights.

int Ortho_poly::n  )  const [inherited]
 

returns N, i.e. the maximum degree of the polynomials

Definition at line 117 of file ortho_poly.C.

References Ortho_poly::nn.

double Legendre_poly::operator() int  i,
double  x
const [virtual]
 

Value of the polynomial $p_i$.

Parameters:
i no. of the polynomial
x point in [-1,1] where the polynomial is to be evaluated
Returns:
value of $p_i(x)$

Implements Ortho_poly.

Definition at line 112 of file legendre_poly.C.

References Ortho_poly::nn.

void Legendre_poly::operator= const Legendre_poly  ) 
 

Assignment to another Legendre_poly.

Definition at line 79 of file legendre_poly.C.

double Ortho_poly::series const double *  a,
double  x
const [inherited]
 

Value of some expansion over the polynomials: $\sum_{i=0}^N a_i\, p_i(x)$.

Parameters:
a array of size at least N+1 and storing the N+1 coefficients $a_i$ of the expansion on the basis polynomials $p_i(x)$. For an interpolant polynomial, a is the array cf computed by the method coef_interpolant_Gauss (Gauss nodes) or coef_interpolant_GL (Gauss-Lobatto nodes)
x point in [-1,1] where the series is to be evaluated
Returns:
value of $\sum_{i=0}^N a_i\, p_i(x)$

Definition at line 184 of file ortho_poly.C.

References Ortho_poly::nn.

double Legendre_poly::weight double  x  )  const [virtual]
 

Weight function $w$.

Parameters:
x point in [-1,1] where the weight function is to be evaluated
Returns:
$w(x)=1$ (= constant value 1 for Legendre polynomials)

Implements Ortho_poly.

Definition at line 101 of file legendre_poly.C.


Member Data Documentation

const int Ortho_poly::nn [protected, inherited]
 

N = maximum degree of the polynomials

Definition at line 57 of file ortho_poly.h.

double* Ortho_poly::p_gauss_gamma [mutable, protected, inherited]
 

Pointer on the gamma factors (squares of the polynomials with respect to the discrete scalar product associated with the Gauss nodes).

Definition at line 71 of file ortho_poly.h.

double* Ortho_poly::p_gauss_lobatto_gamma [mutable, protected, inherited]
 

Pointer on the gamma factors (square of the polynomials with respect to the discrete scalar product associated with the Gauss-Lobatto nodes).

Definition at line 85 of file ortho_poly.h.

const Grid* Ortho_poly::p_gauss_lobatto_nodes [mutable, protected, inherited]
 

Pointer on the Gauss-Lobatto nodes.

Definition at line 75 of file ortho_poly.h.

double* Ortho_poly::p_gauss_lobatto_weights [mutable, protected, inherited]
 

Pointer on the Gauss-Lobatto weights.

Definition at line 79 of file ortho_poly.h.

const Grid* Ortho_poly::p_gauss_nodes [mutable, protected, inherited]
 

Pointer on the Gauss nodes.

Definition at line 61 of file ortho_poly.h.

double* Ortho_poly::p_gauss_weights [mutable, protected, inherited]
 

Pointer on the Gauss weights.

Definition at line 65 of file ortho_poly.h.


The documentation for this class was generated from the following files:
Generated on Tue Dec 6 14:48:44 2011 for POLYNOM by  doxygen 1.4.6