Jacobi poly

 Other toolboxes required jacobi_poly Computes the coefficients of Jacobi polynomials none Helper functions
 This is a helper function that only exists to aid other functions in QETLAB. If you are an end-user of QETLAB, you likely will never have a reason to use this function.

jacobi_poly is a function that returns a vector containing the coefficients of the specified Jacobi polynomial.

Syntax

• JP = jacobi_poly(A,B,N)

Argument descriptions

• A: A real parameter (sometimes called alpha) of the Jacobi polynomials.
• B: A real parameter (sometimes called beta) of the Jacobi polynomials.
• N: The degree of the Jacobi polynomial (a non-negative integer).

Examples

The Jacobi polynomials are typically denoted by the notation $$P^{(\alpha,\beta)}_n$$. In the $$\alpha = \beta = 1, n = 3$$ case, we have $$P^{(1,1)}_3(z) = 7z^3 - 3z$$, which we can see via the following code:

>> jacobi_poly(1,1,3)

ans =

7     0    -3     0

Source code

Click on "expand" to the right to view the MATLAB source code for this function.

1. %%  JACOBI_POLY  Computes the coefficients of Jacobi polynomials
2. %   This function has three required arguments:
3. %     A: a real parameter (sometimes called alpha) of the Jacobi polynomials
4. %     B: a real parameter (sometimes called beta) of the Jacobi polynomials
5. %     N: the degree of the Jacobi polynomial (a non-negative integer)
6. %
7. %   JP = jacobi_poly(A,B,N) is an (N+1)-vector containing the coefficients
8. %   (starting with the coefficient of the highest-order term) of the Jacobi
9. %   polynomial P_N^{A,B}.
10. %
11. %   URL: http://www.qetlab.com/jacobi_poly
12. 
13. %   requires: nothing
14. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
15. %   package: QETLAB
16. %   last updated: March 6, 2013
17. 
18. function jp = jacobi_poly(a,b,n)
19. 
20.     if(n <= 0)
21.         jp = 1;
22.     elseif(n <= 1)
23.         jp = [a+b+2, a-b]/2;
24.     else
25.         prev_jp = jacobi_poly(a,b,n-1);
26.         jp = ((2*n+a+b-1)*(a^2-b^2)*[0,prev_jp] + (2*n+a+b-1)*(2*n+a+b)*(2*n+a+b-2)*[prev_jp,0] - 2*(n+a-1)*(n+b-1)*(2*n+a+b)*[0,0,jacobi_poly(a,b,n-2)]) / (2*n*(n+a+b)*(2*n+a+b-2));
27.     end
28. end