Limits of 'legendre' function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Walter Roberson
le 16 Sep 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) ?
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!