       Problem with transformation rule of a function

• To: mathgroup at smc.vnet.net
• Subject: [mg53467] Problem with transformation rule of a function
• From: Alain Cochard <alain at geophysik.uni-muenchen.de>
• Date: Thu, 13 Jan 2005 03:12:10 -0500 (EST)
• References: <16858.22033.555637.91757@localhost.localdomain>
• Sender: owner-wri-mathgroup at wolfram.com

```I define an expression:

In:= expr=M[t] + M[t] + Integrate[M[t],t] + Integrate[M[t],t] + D[M[t],t] + D[M[t],t];

Out= Integrate[M[t], t] + Integrate[M[t], t] + M[t] + M[t] +

>    (M)'[t] + (M)'[t]

and then I try 2 transformation rules on this expression:

In:= vers1=expr/.{M[t]->f[t], M[t]->0}

Out= f[t] + Integrate[f[t], t] + (M)'[t] + (M)'[t]

In this first one, I get the output I expect for the function and
integration terms, but not for the derivative ones.

In:= vers2=expr/.{M->f, M->0}

Out= 0[t] + f[t] + Integrate[0[t], t] + Integrate[f[t], t] + f'[t]

In this second version, I get these 0[t] terms for the function and
integration terms, with which I further have to deal with to achieve
what I want:

In:= %/.{0[t]->0}

Out= f[t] + Integrate[f[t], t] + f'[t]

I would first like to understand why the derivation and integration
terms are not treated in an identical way, and then I would like to
know if there is a more elegant way to do what I want in a single
step.