Limits of 'legendre' function
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Walter Roberson
2011 年 9 月 16 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!