MathGroup Archive 1997

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

Search the Archive

Re: rules->function

  • To: mathgroup at
  • Subject: [mg7404] Re: [mg7338] rules->function
  • From: seanross at
  • Date: Fri, 30 May 1997 01:20:25 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Lord of Darkness wrote:
> Hello All,
> If I solve a set of simultaneous equations and get a simple answer like
> zrule = z-> x^2 + y^2
> but I then want to evaluate
> fn[x_,y_] := z + some more stuff.....
> I tried saying
> fn[x_,y_] := Replace[z,zrule] + ....
> but it doesn't seem to handle it the way I wanted...
> Is there a correct way of doing this ?
> thanks
> John B

No, there is no single correct way to do it.  My particular way is like


The reason your approach did not work is that mathematica has real
trouble when function arguments appear on the left hand side of
replacement rules.  You also used := which waits to execute the
instructions until called upon.  By that time, x and y are numbers, not
generic symbols and that gets you into trouble as well.

P.S.  Whats with the "Lord of Darkness" handle?  Were you Darth Vader in
a previous life?

  • Prev by Date: Re: Nonlinear Fit Problem
  • Next by Date: About PolynomialDivision & the Notebook Frontend
  • Previous by thread: Re: rules->function
  • Next by thread: Re: rules->function