Is There a MATLAB Routine for Simple Legendre Polynomials of a Specific Degree?

Click For Summary
SUMMARY

The MATLAB function legendre(n,X) generates associated Legendre polynomials, but for efficiency, users requiring simple Legendre polynomials of degrees 0-299 should extract the first element of the returned array. For large iterations, such as N=2000, this can be inefficient. A recommended alternative is to refer to the Numerical Recipes book, specifically the 3rd Edition routines, which include relevant Bessel function routines, although users should be cautious of potential bugs in these routines.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of Legendre polynomials
  • Knowledge of numerical methods and routines
  • Experience with the Numerical Recipes book, particularly the 3rd Edition
NEXT STEPS
  • Research how to efficiently extract specific elements from MATLAB arrays
  • Explore the implementation of simple Legendre polynomials in MATLAB
  • Review the Bessel function routines in the Numerical Recipes 3rd Edition
  • Investigate optimization techniques for MATLAB loops
USEFUL FOR

Mathematicians, engineers, and programmers working with MATLAB who need to compute simple Legendre polynomials efficiently, especially in high-performance computing scenarios.

Somefantastik
Messages
226
Reaction score
0
I see in MATLAB that you can call legendre(n,X) and it returns the associated legendre polynomials. All I need is is the simple Legendre polynomial of degrees 0-299, which corresponds to the first element in the array that this function returns. I don't want to call this function and get this [rather large] array back every time, because I am iterating inside a double for loop. This is not so much a problem when my n=299 but I have to run this program for N=2000.

Is there a routine that anybody knows about that returns just the simple Legendre polynomial of degree n (and order m = 0)?
 
Physics news on Phys.org
The only routine that I know of that might be able to help you is in the Numerical Recipe book. I use the Bessel function routines from this book without any problems.

The website is

www.nr.com

I use the 3rd Edition routines. Be careful, these routines do contain bugs that are hard to find sometimes. In this edition the routine is located in the Spherical Bessel functions section, 6.7.

Thanks
Matt

Thanks
Matt
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K