jacobi.h File Reference

Header file for jacobi library. More...

#include <gsl/gsl_sf_result.h>

Go to the source code of this file.

Classes

struct  jac_quadrature
 Struct used to store information and memory on the quadrature. More...

Enumerations

enum  jac_quad_type { JAC_GJ, JAC_GLJ, JAC_GRJM, JAC_GRJP }
 

Enumeration with differing types of quadrature defined in the library.

More...

Functions

int jac_jacobi_P0_e (double x, double a, double b, gsl_sf_result *result)
 Calculates the Jacobi polynomial of order 0.
int jac_jacobi_P1_e (double x, double a, double b, gsl_sf_result *result)
 Calculates the Jacobi polynomial of order 1.
int jac_jacobi_e (double x, int n, double a, double b, gsl_sf_result *result)
 Calculates the Jacobi polynomial of order n.
double jac_jacobi_P0 (double x, double a, double b)
 Calculates the Jacobi polynomial of order 0.
double jac_jacobi_P1 (double x, double a, double b)
 Calculates the Jacobi polynomial of order 1.
double jac_jacobi (double x, int n, double a, double b)
 Calculates the Jacobi polynomial of order n.
int jac_djacobi_P0_e (double x, double a, double b, gsl_sf_result *result)
 Calculates the derivative of the Jacobi polynomial of order 0.
int jac_djacobi_P1_e (double x, double a, double b, gsl_sf_result *result)
 Calculates the derivative of the Jacobi polynomial of order 1.
int jac_djacobi_e (double x, int n, double a, double b, gsl_sf_result *result)
 Calculates the derivative of the Jacobi polynomial of order n.
double jac_djacobi_P0 (double x, double a, double b)
 Calculates the derivative of the Jacobi polynomial of order 0.
double jac_djacobi_P1 (double x, double a, double b)
 Calculates the derivative of the Jacobi polynomial of order 1.
double jac_djacobi (double x, int n, double a, double b)
 Calculates the derivative of the Jacobi polynomial of order n.
int jac_jacobi_array (int np, const double *x, int n, double *result_array, double a, double b, double *ws)
 Calculates Jacobi polynomials at an array of points.
int jac_djacobi_array (int np, const double *x, int n, double *result_array, double a, double b, double *ws)
 Calculates the derivative of Jacobi polynomials at an array of points.
int jac_jacobi_zeros (double *x, int m, double alfa, double beta)
 Calculates the zeros of Jacobi polynomials in the interval -1 up to 1.
double jac_integrate (jac_quadrature *quad, double *f)
 Calculates the integral of a function with values at quadrature points given by f with quadrature weights w.
int jac_differentiate (jac_quadrature *quad, double *f, double *d)
 Calculates the derivative at quadrature points of a function f and derivative matrix D.
int jac_interpolate (jac_quadrature *quad, double *f, double *fout)
 Interpolates the function given by f using the interpolation matrix.
int jac_zeros_gj (double *z, const int Q, double alpha, double beta)
 Calculates the Gauss-Jacobi quadrature points.
int jac_weights_gj (double *z, double *w, const int Q, const double alpha, const double beta, double *ws)
 Calculates the Gauss-Jacobi quadrature weights.
int jac_diffmat_gj (double *z, double *D, const int Q, double alpha, double beta, double *ws)
 Calculates the Gauss-Jacobi Derivative matrix.
double jac_lagrange_gj (int i, double zz, int Q, double *z, double alpha, double beta)
 Calculates the Lagrange polynomials through Gauss-Jacobi Quadratures.
int jac_zeros_glj (double *z, const int Q, double alpha, double beta)
 Calculates the Gauss-Lobatto-Jacobi quadrature points.
int jac_weights_glj (double *z, double *w, const int Q, double alpha, double beta, double *ws1)
 Calculates the Gauss-Lobatto-Jacobi quadrature weights.
int jac_diffmat_glj (double *z, double *D, const int Q, double alpha, double beta, double *ws)
 Calculates the Gauss-Lobatto-Jacobi Derivative matrix.
