Limits of 'legendre' function
    1 view (last 30 days)
  
       Show older comments
    
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 Comments
Answers (1)
  Walter Roberson
      
      
 on 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 Comments
See Also
Categories
				Find more on Get Started with MATLAB in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
