MathGroup Archive 2004

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

Search the Archive

Re: Functions of Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49622] Re: Functions of Functions
  • From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
  • Date: Sun, 25 Jul 2004 02:55:23 -0400 (EDT)
  • References: <cdt5ih$6e5$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

This does what you want:

Clear[a, b, c, x]
a[x_] := Sin[x] + x^3/2
b[f_, x_] := D[f, {x, 2}] + (3*D[f, x])/2 + 5*f
c = b[a[x], x]

to give the folowing output:

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

BTW if you use Cell | Convert To | Input Form before you post then you can
avoid things like \!\(a[x_] := \((Sin[x] + x\^3\/2)\)\).

Steve Luttrell

"Michael J Person" <mjperson at mit.edu> wrote in message
news:cdt5ih$6e5$1 at smc.vnet.net...
> 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
>



  • Prev by Date: Re: 3D Pascal's beta cube
  • Next by Date: Re: 3D Pascal's Triangle (Cone?)
  • Previous by thread: Re: about principal components analysis (PCA)
  • Next by thread: RE: Functions of Functions