MathGroup Archive 1999

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

Search the Archive

[Q] Implementing identities as rules

  • To: mathgroup at
  • Subject: [mg18608] [Q] Implementing identities as rules
  • From: "Kevin Jaffe" <kj0 at>
  • Date: Tue, 13 Jul 1999 01:01:32 -0400
  • Organization: MailCity (
  • Sender: owner-wri-mathgroup at

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

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?


kj0 at

Get your FREE Email at

  • Prev by Date: Re: Parametric curve fitting
  • Next by Date: RE: RE: ExpIntegralEi
  • Previous by thread: problem?
  • Next by thread: Re: [Q] Implementing identities as rules