Limits of 'legendre' function

3 visualizaciones (últimos 30 días)
mendojazzhead
mendojazzhead el 16 de Sept. de 2011
Hi all...
I have found that on my version of matlab the 'legendre' function breaks down for degree(N) N >150 and produces NAN for all orders > 150, up to N. For instance, 'legendre(152,x)' produces real values up the 151st column (corresponding to order = 150), then collapses afterward.
Is the fundamental limit of the legendre function? is there something I'm missing or do I have to use mathematica?
Somebody help!
Thanks Chris

Respuestas (1)

Walter Roberson
Walter Roberson el 16 de Sept. de 2011
At those orders, the calculations as symbolically defined involve terms that exceed the maximum real for all values of x, and the numeric value of the calculation exceed the maximum real for LegendreP(151,150,x) except within about [-359/256,359/256]. There is a local min and max at +/- 1/sqrt(151) (approximately +/- 0.08) at which points the numeric value of the calculation reaches about 1/3 of the maximum real, not quite reaching the maximum real but whose intermediate terms almost certainly would.
I do not know why the MATLAB calculations arrive at NaN in this case; unfortunately I do not have access to MATLAB this evening to investigate.
What kind of range of x are you using? And does the difference between 5.6E307 (at 1/sqrt(151)) at 1.8E308 (maximum real) impact your program significantly? Perhaps you could just replace all the NaN with inf * sign(x) ?

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by