[Date Index]
[Thread Index]
[Author Index]
RE: Functions of Functions
*To*: mathgroup at smc.vnet.net
*Subject*: [mg49631] RE: [mg49598] Functions of Functions
*From*: "David Park" <djmp at earthlink.net>
*Date*: Sun, 25 Jul 2004 02:55:34 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Michael,
I always find this kind of thing difficult and maybe others will give you a
more direct method. There is a package at my web site called
Algebra`PushThrough` that is useful for working with operators. It basically
extends the Through command. But I only use one routine from it, which I
reproduce here.
PushOnto::usage =
"PushOnto[argslist, ontolist][expr] is a form of the Through command
that \
pushes arguments only onto forms given in the ontolist.\n\
PushOnto[ontolist][(head)[args]] pushes args onto forms given in the \
ontolist";
PushOnto[argslist_List, ontolist_List][expr_] :=
Module[{onto = Alternatives @@ ontolist},
expr /. (h_ /; ¬ FreeQ[h, onto]) @@
argslist :> (h /. a_ /; MatchQ[a, onto] -> a @@ argslist)
]
PushOnto[ontolist_List][(head_)[arglist___]] :=
Module[{onto = Alternatives @@ ontolist},
head /. a_ /; MatchQ[a, onto] :> a[arglist]
]
Then I would do your case as follows...
Clear[a, b, c, f]
a := Function[x, Sin[x] + x^2/2];
b[f_] := Derivative[2][f] + 3/2Derivative[1][f] + 5f;
c[x_] := b[a][x] // PushOnto[{Function[__]}]
c[x] // Simplify
(1/2)*(2 + 3*x + 5*x^2 + 3*Cos[x] + 8*Sin[x])
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Michael J Person [mailto:mjperson at mit.edu]
To: mathgroup 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: In Plot, horizontal range is reduced depending on PlotRange**
Next by Date:
**Re: AW: Fundamental theorem problem**
Previous by thread:
**Re: Functions of Functions**
Next by thread:
**AW: Fundamental theorem problem**
| |