[Q] Implementing identities as rules
- To: mathgroup at smc.vnet.net
- Subject: [mg18608] [Q] Implementing identities as rules
- From: "Kevin Jaffe" <kj0 at mailcity.com>
- Date: Tue, 13 Jul 1999 01:01:32 -0400
- Organization: MailCity (http://www.mailcity.lycos.com:80)
- Sender: owner-wri-mathgroup at wolfram.com
During symbolic manipulations it often important to be able to use both sides of an identity or definition. For example, let f be a function defined by In[1]:= f = Function[{x, y}, Exp[x^2 + y^2]]; Its partial derivative with respect to x is: In[2]:= D[f[x, y], x] 2 2 x + y Out[2]= 2 E x Now, I want to recast this result in the form 2 x f[x, y], i.e. I want to revert to the "left-hand side" of the original definition of f[x, y]. How does one do this in Mathematica? I know that if I try the rule In[3]:= %2 /. Exp[a_^2 + b_^2] :> f[a, b] 2 2 x + y Out[3]= 2 E x I get the original expression, because when the pattern is replace, f[a, b] is immediately evaluated to reproduce the original expression. (I know that the replacement occurs because if instead I use a rule whose right hand side cannot be evaluated further In[4]:= %2 /. Exp[a_^2 + b_^2] :> g[a, b] Out[4]= 2 x g[x, y] I get the desired result.) Is there a way to instruct Mathematica not to evaluate the expression after the replacement has been made? Thanks, kj0 at mailcity.com Get your FREE Email at http://mailcity.lycos.com Get your PERSONALIZED START PAGE at http://my.lycos.com
- Follow-Ups:
- Re: [Q] Implementing identities as rules
- From: Carl Woll <carlw@u.washington.edu>
- Re: [Q] Implementing identities as rules
- From: "Wolf, Hartmut" <hwolf@debis.com>
- Re: [Q] Implementing identities as rules