double jac_lagrange_glj (int i, double zz, int Q, double *z, double alpha, double beta)
 Calculates the Lagrange polynomials through Gauss-Lobatto-Jacobi Quadratures.
int jac_zeros_grjm (double *z, const int Q, double alpha, double beta)
 Calculates the Gauss-Radau-Jacobi quadrature points (point -1 included).
int jac_weights_grjm (double *z, double *w, const int Q, double alpha, double beta, double *ws)
 Calculates the Gauss-Radau-Jacobi quadrature weights (point -1 included).
int jac_diffmat_grjm (double *z, double *D, const int Q, double alpha, double beta, double *ws)
 Calculates the Gauss-Radau-Jacobi Derivative matrix (point -1 included).
double jac_lagrange_grjm (int i, double zz, int Q, double *z, double alpha, double beta)
 Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point -1 included).
int jac_zeros_grjp (double *z, const int Q, double alpha, double beta)
 Calculates the Gauss-Radau-Jacobi quadrature points (point +1 included).
int jac_weights_grjp (double *z, double *w, const int Q, double alpha, double beta, double *ws)
 Calculates the Gauss-Radau-Jacobi quadrature weights (point +1 included).
int jac_diffmat_grjp (double *z, double *D, const int Q, double alpha, double beta, double *ws)
 Calculates the Gauss-Radau-Jacobi Derivative matrix (point +1 included).
double jac_lagrange_grjp (int i, double zz, int Q, double *z, double alpha, double beta)
 Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point +1 included).
int jac_interpmat_gj (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta)
 Calculates the interpolation matrix for GJ quadrature.
int jac_interpmat_glj (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta)
 Calculates the interpolation matrix for GLJ quadrature.
int jac_interpmat_grjm (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta)
 Calculates the interpolation matrix for GRJM quadrature.
int jac_interpmat_grjp (double *imat, double *zp, int np, double *z, int Q, double alpha, double beta)
 Calculates the interpolation matrix for GRJP quadrature.
jac_quadrature * jac_quadrature_alloc (int nq)
 Allocates the jac_quadrature data structure to be used later.
int jac_quadrature_zwd (jac_quadrature *quad, enum jac_quad_type qtype, double a, double b, double *ws)
 Calculates the quadrature zeros, weights and derivative matrix.
void jac_quadrature_free (jac_quadrature *quad)
 Reclaims memory allocated by jac_quadrature_alloc.
int jac_interpmat_alloc (jac_quadrature *quad, int npoints, double *xp)
 Allocates memory to an interpolation matrix.
void jac_interpmat_free (jac_quadrature *quad)
 Reclaims memory allocated by the jac_interpmat_alloc.

Detailed Description

Header file for jacobi library.

