Re: errors in 3.0(beta) and 2.2
- To: mathgroup at smc.vnet.net
- Subject: [mg5623] Re: [mg5604] errors in 3.0(beta) and 2.2
- From: Sherman Reed <Sherman.Reed at worldnet.att.net>
- Date: Wed, 1 Jan 1997 21:04:53 -0500
- Sender: owner-wri-mathgroup at wolfram.com
At 06:59 AM 12/27/96 +0000, you wrote: >(* It is very easy to get completely wrong results >in both 2.2 and 3.0(beta) using one line examples.=20 >The following example concerns LegendreP[10,10,x]=20 >in 2.2 on a Mac, but I got similar results with >3.0(beta). I noticed the errors when using Plot[] >with LegendreP[10,10,Cos[t*Degree]] > I would appreciate comments, workarounds etc.=20 >Does the released version of 3.0 have these errors? > >$Version >Macintosh 2.2 (May 4, 1993) > >(* Notice LegendreP[10,10,x] is a simple polynomial=20 >of degree 10 *) > >LegendreP[10,10,x] > 2 4 6 8 10 >654729075 (1 - 5 x + 10 x - 10 x + 5 x - x ) > >(*The following two results look reasonable *) >LegendreP[10,10,Cos[179*Degree]]//N > -9 >2.27155 10 >LegendreP[10,10,Cos[t*Degree]]/.t->179.0//N > -9 >2.27155 10 > >(* The next result is wrong *) >LegendreP[10,10,Cos[179.0*Degree]]//N > 8 >1.02775 10 > >(* All the following results are wrong *) >LegendreP[10,10,Cos[179.9999*Degree]]//N > 48 >-2.68317 10 >LegendreP[10,10,Cos[179.99999*Degree]]//N > 51 >4.88061 10 >LegendreP[10,10,Cos[179.999999*Degree]]//N > 57 >4.87838 10 >LegendreP[10,10,Cos[t*Degree]]/.t->179.999999//N >0 > > Jonathan I got different but clearly erroneous answers using 3.0 on Win 95. I have included a workaround that I put together after looking at the form of LegendreP[10,10,x]. It appears that my answers are consistent. I also plotted the function around Pi and found that the granularity is similar to the answers I got with my approximation. Looks like someone did the coding that did not appreciate how errors can propagate and/or a serious error exists in the coding. LegendreP[10,10,x](* 3.0 view *) \!\(\(-654729075\)\=20 \((\(-1\) + 5\ x\^2 - 10\ x\^4 + 10\ x\^6 - 5\ x\^8 + x\^10)\)\) reed[x_]:=3D-654729075*(-1+x^2*(5+x^2*(-10+x^2* (10+x^2*(-5+x^2)))))(* s.c.reed view *) LegendreP[10,10,Cos[179*Degree]]//N \!\(\(-2.18068588186959289`*^-7\)\) reed[Cos[179*Degree]]//N \!\(\(-2.90758117582612385`*^-7\)\) LegendreP[10,10,Cos[t*Degree]]/.t->179.0//N -2.18069=D710\^-7 reed[Cos[t*Degree]]/.t->179.0//N -2.90758=D710\^-7 LegendreP[10,10,Cos[179.0*Degree]]//N 1.31519=D710\^11 reed[Cos[179.0*Degree]]//N -2.90758=D710\^-7 LegendreP[10,10,Cos[179.9999*Degree]]//N 7.8638=D710\^50 reed[Cos[179.9999*Degree]]//N 4.36137=D710\^-7 LegendreP[10,10,Cos[179.99999*Degree]]//N -7.91843=D710\^60 reed[Cos[179.99999*Degree]]//N 1.45379=D710\^-7 LegendreP[10,10,Cos[179.999999*Degree]]//N 1.91079=D710\^72 reed[Cos[179.999999*Degree]]//N 1.45379=D710\^-7 Hope this helps. Sherman C. Reed