MathGroup Archive 2004

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

Search the Archive

Re: Functions of Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49629] Re: [mg49598] Functions of Functions
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 25 Jul 2004 02:55:31 -0400 (EDT)
  • References: <200407240747.DAA05846@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

*This message was transferred with a trial version of CommuniGate(tm) Pro*

On 24 Jul 2004, at 08:47, Michael J Person wrote:

> *This message was transferred with a trial version of CommuniGate(tm) 
> Pro*
> Hello,
>
> 	I was wondering if anyone could help me with this.
>
> 	I've gone through the book and help files as best I can, but
> 	can't seem to figure out why the following doesn't work:
>
> 	I'm trying to work with functions that take functions
>         as parameters and return other functions.
>
>         Below is an example...
>
> (*clear stuff*)
> Clear[a, b, c, x]
>
>
> (*Define a functions a*)
> \!\(a[x_] := \((Sin[x] + x\^3\/2)\)\)
>
>
> (*define a function of functions*)
> \!\(b[f_] = \((f'' + \(3\ f'\)\/2 + 5  f)\)\)
>
> (*apply the functional function to a*)
> c = b[a]
>
> (*Try to apply the resulting function to something*)
> c[x]
>
> This last step never gives me the results I'd expect by applying
> the derivatives of a to x...
>
> Can anyone tell me where I've gone horribly wrong?
>
> Thanks much,
>
> MJ Person
> mjperson at mit.edu
>
>

The problem is with your definition of b. You have

b[f_] = Derivative[2][f] + (3*Derivative[1][f])/2 + 5*f

but in Mathematica this is not a function. The algebra of functions is 
not implemented in Mathematica, and although it is not hard to do it 
yourself by adding rules to Plus and Times it is easier just to change 
your definition of b to:

b[f_][x_] := Derivative[2][f][x] +
    (3*Derivative[1][f][x])/2 + 5*f[x]

Now you will get

c[x]

3*x + (3/2)*((3*x^2)/2 + Cos[x]) - Sin[x] +
   5*(x^3/2 + Sin[x])


Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Functions of Functions
  • Next by Date: Re: Re: NonlinearFit works not so good
  • Previous by thread: Re: Functions of Functions
  • Next by thread: Re: Functions of Functions