[Date Index]
[Thread Index]
[Author Index]
Re: Functions of Functions
*To*: mathgroup at smc.vnet.net
*Subject*: [mg49653] Re: Functions of Functions
*From*: drbob at bigfoot.com (Bobby R. Treat)
*Date*: Mon, 26 Jul 2004 04:01:57 -0400 (EDT)
*References*: <200407240747.DAA05846@smc.vnet.net> <cdvmje$7lr$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Sorry, that didn't make any sense, because I missed a line of Michael's code.
David Park gave a much better answer.
Bobby
DrBob <drbob at bigfoot.com> wrote in message news:<cdvmje$7lr$1 at smc.vnet.net>...
> Here's your code again:
>
> Clear[a, b, c, x]
> a[x_] := Sin[x] + x^3/2
> c = b[a]
> c[x]
>
> It's clear that you've defined a to be a function. A named pattern (x_) is used on both sides of the SetDelayed.
>
> But you didn't do anything like that in defining c; no named patterns at all.
>
> So how can anyone know what you want c[x] to be? If I could guess, I'd show you how to accomplish it.
>
> Slightly more subtle is the point that, as you've defined it, a isn't a function of x; a[x] is. a[y] is a function of y, a[z] depends on z, et cetera.
>
> But a isn't a function at all, except when it's given an argument. That's why, once again, there's no mention of x in your definition of c.
>
> Bobby
>
> On Sat, 24 Jul 2004 03:47:29 -0400 (EDT), Michael J Person <mjperson at mit.edu> wrote:
>
> > 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: Bug? Wrong result from infinite sum.**
Next by Date:
**Slow LinearSolve.**
Previous by thread:
**Re: Functions of Functions**
Next by thread:
**about principal components analysis (PCA)**
| |