Re: Nested Functions
- To: mathgroup at smc.vnet.net
- Subject: [mg44872] Re: Nested Functions
- From: Bill Rowe <readnewscix at mail.earthlink.net>
- Date: Thu, 4 Dec 2003 03:04:36 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 12/3/03 at 4:24 AM, gregory.lypny at videotron.ca (Gregory Lypny) wrote: > I'm a relatively new user of Mathematica. I've got a problem with a > nested function that won't evaluate when supplied with numbers. It > looks something like this: MU is a function nested within another > function P. > MU[C_] = C^g, where 0<g<1 (g=.25 in my notebook) > and > P[z_, Cs_, C0_] = z (MU[Cs]/MU[C0]) > When I try to evaluate P[.5, 120, 90] I get the same input returned, > that is, P[.5, 120, 90], rather than the value of the function P > evaluate at its arguments. What am I doing wrong? You need to use SetDelayed (:=) rather than Set (=). That is change your syntax to read MU[C_]:= C^g P[z_, Cs_, C0_]:= z (MU[Cs]/Mu[C0]) See the Mathematica Book 2.5.8 for a discussion of the difference between Set and DelayedSet or look in the help browser -- To reply via email subtract one hundred and nine