Re: [Q] Implementing identities as rules
- To: mathgroup at smc.vnet.net
- Subject: [mg18675] Re: [Q] Implementing identities as rules
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Thu, 15 Jul 1999 01:45:57 -0400
- Organization: University of Western Australia
- References: <7meirr$9gp@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Kevin Jaffe wrote:
> Is there a way to instruct Mathematica not to evaluate the expression
> after the replacement has been made?
One way is to use HoldForm:
In[1]:= f = Function[{x, y}, Exp[x^2 + y^2]];
In[2]:= D[f[x, y], x] /. Exp[a_^2 + b_^2] :> HoldForm[f][a, b]
Out[2]= 2 x f[x, y]
In[3]:= ReleaseHold[%]
Out[3]=
2 2
x + y
2 E x
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA 6907 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________