Calculation of Jacobi Polynomials. More...
#include <stdlib.h>#include <gsl/gsl_math.h>#include <gsl/gsl_errno.h>#include "jacobi.h"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 alpha, double beta) |
| Calculates the zeros of Jacobi polynomials in the interval -1 up to 1. | |
Calculation of Jacobi Polynomials.
This file implements the function that calculates Jacobi polynomials and its derivatives. It tries to follow the interfaces used in the GNU Scientific library. The estimated errors Have not been implemented yet.
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.
The Jacobi polynomials of order n are defined as follows
The calculation uses the recursive definition of the Jacobi polynomial:
In this function,
is the point where the function is to be calculated, n is the order of the polynomial and
are coefficients given by
There is also a recursive definition of the derivative of Jacobi polynomials but in this library, the derivatives of Jacobi polynomials will be defined in terms of Jacobi polynomials:
Chebychev polynomials are a special case of Jacobi polynomials with
:
Since the Zeros of Chebychev are explicitly known, an iteration using these zeros as initial guess is used to calculate zeros of generic Jacobi polynomials.
| 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
| x | The point where the function should be calculated. | |
| n | The order of the polynomial | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter 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
| 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. . | |
| 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 | parameter of Jacobi polynomial | |
| b | 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 |
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
| x | The point where the function should be calculated. | |
| n | Integer specifying the order of the polynomial | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter of the Jacobi Polynomial | |
| result | A pointer to a gsl_sf_result structure where the result and estimated error is stored |
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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter 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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter of the Jacobi Polynomial | |
| result | A pointer to a gsl_sf_result structure where the result and estimated error is stored |
| 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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter 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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter of the Jacobi Polynomial | |
| result | A pointer to a gsl_sf_result structure where the result and estimated error is stored |
| 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
| x | The point where the function should be calculated. | |
| n | An integer specifying the order of the polynomial | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter 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
| 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. . | |
| n | Order of Jacobi polynomial to be calculated | |
| result_array | An array of length np where the result will be stored | |
| a | parameter of Jacobi polynomial | |
| b | 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 |
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
| x | The point where the function should be calculated. | |
| n | An integer specifying the order of the polynomial | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter of the Jacobi Polynomial | |
| result | A pointer to a gsl_sf_result structure where the result and estimated error is stored |
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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter 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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter of the Jacobi Polynomial | |
| result | A pointer to a gsl_sf_result structure where the result and estimated error is stored |
| 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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter 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
| x | The point where the function should be calculated. | |
| a | parameter of the Jacobi Polynomial | |
| b | parameter of the Jacobi Polynomial | |
| result | A pointer to a gsl_sf_result structure where the result and estimated error is stored |
| 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:
The algorithm was adapted from the book by Karniadakis and Sherwin. It uses as an initial guess the zeros of Chebyshev polynomials.
| x | Pointer to an array where the zeros of the Jacobi polynomial should be stored | |
| m | Order of the polynomial | |
| alpha | parameter of the Jacobi polynomial | |
| 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().
1.6.3