Re: Function as an argument to a function
- To: mathgroup at smc.vnet.net
- Subject: [mg13846] Re: [mg13814] Function as an argument to a function
- From: BobHanlon at aol.com
- Date: Sat, 29 Aug 1998 04:41:21 -0400
- Sender: owner-wri-mathgroup at wolfram.com
myFunction[expr_, sym_Symbol:x, param_:1] := expr /. sym -> param myFunction[f[x]] f[1] myFunction[f[y], y, z] f[z] myFunction[Exp[x]] E myFunction[y^2+3y+7, y] 11 myFunction[y^2+3y+7, y, 2] 17 Bob Hanlon In a message dated 8/28/98 8:25:30 AM, jlakkako at jade.hut.fi wrote: >I want to pass a function as an argument to a function I am developing. >For example: Myfunction[Exp[x]] > >I would like Myfunction to return the value of it's parameter function >when (for example) x=1. > >Here's what I have tried: > >Myfunction[f_] := > f[1] > >Doesn't work. Any suggestions??