Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51906] Re: LegendreP (Symbolic) is different in Mathematica5 than previous versions (M4, M3 ..)
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Thu, 4 Nov 2004 01:51:32 -0500 (EST)
  • References: <200410160820.EAA23725@smc.vnet.net> <DCE69724-1F76-11D9-9EF0-000A95B4967A@mimuw.edu.pl> <cl2fa3$mp1$1@smc.vnet.net> <paul-B33A96.18304203112004@news.uwa.edu.au> <104601c4c1a4$60e16cc0$42774ed5@lap5100>
  • Sender: owner-wri-mathgroup at wolfram.com

Peter:

>Type 1 is the form I want, and am using; by the way, the four 
>argument form (LegendreP[n,m,a,z]) is not very consipicuous in the 
>documentation, as it is not included in the summary of arguments at 
>the top.

Because Type 1 is the default case and engineers, like yourself, want 
Type1 only. This type argument is an optional argument and options 
for Mathematica functions are not given in the summary of arguments.

>In the end, the effect on my old notebooks of  'adding more/ all 
>branch cuts' is to make them difficult to rework.

But it is more important for Mathematica functions to be valid in the 
complex plane that just being valid for real integer parameters and 
real arguments over a limited part of the real axis.

>This is in much the same way as the improvements to integrate (which 
>has, I believe, also introduced some real bugs?).  In both cases 
>improvements to conditional Simplifications will be a useful way 
>forward.
>
>Do you have a 'nice' way of simplifying the Mathematica5 
>LegendreP[1,1, z] to get the elegant M4 one?

Why is this elegance important? What is wrong with

   Sqrt[(-z - 1)/(z - 1)] (z - 1)

anyway? It appears slightly more complicated than

   - Sqrt[1 - z^2]

but both plot or evaluate for -1 < z < 1 in the same way.

Values on the cut -1 < x < 1 are given by Abramowitz and Stegun 8.6.6 
and can be generated using (this corrects the earlier formula for 
m >= 1 and adds the case of m < 0):

  P[n_, m_, x_] := (-1)^m (1 - x^2)^(m/2) D[LegendreP[n, x], {x, m}]

  P[n_, m_ /; m < 0, x_] := (-1)^m ((n + m)!/(n - m)!) P[n, -m, x]

These are the 'more elegant' expressions that you want.

>DesiredFullSimpify[Sqrt[(-z - 1)/(z - 1)] (z - 1) , Abs[z] < 1] =  - 
>Sqrt[1 - z^2], Abs[z] < 1]

As Andrzej pointed out, such algebraic reduction is not, in general, 
trivial. If you produce a table of values of LegendreP[n, m, x],

  tab1 = Table[LegendreP[n, m, x], {n, 0, 4}, {m, -n, n}]

and compare this to the table of values on the cut,

  tab2 = Table[P[n, m, x], {n, 0, 4}, {m, -n, n}]

to me it is arguable which table is more elegant. The two tables 
clearly agree on the cut:

  FullSimplify[tab1/tab2, -1 < x < 1]

Cheers,
Paul


>----- Original Message ----- From: "Paul Abbott" <paul at physics.uwa.edu.au>
To: mathgroup at smc.vnet.net
>Newsgroups: comp.soft-sys.math.mathematica
>To: "Peter S Aptaker" <psa at laplacian.co.uk>
>Sent: Wednesday, November 03, 2004 10:30 AM
>Subject: [mg51906] Re: LegendreP (Symbolic) is different in Mathematica5 than 
>previous versions (M4, M3 ..)
>
>>In article <cl2fa3$mp1$1 at smc.vnet.net>,
>>"Peter S Aptaker" <psa at laplacian.co.uk> wrote:
>>
>>>Thanks. As with much or most use of LegendreP the argument  mu is real. My
>>>point and concern is in the Subject:
>>
>>Real -- but over what range? And I disagree that the argument z (mu is
>>usually used as one of the parameters) is usually real, at least in the
>>applications I need it for. I assume that you are restricting attention
>>to z = x in -1 < x < 1. In that case, Andrzej Kozlowski's suggestion of
>>using
>>
>>  P[n_, m_, x_] := (-1)^m (1 - x^2)^(m/2) D[LegendreP[n, x], x]
>>
>>(for m >= 0) is one way to go.
>>
>>Remember, Mathematica is designed to work with functions (and parameters
>>and arguments) assumed to be complex, in general.
>>
>>>"LegendreP (Symbolic) is different in Mathematica 5 than previous versions
>>>(M4, M3 ..)"
>>>
>>>Your comment means ttht the Mathematica 5 result is not simply 'a different
>>>form'  but 'the wrong answer'?
>>
>>The answer is _not_ wrong. If you look at the online documentation for
>>LegendreP you will see that it accepts FOUR arguments. By default
>>LegendreP[1,1,mu] gives the "Type 1" case, which is defined only for z
>>within the unit circle in the complex plane. Indeed, although
>>
>>FullSimplify[Sqrt[(-z - 1)/(z - 1)] (z - 1) + Sqrt[1 - z^2], Abs[z] < 1]
>>
>>returns 0, FullSimplify fails to reduce Sqrt[(-z - 1)/(z - 1)] (z - 1)
>>to -Sqrt[1 - z^2]. But the result is not wrong. The definition needs to
>>handle different possible branch cuts. For example, Type 3 functions
>>have a single branch cut from -Infinity to +1.
>>
>>Cheers,
>>Paul
>>
>>>----- Original Message ----- From: "Andrzej Kozlowski" <akoz at mimuw.edu.pl>
To: mathgroup at smc.vnet.net
>>>Subject: [mg51906] Re:  LegendreP (Symbolic) is different in Mathematica5
>>>than previous versions (M4, M3 ..)
>>>
>>>
>>>>  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/
>>>>
>>>>
>>>
>>
>>--
>>Paul Abbott                                   Phone: +61 8 6488 2734
>>School of Physics, M013                         Fax: +61 8 6488 1014
>>The University of Western Australia      (CRICOS Provider No 00126G)
>>35 Stirling Highway
>>Crawley WA 6009                      mailto:paul at physics.uwa.edu.au
>>AUSTRALIA                            http://physics.uwa.edu.au/~paul



  • Prev by Date: Publicon LaTeX conversion problems
  • Next by Date: Re: Zero divided by a number...
  • Previous by thread: Re: LegendreP (Symbolic) is different in Mathematica5 than previous versions (M4, M3 ..)
  • Next by thread: Publicon LaTeX conversion problems