Re: Re: Replace in operators
- To: mathgroup at smc.vnet.net
- Subject: [mg102987] Re: [mg102922] Re: [mg102869] Replace in operators
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 3 Sep 2009 07:10:38 -0400 (EDT)
- References: <200909010750.DAA18607@smc.vnet.net> <200909020803.EAA03297@smc.vnet.net> <1251889441.21165.1332823679@webmail.messagingengine.com>
In this particular case it makes no significant difference. I don't even remember why I used :>, probably it was just to make the answers a little more varied ;-) Andrzej Kozlowski On 2 Sep 2009, at 13:04, Elton Kurt TeKolste wrote: > Andrzej > > You and I have similar solutions for this problem in your answer #2 > > f[x] + D[f[x], x] /. {f[x] :> g[x], Derivative[1][f][x] :> > Derivative[1][g][x]} > > except that I used the static replace (->) rather than the dynamic > replace (:>). > > I suspect that I have not fully understood the distinction between -> > and :> and, in particular, what advantage or difference :> provides in > this case over ->. > > Why did you select :> over -> in this example? > > Kurt > > On Wed, 02 Sep 2009 04:03 -0400, "Andrzej Kozlowski" <akoz at mimuw.edu.pl > > > wrote: >> I think, you can do on of three things: >> >> 1. >> Unevaluated[f[x] + D[f[x], x]] /. f[x] -> g[x] >> >> Derivative[1][g][x] + g[x] >> >> or >> >> 2. >> >> f[x] + D[f[x], x] /. {f[x] :> g[x], Derivative[1][f][x] :> >> Derivative[1][g][x]} >> >> Derivative[1][g][x] + g[x] >> >> 3. >> >> f[x] + D[f[x], x] /. f -> g >> >> Derivative[1][g][x] + g[x] >> >> (There are also some variants of 1 and 2 ). >> >> From what you say, it seems that the first choice (wrapping >> Unevaluated around the input) is the most suitable. >> >> Andrzej Kozlowski >> >> >> >> On 1 Sep 2009, at 09:50, did wrote: >> >>> I can't figure out how to force Mathematica to replace >>> f[x] by g[x] in expressions involving operators. >>> For example: >>> >>> f[x] + D[f[x],x] /. f[x] -> g[x] >>> >>> f is not replaced in the derivative. I found >>> somewhere in the manual that the replacement >>> does not work on operators, but then it does >>> not indicate how to do it. >>> >>> In my real problem, f[x]->g[x] is a (long) >>> list of complicated transformations resulting >>> from the resolution of many equations. >>> Thus, changing f[x]->g[x] by f->g is not >>> an option. >>> >>> f[x] + D[f[x],x] is actually a complicated >>> expression involving many operators. >>> >>> There are no ways I can do the >>> substitution by hand, bit by bit. >>> >>> Any suggestions ? >>> Thanks >>> >>> PS: it may help to precise the context. >>> I'm trying to solve a system of PDEs by >>> a small parameter expansion. Solving the >>> system at order N, I want to re-inject the >>> results into the equations at order N+1. >>> >> >> > Regards, > Kurt Tekolste >
- References:
- Replace in operators
- From: did <didier.oslo@hotmail.com>
- Re: Replace in operators
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Replace in operators