Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*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 2004

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

Search the Archive

Re: Functions of Functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49637] Re: [mg49598] Functions of Functions
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sun, 25 Jul 2004 02:55:46 -0400 (EDT)
  • References: <200407240747.DAA05846@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

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



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: 3D Pascal's Triangle (Cone?)
  • Next by Date: Re: Functions of Functions
  • Previous by thread: Functions of Functions
  • Next by thread: Re: Functions of Functions