Re: Replace in operators once again
- To: mathgroup at smc.vnet.net
- Subject: [mg103359] Re: Replace in operators once again
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Thu, 17 Sep 2009 06:20:49 -0400 (EDT)
- References: <h8qc70$cn7$1@smc.vnet.net>
You could try something similar to the following to do the substitution: eq = D[f[t, x], t] == D[f[t, x], {x, 2}] + k D[f[t, x], x] + p[f[t, x]] eq /. f -> (a g[#1/b, #2/c] &) /. {t -> b u, x -> c v} On 2009.09.16. 11:47, Alexei Boulbitch wrote: > Dear Community members, > > I would like to put a question closely related to " Replace in > operators", the one recently discussed here. See > http://forums.wolfram.com/mathgroup/archive/2009/Sep/msg00006.html > and the thread. > It concerns analytical transformations in differential equations. I need > to make a replacement, not just f[x]->g[x] as discussed in , but > a simple rescaling of both the function and the coordinate. To be more > concrete, consider a PDE over two variables time (t) and coordinate (x): > > df/dt=d^2f/dx^2 + k df/dx + F(f) > > Here f is a function f=f(t,x), F=F(f) is another function for instance, > a polynomial in terms of f, and depending upon some parameters. > Finally, k is a constant. In order to reduce the number of parameters in > this equation to the minimum one may wish to rescale both the function > and the both coordinates as follows: > > f[t, x]->a*g[u,v]; t->b*u; x->c*v > > where a, b and c are some constants. What one finds after the rescaling > looks like the following: > > (a/b)dg/du=(a/c^2)d^2g/dv^2 + k(a/c) dg/dv + F'(g) > > where F' is the transformed polynomial. Then this should be manipulated > further, and it is important to be able to hold all these manipulations > on-screen, rather than to go to the paper for intermediate steps. > It is not difficult to make the first substitution f[t, x]->a*g[u,v]. > One does not even need to use Replace: > > In[40]:= SetAttributes[{a, b, c}, Constant]; > > f[t_, x_] := a*g[t, x] > D[f[t, x], x] > D[f[t, x], {x, 2}] > > Out[42]= a > \!\(\*SuperscriptBox["g", > TagBox[ > RowBox[{"(", > RowBox[{"0", ",", "1"}], ")"}], > Derivative], > MultilineFunction->None]\)[t, x] > > Out[43]= a > \!\(\*SuperscriptBox["g", > TagBox[ > RowBox[{"(", > RowBox[{"0", ",", "2"}], ")"}], > Derivative], > MultilineFunction->None]\)[t, x] > > However, I cannot see how to cope with the second and the third > substitutions. Evidently, the simple > > In[45]:= \!\( > \*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(f[t, x]\)\) /. x -> c*v > > Out[45]= a > \!\(\*SuperscriptBox["g", > TagBox[ > RowBox[{"(", > RowBox[{"0", ",", "1"}], ")"}], > Derivative], > MultilineFunction->None]\)[t, c v] > > does not make the job. > > A closely related question: assume we need to make a substitution of the > type x->g[v] into derivative. Say, x->Log[v]. I would like to have the > result in a form > v D[g[v],v]. Instead I get of coarse, > > In[48]:= D[q[x], x] /. x -> Log[v] > > Out[48]= > \!\(\*SuperscriptBox["q", "\[Prime]", > MultilineFunction->None]\)[Log[v]] > > rather than what I need. Could you think of simple solutions for these > cases?