MathGroup Archive 1999

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

Search the Archive

Re: Manipulating differential equations


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



  • Prev by Date: Re: Not Plotting Vertical Assymptotes
  • Next by Date: Re: Manipulating differential equations
  • Previous by thread: Re: Manipulating differential equations
  • Next by thread: Re: Manipulating differential equations