- To: mathgroup at smc.vnet.net
- Subject: [mg23069] Re: join/problem
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 15 Apr 2000 03:00:27 -0400 (EDT)
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
xm = x -> g[y];
fy[y_] = f[x, y] /. xm;
fy[y_] = f[g[y], y]
We don't need to always use := . But beware that with = the right side is
evaluated before the definition is stored. Here is an example where := is
tb[n_] = Expand[(a + b)^n];
(a + b)^2
tb[n_] := Expand[(a + b)^n];
a^2 + 2*a*b + b^2
Here is another way to get what I think you want.
Unevaluated[fy[y_] := f[x, y]] /. xm
fy[y_] := f[g[y], y]
The Unevaluated allows the definition to be evaluated only after the
replacement has been made.
Mathematica Training and Consulting
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"David Braunholtz" <D.A.BRAUNHOLTZ at bham.ac.uk> wrote in message
news:8d3rmo$oiv at smc.vnet.net...
> I would like to join the mathgroup list, please. The list was kind
> enough to solve a problem I had recently.
> I also have another urgent, and probably trivial (once you know how)
> I have an equation
> I find the solution xm=x->g[y] which maximises f[x,y] for any y
> I now want to define this 'maximised' function of y only fy[y]
> I've tried:
> but this doesn't seem to recognise that I want the y s from xm to
> 'match' the y_ on the LHS.
> I'm also unclear as to whether I want := or = in the above line.
> Thanks in anticipation
> David Braunholtz
> Department of Public Health & Epidemiology
> Public Health Building
> University of Birmingham
> Birmingham B15 2TT
> E-Mail: D.A.Braunholtz at bham.ac.uk
> Tel: 0121-414-7495
> FAX: 0121-414-7878
Prev by Date:
RE: Chop? Programming Challenge!!
Next by Date:
Re: Re: 3 credit online university course - Intro to Mathematica
Previous by thread:
Next by thread:
Need help with ideas to make NIntegrate a little faster for multiple variables