Re: Changing variables within a differential equation

*To*: mathgroup at smc.vnet.net*Subject*: [mg105223] Re: Changing variables within a differential equation*From*: schochet123 <schochet123 at gmail.com>*Date*: Wed, 25 Nov 2009 02:30:10 -0500 (EST)*References*: <hdttaa$h4h$1@smc.vnet.net>

On Nov 17, 12:18 pm, riccardo benini <riccardo.ben... at gmail.com> wrote: > given a (partial) differential equation F(y''[x], y'[x], y[x], x)==0 (where > y and x may be though as multidimensional), > how can I correctly set up achangeofvariablesy -> y[g], x -> x[t], > and get an equation in g[t]: F2(g''[t], g'[t], g[t], t)==0? The first step is to express first derivatives of new variables with respect to old ones in terms of first derivatives of old variables with respect to new ones. To do this define dsub[oldvars_List, newvars_List] := (dsub[oldvars, newvars] = With[{newofold = Through[newvars[Sequence @@ oldvars]], oldofnew = Through[oldvars[Sequence @@ newvars]]}, First[Solve[ Flatten[Table[ 0 == D[(newofold /. Thread[oldvars -> oldofnew]) - newvars, var], {var, newvars}] /. Thread[oldofnew -> oldvars]], Flatten[Table[D[newofold, var], {var, oldvars}]]]]]) /; Length[newvars] == Length[oldvars] The second step is to express the first derivative of an arbitrary function with respect to an old variable in terms of derivatives with respect to new variables, which can be done by transD[f_, oldvars_List, newvars_List, oldvar_] := With[{newofold = Through[newvars[Sequence @@ oldvars]], tmpvars = Table[Unique[], {Length[oldvars]}]}, D[f /. Thread[oldvars -> tmpvars] /. Thread[newvars -> newofold], oldvar] /. Thread[tmpvars -> oldvars] /. Thread[newofold -> newvars] /. dsub[oldvars, newvars]] /; Length[oldvars] == Length[newvars] Now define your partial differential equation using transD. For example, the Laplacian is laplacian[f_, oldvars_, newvars_] := Plus @@ Table[ transD[transD[f, oldvars, newvars, var], oldvars, newvars, var], {var, oldvars}] To check, calculate Expand[FullSimplify[ laplacian[ f[r, theta, phi], {x, y, z}, {r, theta, phi}] /. {x -> (#1 Cos[#2] Sin[#3] &), y -> (#1 Sin[#2] Sin[#3] &), z -> (#1 Cos[#3] &)}]] and compare to the known formula for the Laplacian in spherical coordinates, which may be found at http://mathworld.wolfram.com/SphericalCoordinates.html Steve