Re: Re: variable substitution in differential eqns

*To*: mathgroup at smc.vnet.net*Subject*: [mg61974] Re: [mg61960] Re: [mg61950] variable substitution in differential eqns*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Sun, 6 Nov 2005 05:12:23 -0500 (EST)*References*: <200511050653.BAA02074@smc.vnet.net> <200511060341.WAA16991@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 6 Nov 2005, at 12:41, Carl K. Woll wrote: > Joseph Fagan wrote: >> For Calculus of Variations, I need to make some hairy variable >> substitutions. >> >> A simple substitution example is shown here in the first few lines. >> >> See >> http://mathworld.wolfram.com/Second- >> OrderOrdinaryDifferentialEquation.html >> >> If I make the substitution x=1/z how can I get Mathematica to give >> me eqn (2) >> and eqn (5) >> and, being greedy, eqn (6)? >> or point me to where to begin. >> >> Thanks >> Joe >> > > The question is how to convert y''[x] to the appropriate expression > when > x -> 1/z. One idea is to use Composition: > > In[23]:= > y''[x] /. y->Composition[y,1/#&] /. x->1/z > > Out[23]= > 3 4 > 2 z y'[z] + z y''[z] > > The equation to be transformed has the left hand side: > > lhs = y''[x] + P[x]y'[x] + Q[x]y[x] > > Using the Composition rule, we find: > > In[25]:= > lhs /. y->Composition[y,1/#&] /. x->1/z > > Out[25]= > 1 3 2 1 4 > Q[-] y[z] + 2 z y'[z] - z P[-] y'[z] + z y''[z] > z z > > If we want to have Q and P transformed as well, we should include > Composition rules for them too: > > In[26]:= > lhs /. h_ /; MemberQ[{P,Q,y},h] -> Composition[h,1/#&] /. x->1/z > > Out[26]= > 3 2 4 > Q[z] y[z] + 2 z y'[z] - z P[z] y'[z] + z y''[z] > > This agrees with equation (6) from the MathWorld link. > > Carl Woll > Wolfram Research > For what its worth, you don't really need Composition; this will also do: y''[x] /. {y -> (y[1/#] &), x -> 1/z} etc. Andrzej Kozlowski

**References**:**variable substitution in differential eqns***From:*"Joseph Fagan" <noemailplease@nowhere.ru>

**Re: variable substitution in differential eqns***From:*"Carl K. Woll" <carl@woll2woll.com>