[Top][All Lists]


Re: normalized ALF (Assotiated Legendre Function)

From: Marco Caliari
Subject: Re: normalized ALF (Assotiated Legendre Function)
Date: Tue, 12 Feb 2008 09:06:41 +0100 (CET)

I compared Matlab's script and Octave's and your proposal.

result_matlab = legendre (80, [-1:0.1:1]);

result_octave0 respects the original and result_octave1 respects your algorithm.

I calculated an error with respect to the matlab version (I'm not sure Matlab's is to be trusted as correct in all cases).

d0 = abs (result_matlab - result_octave0) / abs (result_matlab);
d1 = abs (result_matlab - result_octave1) / abs (result_matlab);
er1 = max (d1, [], 2);
er0 = max (d0, [], 2);

[er0(:), er1(:)] produces the following

Dear Ben,

the results are even more impressive if you consider that legendre0(80,[-1:0.1:1])(1,1) gives 6.7015e+14, whereas legendre1(80,[-1:0.1:1])(1,1) gives 1.

I'm inclined to agree that the recursion form should work better. I'm suspicious that Matlab's version is reliable for such high order legendre polynomials.

Anyone, is there a reliable method to verify the correct answers?

There is a LegendreP function in Maple doing exactly the same. Can you select few cases (a degree and a scalar value for x) for which the difference between Matlab and my script is quite large? I will check them with Maple.

Best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]