The jacobi library implements Jacobi polynomials and Gauss-Jacobi quadrature related functions. This library was developed to be used in high order finite element methods (Spectral Element/hp methods. The interfaces were inspired by the software Polylib (http://www.nektar.info).

The main sources used to develop this library where:

(1) Abramowitz, Milton and Stegun, Irene (editors); "Handbook of Mathematical functions", Dover Publications 1965.

(2) Karniadakis, George Em and Sherwin, Spencer; "Spectral/hp Element Methods for Computational Fluid Dynamics", Oxford Science Publications, 2nd edition, 2005.

This software is supposed to be an add-on module for the GNU Scientific Library


Enumeration Type Documentation

Enumeration with differing types of quadrature defined in the library.

The jac_quad_type is used to determine the type of quadrature that is being used.

Enumerator:
JAC_GJ 

Gauss-Jacobi quadrature.

JAC_GLJ 

Gauss-Lobatto-Jacobi quadrature.

JAC_GRJM 

Gauss-Radau-Jacobi quadrature including the node -1.

JAC_GRJP 

Gauss-Radau-Jacobi quadrature including the node +1.


Function Documentation

int jac_differentiate ( jac_quadrature *  quad,
double *  f,
double *  d 
)

Calculates the derivative at quadrature points of a function f and derivative matrix D.

Calculates the derivative of a function known at quadrature points given the derivative matrix The derivative matrix should have been calculated before using one of the functions jac_**_diffmat.

The derivative is calculated according to the following equation:

\[ \left.\frac{du(x)}{dx}\right|_{x=x_i} = \sum_{j=0}^{Q-1} D_{ij} u(x_j) \]

In this equation,

\[ D_{ij} = \left.\frac{dh_j(x)}{dx}\right|_{x=x_i} \]

where $h_j(x)$ is the Lagrange polynomial through the jth quadrature node

Parameters:
quad A structure containing quadrature information
f Value of function at quadrature points
d The Estimated derivative at quadrature points:
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_quadrature::D, and jac_quadrature::Q.

int jac_diffmat_gj ( double *  z,
double *  D,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Jacobi Derivative matrix.

Calculates the derivative matrix for Gauss-Jacobi quadrature. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates

\[ D[j+iQ] = \left.\frac{dh_j(x)}{dx}\right|_{x=x_i} \]

Parameters:
z Quadrature nodes.
D Derivative matrix, a vector with Q*Q doubles
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with at least 3*Q doubles. If it is null, the memory will be allocated with malloc and at the end released.
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code define in gsl_errno.h

References jac_djacobi_array().

Referenced by jac_quadrature_zwd().

int jac_diffmat_glj ( double *  z,
double *  D,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Lobatto-Jacobi Derivative matrix.

Calculates the derivative matrix for Gauss-Lobatto-Jacobi quadrature. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates

\[ D[j+iQ] = \left.\frac{dh_j(x)}{dx}\right|_{x=x_i} \]

Parameters:
z Quadrature nodes
D Derivative matrix, a vector with Q*Q doubles
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with 3*Q doubles. If it is null, the memory will be allocated with malloc
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_djacobi_array().

Referenced by jac_quadrature_zwd().

int jac_diffmat_grjm ( double *  z,
double *  D,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Radau-Jacobi Derivative matrix (point -1 included).

Calculates the derivative matrix for Gauss-Radau-Jacobi quadrature including the end point -1. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates

\[ D[j+iQ] = \left.\frac{dh_j(x)}{dx}\right|_{x=x_i} \]

Parameters:
z Quadrature nodes
D Derivative matrix, a vector with Q*Q doubles
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with 3*Q doubles. If it is null, the memory will be allocated with malloc
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_djacobi_array().

Referenced by jac_quadrature_zwd().

int jac_diffmat_grjp ( double *  z,
double *  D,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Radau-Jacobi Derivative matrix (point +1 included).

Calculates the derivative matrix for Gauss-Radau-Jacobi quadrature including the end point +1. The matrix should be preallocated, using a vector with Q*Q doubles This function calculates

\[ D[j+iQ] = \left.\frac{dh_j(x)}{dx}\right|_{x=x_i} \]

Parameters:
z Quadrature nodes
D Derivative matrix, a vector with Q*Q doubles
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with 3*Q doubles. If it is null, the memory will be allocated with malloc
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_djacobi_array().

Referenced by jac_quadrature_zwd().

double jac_djacobi ( double  x,
int  n,
double  a,
double  b 
)

Calculates the derivative of the Jacobi polynomial of order n.

Explicit calculation of the derivative of the nth order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
n The order of the polynomial
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
Returns:
The calculated value of the Jacobi polynomial

References jac_jacobi().

Referenced by jac_jacobi_zeros(), jac_lagrange_gj(), jac_lagrange_glj(), jac_lagrange_grjm(), and jac_lagrange_grjp().

int jac_djacobi_array ( int  np,
const double *  x,
int  n,
double *  result_array,
double  a,
double  b,
double *  ws 
)

Calculates the derivative of Jacobi polynomials at an array of points.

Calculates the derivative of the nth order Jacobi polynomial at an array of np points given by the vector x. This function needs two workspaces of size np to do its calculation. If the first one (ws1) is NULL, the function will allocate the necessary memory (using malloc) to do the calculation

Parameters:
np Number of points where the polynomial will be calculated
x A vector of length np containing the points where the polynomials should be calculated. $-1\le x_i \le 1$.
n Order of the Jacobi polynomial whose derivative should be calculated
result_array An array of length np where the result will be stored
a $\alpha$ parameter of Jacobi polynomial
b $\beta$ parameter of Jacobi polynomial
ws A pointer to a block of memory 2*np doubles long to be used as workspace. If it is NULL, memory will be allocated using malloc and released at the end
Returns:
Error code defined in gsl_errno.h or GSL_SUCCESS if everything was fine

References jac_jacobi_array().

Referenced by jac_diffmat_gj(), jac_diffmat_glj(), jac_diffmat_grjm(), jac_diffmat_grjp(), and jac_weights_gj().

int jac_djacobi_e ( double  x,
int  n,
double  a,
double  b,
gsl_sf_result *  result 
)

Calculates the derivative of the Jacobi polynomial of order n.

Calculates the derivative of the nth order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
n Integer specifying the order of the polynomial
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
result A pointer to a gsl_sf_result structure where the result and estimated error is stored
Returns:
GSL_SUCCESS if successful

References jac_jacobi_e().

double jac_djacobi_P0 ( double  x,
double  a,
double  b 
)

Calculates the derivative of the Jacobi polynomial of order 0.

Explicit calculation of the derivative of the 0th order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
Returns:
The calculated value of the Jacobi polynomial
int jac_djacobi_P0_e ( double  x,
double  a,
double  b,
gsl_sf_result *  result 
)

Calculates the derivative of the Jacobi polynomial of order 0.

Calculates the derivative of the 0th order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
result A pointer to a gsl_sf_result structure where the result and estimated error is stored
Returns:
GSL_SUCCESS if successful
double jac_djacobi_P1 ( double  x,
double  a,
double  b 
)

Calculates the derivative of the Jacobi polynomial of order 1.

Explicit calculation of the derivative of the 1st order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
Returns:
The calculated value of the Jacobi polynomial
int jac_djacobi_P1_e ( double  x,
double  a,
double  b,
gsl_sf_result *  result 
)

Calculates the derivative of the Jacobi polynomial of order 1.

Calculates the derivative of the 1st order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
result A pointer to a gsl_sf_result structure where the result and estimated error is stored
Returns:
GSL_SUCCESS if successful
double jac_integrate ( jac_quadrature *  quad,
double *  f 
)

Calculates the integral of a function with values at quadrature points given by f with quadrature weights w.

Aproximates the integral of a function using a a quadrature.

\[ \int_{-1}^1 f(x) dx \approx \sum_{i=0}^{Q-1} w_i f(x_i) \]

Where $x_i$ and $w_i$ are given by the quadrature method emplyed.

Parameters:
quad A structure containing quadrature information
f Value of function at quadrature points
Returns:
$\int_{-1}^{1} f(x) dx \approx \sum_{i=0}^{Q-1} w_i f(x_i)$

References jac_quadrature::Q, and jac_quadrature::w.

int jac_interpmat_alloc ( jac_quadrature *  quad,
int  npoints,
double *  xp 
)

Allocates memory to an interpolation matrix.

Allocates memory for interpolation matrix for a jac_quadrature structure. It also copies the interpolation points.

Parameters:
quad A previously allocated jac_quadrature structure
npoints Number of interpolation points
xp Interpolation points
Returns:
Error code or GSL_SUCCESS

References jac_quadrature::alpha, jac_quadrature::beta, jac_quadrature::Imat, JAC_GJ, JAC_GLJ, JAC_GRJM, JAC_GRJP, jac_interpmat_gj(), jac_interpmat_glj(), jac_interpmat_grjm(), jac_interpmat_grjp(), jac_quadrature::np, jac_quadrature::Q, jac_quadrature::type, jac_quadrature::x, and jac_quadrature::xp.

void jac_interpmat_free ( jac_quadrature *  quad  ) 

Reclaims memory allocated by the jac_interpmat_alloc.

Frees memory used by jac_ionterpmat_alloc

Parameters:
quad An allocated jac_quadrature structure.

References jac_quadrature::Imat, jac_quadrature::np, and jac_quadrature::xp.

int jac_interpmat_gj ( double *  imat,
double *  zp,
int  np,
double *  z,
int  Q,
double  alpha,
double  beta 
)

Calculates the interpolation matrix for GJ quadrature.

This function calculates the interpolation matrix for Gauss-Jacobi quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:

\[ I_{ij} = I[iQ+j] = h_j(x_i) \]

Parameters:
imat A vector np*Q long that will store the interpolation matrix
zp The points where the function should be interpolated
np Number of points where the function should be interpolated
z Quadrature points
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_lagrange_gj().

Referenced by jac_interpmat_alloc().

int jac_interpmat_glj ( double *  imat,
double *  zp,
int  np,
double *  z,
int  Q,
double  alpha,
double  beta 
)

Calculates the interpolation matrix for GLJ quadrature.

This function calculates the interpolation matrix for Gauss-Lobatto-Jacobi quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:

\[ I_{ij} = I[iQ+j] = h_j(x_i) \]

Parameters:
imat A vector np*Q long that will store the interpolation matrix
zp The points where the function should be interpolated
np Number of points where the function should be interpolated
z Quadrature points
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_lagrange_glj().

Referenced by jac_interpmat_alloc().

int jac_interpmat_grjm ( double *  imat,
double *  zp,
int  np,
double *  z,
int  Q,
double  alpha,
double  beta 
)

Calculates the interpolation matrix for GRJM quadrature.

This function calculates the interpolation matrix for Gauss-Radau-Jacobi (including end point -1) quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:

\[ I_{ij} = I[iQ+j] = h_j(x_i) \]

Parameters:
imat A vector np*Q long that will store the interpolation matrix
zp The points where the function should be interpolated
np Number of points where the function should be interpolated
z Quadrature points
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_lagrange_grjm().

Referenced by jac_interpmat_alloc().

int jac_interpmat_grjp ( double *  imat,
double *  zp,
int  np,
double *  z,
int  Q,
double  alpha,
double  beta 
)

Calculates the interpolation matrix for GRJP quadrature.

This function calculates the interpolation matrix for Gauss-Radau-Jacobi (including end point +1) quadrature. The interpolation matrix is simply the value of the Lagrange polynomials for each point where the function should be interpolated, for each Lagrange polynomial:

\[ I_{ij} = I[iQ+j] = h_j(x_i) \]

Parameters:
imat A vector np*Q long that will store the interpolation matrix
zp The points where the function should be interpolated
np Number of points where the function should be interpolated
z Quadrature points
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_lagrange_grjp().

Referenced by jac_interpmat_alloc().

int jac_interpolate ( jac_quadrature *  quad,
double *  f,
double *  fout 
)

Interpolates the function given by f using the interpolation matrix.

Interpolates a function given at quadrature points using the interpolation matrix. The interpolation matrix is given by the following equation:

\[ I_{ij} = h_j(x_i) \]

where $x_i$ are the points where the function should be interpolated. With this matrix, the interpolation consists of the following operation:

\[ f^{interpolated}(x_i) = \sum_{j=0}^{Q-1} f_j h_j(x_i) \]

Parameters:
quad Quadrature information (including interpolation matrix)
f Value of function at quadrature points
fout Interpolated values
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_quadrature::Imat, jac_quadrature::np, and jac_quadrature::Q.

double jac_jacobi ( double  x,
int  n,
double  a,
double  b 
)

Calculates the Jacobi polynomial of order n.

Explicit calculation of the nth order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
n An integer specifying the order of the polynomial
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
Returns:
The calculated value of the Jacobi polynomial

Referenced by jac_djacobi(), jac_jacobi_zeros(), jac_lagrange_gj(), jac_lagrange_glj(), jac_lagrange_grjm(), and jac_lagrange_grjp().

int jac_jacobi_array ( int  np,
const double *  x,
int  n,
double *  result_array,
double  a,
double  b,
double *  ws 
)

Calculates Jacobi polynomials at an array of points.

Calculates the nth order Jacobi polynomials at an array of np points given by the vector x. This function needs two workspaces of size np to do its calculation. If the first one (ws1) is NULL, the function will allocate the necessary memory (using malloc) to do the calculation

Parameters:
np Number of points where the polynomial will be calculated
x A vector of length np containing the points where the polynomials should be calculated. $-1\le x_i \le 1$.
n Order of Jacobi polynomial to be calculated
result_array An array of length np where the result will be stored
a $\alpha$ parameter of Jacobi polynomial
b $\beta$ parameter of Jacobi polynomial
ws A pointer to a block of memory at least 2*np doubles long to be used as workspace. If it is NULL, memory will be allocated using malloc and released at the end
Returns:
Error code defined in gsl_errno.h or GSL_SUCCESS if everything was fine

Referenced by jac_djacobi_array(), jac_weights_glj(), jac_weights_grjm(), and jac_weights_grjp().

int jac_jacobi_e ( double  x,
int  n,
double  a,
double  b,
gsl_sf_result *  result 
)

Calculates the Jacobi polynomial of order n.

Calculates the nth order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
n An integer specifying the order of the polynomial
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
result A pointer to a gsl_sf_result structure where the result and estimated error is stored
Returns:
GSL_SUCCESS if successful

Referenced by jac_djacobi_e().

double jac_jacobi_P0 ( double  x,
double  a,
double  b 
)

Calculates the Jacobi polynomial of order 0.

Explicit calculation of the 0th order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
Returns:
The calculated value of the Jacobi polynomial
int jac_jacobi_P0_e ( double  x,
double  a,
double  b,
gsl_sf_result *  result 
)

Calculates the Jacobi polynomial of order 0.

Calculates the 0th order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
result A pointer to a gsl_sf_result structure where the result and estimated error is stored
Returns:
GSL_SUCCESS if successful
double jac_jacobi_P1 ( double  x,
double  a,
double  b 
)

Calculates the Jacobi polynomial of order 1.

Explicit calculation of the 1st order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
Returns:
The calculated value of the Jacobi polynomial
int jac_jacobi_P1_e ( double  x,
double  a,
double  b,
gsl_sf_result *  result 
)

Calculates the Jacobi polynomial of order 1.

Calculates the 1st order Jacobi polynomial

Parameters:
x The point where the function should be calculated. $-1\le x \le 1$
a $\alpha$ parameter of the Jacobi Polynomial
b $\beta$ parameter of the Jacobi Polynomial
result A pointer to a gsl_sf_result structure where the result and estimated error is stored
Returns:
GSL_SUCCESS if successful
int jac_jacobi_zeros ( double *  x,
int  m,
double  alpha,
double  beta 
)

Calculates the zeros of Jacobi polynomials in the interval -1 up to 1.

This function uses an iteration technique to calculate the zeros of a Jacobi polynomial:

\[ P_m^{\alpha,\beta}(x_i) = 0 \]

The algorithm was adapted from the book by Karniadakis and Sherwin. It uses as an initial guess the zeros of Chebyshev polynomials.

Parameters:
x Pointer to an array where the zeros of the Jacobi polynomial should be stored
m Order of the polynomial
alpha $\alpha$ parameter of the Jacobi polynomial
beta $\beta$ parameter of the Jacobi polynomial

References EPS, jac_djacobi(), and jac_jacobi().

Referenced by jac_zeros_gj(), jac_zeros_glj(), jac_zeros_grjm(), and jac_zeros_grjp().

double jac_lagrange_gj ( int  i,
double  zz,
int  Q,
double *  z,
double  alpha,
double  beta 
)

Calculates the Lagrange polynomials through Gauss-Jacobi Quadratures.

This function calculates the ith Gauss-Jacobi lagrange interpolants at a point zz:

\[ h_i(zz) \]

Parameters:
i The reference node of the Lagrange polynomial
zz The point where the Lagrange polynomial should be calculated
Q Number of quadrature nodes
z The quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
The value of the ith Lagrange polynomial at zz

References EPS, jac_djacobi(), and jac_jacobi().

Referenced by jac_interpmat_gj().

double jac_lagrange_glj ( int  i,
double  zz,
int  Q,
double *  z,
double  alpha,
double  beta 
)

Calculates the Lagrange polynomials through Gauss-Lobatto-Jacobi Quadratures.

This function calculates the ith Gauss-Lobatto-Jacobi lagrange interpolants at a point zz:

\[ h_i(zz) \]

Parameters:
i The reference node of the Lagrange polynomial
zz The point where the Lagrange polynomial should be calculated
Q Number of quadrature nodes
z The quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
The value of the ith Lagrange polynomial at zz

References EPS, jac_djacobi(), and jac_jacobi().

Referenced by jac_interpmat_glj().

double jac_lagrange_grjm ( int  i,
double  zz,
int  Q,
double *  z,
double  alpha,
double  beta 
)

Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point -1 included).

This function calculates the ith Gauss-Radau-Jacobi (including end point -1) Lagrange interpolants at a point zz:

\[ h_i(zz) \]

Parameters:
i The reference node of the Lagrange polynomial
zz The point where the Lagrange polynomial should be calculated
Q Number of quadrature nodes
z The quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
The value of the ith Lagrange polynomial at zz

References EPS, jac_djacobi(), and jac_jacobi().

Referenced by jac_interpmat_grjm().

double jac_lagrange_grjp ( int  i,
double  zz,
int  Q,
double *  z,
double  alpha,
double  beta 
)

Calculates the Lagrange polynomials through Gauss-Radau-Jacobi Quadratures (point +1 included).

This function calculates the ith Gauss-Radau-Jacobi (including end point +1) Lagrange interpolants at a point zz:

\[ h_i(zz) \]

Parameters:
i The reference node of the Lagrange polynomial
zz The point where the Lagrange polynomial should be calculated
Q Number of quadrature nodes
z The quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
The value of the ith Lagrange polynomial at zz

References EPS, jac_djacobi(), and jac_jacobi().

Referenced by jac_interpmat_grjp().

jac_quadrature* jac_quadrature_alloc ( int  nq  ) 

Allocates the jac_quadrature data structure to be used later.

Allocates memory for a jac_quadrature structure.

Parameters:
qtype Quadrature type
nq Number of quadrature nodes
a Alpha weight
b Beta weight
Returns:
A pointer to newly created jac_quadrature structure. NULL if some problem occurred

References jac_quadrature::D, jac_quadrature::Imat, jac_quadrature::np, jac_quadrature::Q, jac_quadrature::w, jac_quadrature::x, and jac_quadrature::xp.

void jac_quadrature_free ( jac_quadrature *  quad  ) 

Reclaims memory allocated by jac_quadrature_alloc.

Releases memory allocated by jac_quadrature_alloc. It also releases memory allocated by the jac_interpmat_alloc if necessary

Parameters:
quad A jac_quadrature structure allocated with jac_quadrature_alloc
int jac_quadrature_zwd ( jac_quadrature *  quad,
enum jac_quad_type  qtype,
double  a,
double  b,
double *  ws 
)

Calculates the quadrature zeros, weights and derivative matrix.

This function calculates the quadrature nodes weights and derivative matrix and stores the data on a previously allocated jac_quadrature structure.

Parameters:
quad A previously allocated jac_quadrature structure
qtype Quadrature type
a Alpha weight
b Beta weight
ws Workspace 3*quad->Q long used in calculations. If it is null, memory is allocated and at the end released
Returns:
AN error code or GSL_SUCCESS

References jac_quadrature::alpha, jac_quadrature::beta, jac_quadrature::D, jac_diffmat_gj(), jac_diffmat_glj(), jac_diffmat_grjm(), jac_diffmat_grjp(), JAC_GJ, JAC_GLJ, JAC_GRJM, JAC_GRJP, jac_weights_gj(), jac_weights_glj(), jac_weights_grjm(), jac_weights_grjp(), jac_zeros_gj(), jac_zeros_glj(), jac_zeros_grjm(), jac_zeros_grjp(), jac_quadrature::Q, jac_quadrature::type, jac_quadrature::w, and jac_quadrature::x.

int jac_weights_gj ( double *  z,
double *  w,
const int  Q,
const double  alpha,
const double  beta,
double *  ws 
)

Calculates the Gauss-Jacobi quadrature weights.

Calculates the Quadrature weights for Gauss-Jacobi integration.

Parameters:
z Quadrature nodes
w Array containing the quadrature weights
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with room for 2*Q doubles. If it is null, the memory will be allocated with malloc and at the end released
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code defined in gsl_errno.h

References jac_djacobi_array().

Referenced by GaussJacobiRule(), and jac_quadrature_zwd().

int jac_weights_glj ( double *  z,
double *  w,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Lobatto-Jacobi quadrature weights.

Calculates the Quadrature weights for Gauss-Lobatto-Jacobi integration.

Parameters:
z Quadrature nodes
w Array containing the quadrature weights
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with 2*Q doubles. If it is null, the memory will be allocated with malloc
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_array().

Referenced by jac_quadrature_zwd().

int jac_weights_grjm ( double *  z,
double *  w,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Radau-Jacobi quadrature weights (point -1 included).

Calculates the Quadrature weights for Gauss-Radau-Jacobi quadrature including point -1

Parameters:
z Quadrature nodes
w Array containing the quadrature weights
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with 2*Q doubles. If it is null, the memory will be allocated with malloc and at the ens released
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_array().

Referenced by jac_quadrature_zwd().

int jac_weights_grjp ( double *  z,
double *  w,
const int  Q,
double  alpha,
double  beta,
double *  ws 
)

Calculates the Gauss-Radau-Jacobi quadrature weights (point +1 included).

Calculates the Quadrature weights for Gauss-Radau-Jacobi quadrature including point +1

Parameters:
z Quadrature nodes
w Array containing the quadrature weights
Q Number of quadrature nodes
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
ws Workspace with 2*Q doubles. If it is null, the memory will be allocated with malloc
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_array().

Referenced by jac_quadrature_zwd().

int jac_zeros_gj ( double *  z,
const int  Q,
double  alpha,
double  beta 
)

Calculates the Gauss-Jacobi quadrature points.

Finds the zeros of Gauss-Jacobi quadrature

It computes the following equation

\[ P^{\alpha, \beta}_Q(x_i) = 0 \]

Parameters:
z A double pointer to an array used to store the values of the zeros
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_zeros().

Referenced by GaussJacobiRule(), and jac_quadrature_zwd().

int jac_zeros_glj ( double *  z,
const int  Q,
double  alpha,
double  beta 
)

Calculates the Gauss-Lobatto-Jacobi quadrature points.

Finds the zeros of Gauss-Lobatto-Jacobi quadrature

This quadrature includes the endpoints (-1, 1). The other quadrature nodes are given by the zeros of

\[ P^{\alpha+1, \beta+1}_{Q-2}(x_i) = 0 \]

Parameters:
z A double pointer to an array used to store the values of the zeros
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_zeros().

Referenced by jac_quadrature_zwd().

int jac_zeros_grjm ( double *  z,
const int  Q,
double  alpha,
double  beta 
)

Calculates the Gauss-Radau-Jacobi quadrature points (point -1 included).

Finds the zeros of Gauss-Radau-Jacobi quadrature

This quadrature includes the endpoint -1. The other quadrature nodes are given by the zeros of

\[ P^{\alpha, \beta+1}_{Q-1}(x_i) = 0 \]

Parameters:
z A double pointer to an array used to store the values of the zeros
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_zeros().

Referenced by jac_quadrature_zwd().

int jac_zeros_grjp ( double *  z,
const int  Q,
double  alpha,
double  beta 
)

Calculates the Gauss-Radau-Jacobi quadrature points (point +1 included).

Finds the zeros of Gauss-Radau-Jacobi quadrature

This quadrature includes the endpoint 1. The other quadrature nodes are given by the zeros of

\[ P^{\alpha+1, \beta}_{Q-1}(x_i) = 0 \]

Parameters:
z A double pointer to an array used to store the values of the zeros
Q Number of quadrature points
alpha $\alpha$ parameter of Jacobi polynomial
beta $\beta$ parameter of Jacobi polynomial
Returns:
GSL_SUCCESS if everything was ok. Otherwise return an error code

References jac_jacobi_zeros().

Referenced by jac_quadrature_zwd().

Generated on Mon Oct 8 18:26:44 2012 for nanomagnFMM by  doxygen 1.6.3