Re: LegendreP (Symbolic) is different in Mathematica5 than previous versions (M4, M3 ..)

*To*: mathgroup at smc.vnet.net*Subject*: [mg51486] Re: [mg51413] LegendreP (Symbolic) is different in Mathematica5 than previous versions (M4, M3 ..)*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Tue, 19 Oct 2004 02:56:13 -0400 (EDT)*References*: <200410160820.EAA23725@smc.vnet.net> <DCE69724-1F76-11D9-9EF0-000A95B4967A@mimuw.edu.pl> <004e01c4b516$ed91f490$e06c4ed5@lap5100> <592F464E-210F-11D9-9ED7-000A95B4967A@mimuw.edu.pl>*Sender*: owner-wri-mathgroup at wolfram.com

On 18 Oct 2004, at 23:09, Andrzej Kozlowski wrote: > > On 18 Oct 2004, at 22:32, Peter S Aptaker wrote: > >> Thanks. As with much or most use of LegendreP the argument mu is >> real. > > Since LegendreP is a polynomial this is not an issue. If two > polynomials are equal for all real values of the argument they have to > be also equal for all complex values. I got confused here. I forgot that the problem is with the associated Legendre functions and not with the Legendre polynomial itself. For two such functions it is of course possible to be equal in an open set of the complex plane without necessarily being equal everywhere. This appears to be the case here. The two expressions for the associated Legendre function returned by Mathematica version 4 and 5 are equal in the unit disk, although Mathematica seems unable to prove it. Mathematica can show that a[mu_] := -Sqrt[1 - mu^2]; b[mu_] := Sqrt[(-1 - mu)/(-1 + mu)]*(-1 + mu); Simplify[a[z]-b[z], -1<z<1] 0 but not FullSimplify[a[z] - b[z], Abs[z] < 1] (1/Sqrt[1/(1 - z)] - Sqrt[1 - z])*Sqrt[1 + z] This is not really surprising since the methods used by FullSimplify are essentially algebraic but this problem requires analytic ones. As for using PowerExpand, I am not at the moment sure if using it is legitimate in this situation, however, the function a[z]-b[z] is clearly analytic in the unit disk and its Taylor expansion at 0 is identically 0 (again, Mathematica can't itself prove it it can verify that e.g. a[z] - b[z] + O[z]^5 SeriesData[z, 0, {}, 5, 5, 1] so indeed it has to be identically 0 there. So indeed, it seems you were originally right and Mathematica is using a different definition of the associated Legendre functions, which agrees with the standard one (as given int he help browser) in the unit disk. You can of course use your own definition as in my first posting, but you may possibly run into the problem that originally caused the change in the evaluation method to be made. Andrzej Kozlowski > >> My >> point and concern is in the Subject: >> >> "LegendreP (Symbolic) is different in Mathematica5 than previous >> versions >> (M4, M3 ..)" >> >> Your comment means taht the M5 result is not simply 'a different >> form' but 'the wrong >> answer'? > > It seems so. Note that if you simply define your own associated > Legendre function using the definition given in Mathematica's help: > > > P[n_, m_, x_] := (-1)^m*(1 - x^2)^(m/2)*D[LegendreP[n, x], x] > > then > > P[1, 1, x] > > -Sqrt[1 - x^2] > > which is the answer v, 4 gives. So it seems that there is a bug in > Mathematca 5, although it seems only to affect the associated Legendre > function and not Legendre polynomial itself. > > > Andrzej Kozlowski > > > > >> >> Peter >> >> >> ----- Original Message ----- From: "Andrzej Kozlowski" To: mathgroup at smc.vnet.net >> <akoz at mimuw.edu.pl> >> To: "peteraptaker" <psa at laplacian.co.uk> >> Cc: <mathgroup at smc.vnet.net> >> Sent: Saturday, October 16, 2004 2:25 PM >> Subject: [mg51486] Re: [mg51413] LegendreP (Symbolic) is different in >> Mathematica5 >> than previous versions (M4, M3 ..) >> >> >>> *This message was transferred with a trial version of >>> CommuniGate(tm) Pro* >>> On 16 Oct 2004, at 17:20, peteraptaker wrote: >>> >>>> LegendreP[1,1,mu] >>>> Out[with m4] = -Sqrt[1 - mu^2] >>>> Out[with m5] = Sqrt[(-1 - mu)/(-1 + mu)]*(-1 + mu) >>>> >>>> While this ( and common sense) show they are equal .. >>>> >>>> dum = m4 - m5 // FullSimplify >>>> PowerExpand[dum] >>>> Out[]= 0 >>>> >>> >>> Well, it seems to me that the commonsense thing to do in such >>> situations >>> is not to rely too much on common sense and even less on >>> PowerExpand. In >>> fact your two expressions are certainly not equal: >>> >>> a[mu_] := -Sqrt[1 - mu^2]; >>> b[mu_] := Sqrt[(-1 - mu)/(-1 + mu)]*(-1 + mu); >>> >>> a[2] >>> (-I)*Sqrt[3] >>> >>> FullSimplify[b[2]] >>> >>> I*Sqrt[3] >>> >>> >>> Andrzej Kozlowski >>> Chiba, Japan >>> http://www.akikoz.net/~andrzej/ >>> http://www.mimuw.edu.pl/~akoz/ >>> >>> >> >> >

**References**:**LegendreP (Symbolic) is different in Mathematica5 than previous versions (M4, M3 ..)***From:*psa@laplacian.co.uk (peteraptaker)