Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

Re: Preventing LegendreP from self-extracting in manipulations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57850] Re: Preventing LegendreP from self-extracting in manipulations
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 10 Jun 2005 02:29:13 -0400 (EDT)
  • References: <d893ok$svp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Vladislav,
The operator "Function" or & does not evaluate its arguments (it has the 
Attribute "HoldAll"). To get an evaluation you can use "Evaluate" like:
FF = Evaluate[.2FF1[#1] + .3FF2[#1]] &
The problem with this is that it evaluates down to the polynomial basis 
x^n that you do jnot want.
For the better solutions, see below:

Vladislav wrote:
> Hi, all,
> 
> I have already tried to post the message, but it went lost. I repeat it
> as a new therad.
> 
> 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.

If you want to stay in the basis of prolate function, you simply set up 
the definition only for numerical arguments, like:
FF1[x_Number]:= 0.6 LegendreP[5, x] + 0.7 LegendreP[6, x]
with this, the FF1 is not touched, except when it has a numerical argument

> 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

It is a bit more difficult, if you want to work in the basis of Legendre 
Polynomials. You would first define your own Legendre Polynomials that 
only evaluate for numerical arguments, like
myLegendreP[ord_Integer,x_Number]:= LegendreP[ord,x]
subsequentially you define the spherical prolates
FF1 = 0.6 myLegendreP[5, #1] + 0.7 myLegendreP[6, #1] &
FF2 = 0.3 myLegendreP[5, #1] + 0.2 myLegendreP[6, #1] &
and finally FF:
FF= Evaluate[ Simplify[ .2FF1[#1] + .3FF2[#1] ]] &

> 
> 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,
> 
> Vladislav
> 


  • Prev by Date: Re: Preventing LegendreP from self-extracting in manipulations
  • Next by Date: Re: Preventing LegendreP from self-extracting in manipulations
  • Previous by thread: Re: Preventing LegendreP from self-extracting in manipulations
  • Next by thread: Re: Preventing LegendreP from self-extracting in manipulations