Re: How to substitute a function?
- To: mathgroup at smc.vnet.net
- Subject: [mg94102] Re: How to substitute a function?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 5 Dec 2008 05:28:46 -0500 (EST)
- Organization: Uni Leipzig
- References: <gh8hmh$r2t$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, expr=a*y[x]^2 + y'[x]; and expr /. Thread[{#, D[#, x]} & /@ (y[x] -> Exp[-x]*f[x])] work fine. Where is the problem ? Regards Jens Alexei Boulbitch wrote: > Dear crew, > > I faced a difficulty when trying to substitute a newly represented > function into an expression containing a sum of differential and > algebraic terms. The difficulty is namely, that Mathematica 6 > substitutes the new representation into the algebraic, but not into the= > differential part. For example: > > (* This is the definition of a simple example of such an expression *) > > > expr = \!\( > \*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(y[x]\)\) + a*y[x]^2; > > (* Here I substitute a new representation of the function into the \ > above expression *) > (* What I expect to get is the following expression: -Exp[-x]*f[x] + \ > Exp[-x]*f=EF=BF=BD[x] + a \[ExponentialE]^(-2 x) f[x]^2 *) > (* Instead I get something else. Please have a look and check: *) > expr /. y[x] -> Exp[-x]*f[x] > > > > (* This is another approach I could think of with even worse result. *) > \ > > (* Note however, that within this approach a miracle happened: once \ > it *) > (* worked as expected (i.e. the substitution of both terms has been \ > performed as desired, but only once *) > > FullSimplify[expr, y[x] == Exp[-x]*f[x]] > > > Do you have idea of how to instruct Mathematica to make the substitutio= n > everywhere? > > Thank you in advance, Alexei >