Re: Preventing LegendreP from self-extracting in manipulations

• To: mathgroup at smc.vnet.net
• Subject: [mg57861] Re: Preventing LegendreP from self-extracting in manipulations
• From: David Bailey <dave at Remove_Thisdbailey.co.uk>
• Date: Fri, 10 Jun 2005 02:29:27 -0400 (EDT)
• References: <d893ok\$svp\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Vladislav wrote:
> Hi, all,
>
> I have already tried to post the message, but it went lost. I repeat it
>
> Can somebody help me with the following. I need present some functions
> (prolate spheroidal functions) in the basis of the Legendre
> polynomials. I.e.
> I have functions like
>
> FF1 = 0.6 LegendreP[5, #1] + 0.7 LegendreP[6, #1] &
> FF2 = 0.3 LegendreP[5, #1] + 0.2 LegendreP[6, #1] &
>
> I want to manipulate these functions and remain in the basis of prolate
> functions.
> For example I want to create a linear combination of functions, or
> something like this.
>
> FF = .2FF1[#1] + .3FF2[#1] &
>
> It works well from the point of view of finding the numerical result,
> but it do not give
> the presentaion of the function in the basis of the Legendre
> polynomials
>
> I would like to have create a function which would give the result like
>
> FFX = 0.9 LegendreP[5, #1] + 0.9 LegendreP[6, #1] &, so that I could
> see the presentaion
> of the function by typing FFX and obtaining  0.9 LegendreP[5, #1] + 0.9
> LegendreP[6, #1] &.
> In practice these functions contain much more terms and having the form
> like
>  0.9 LegendreP[5, #1] + 0.9 LegendreP[6, #1] & is very important. In
> the same way
> I would not like to have the explicit presentation as plolinomials,
> like -0.28125+
> 1.6875  w + 5.90625 w^2 + .. because of loss of accuracy for future
> results.
>
> Sincerely,
>
>
Hi,

You may find it useful to use some other function for the Legendre
polynomials - say P[x,n] - and then you can manipulate expressions
involving this quite freely because Mathematica does not know anything
about them. When you want numerical answers, you can use something like

expr /. P[a_,b_]->LegendreP[a,b]

Using this technique, you could even apply an identity involving