Re: Manipulating differential equations

*To*: mathgroup at smc.vnet.net*Subject*: [mg18617] Re: [mg18552] Manipulating differential equations*From*: "Wolf, Hartmut" <hwolf at debis.com>*Date*: Tue, 13 Jul 1999 01:01:37 -0400*Organization*: debis Systemhaus*References*: <199907100618.CAA02980@smc.vnet.net.>*Sender*: owner-wri-mathgroup at wolfram.com

Hello Martin, Martin Heimann schrieb: > > Dear colleagues, > > I would like to insert test functions into an expression that contains > differentials: > > dg1 = c''[x] + g c'[x] > > I would like e.g. to replace c[x] by Exp[-a x]: > > dg1/.c[x]->Exp[-a x] > > but this doesn't work; one has to put substitution rules for each of the > derivatives explicitly. Is there a more elegant way to achieve this? > you have to substitute the _function_ : In[16]:= dg1 = c''[x] + g c'[x]//FullForm Out[16]//FullForm= Plus[Times[g,Derivative[1][c][x]],Derivative[2][c][x]] In[17]:= dg1/. c->(Exp[-a #]&) Out[17]//FullForm= Plus[Times[Power[a,2],Power[E,Times[-1,a,x]]], Times[-1,a,Power[E,Times[-1,a,x]],g]] (of course you normally don't define dg1 wrapped in FullForm) Alternatively you could also localize the function c[x] to Exp[-a x]: In[18]:= Block[{c},c[x_]:=Exp[-a x];dg1] Out[18]//FullForm= Plus[Times[Power[a,2],Power[E,Times[-1,a,x]]], Times[-1,a,Power[E,Times[-1,a,x]],g]] ---your's hw

**References**:**Manipulating differential equations***From:*Martin Heimann <martin.heimann@bgc-jena.mpg.de>