Re: Change of variable in ODE's
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg598] Re: [mg585] Change of variable in ODE's
- From: Richard Mercer <richard at seuss.math.wright.edu>
- Date: Thu, 23 Mar 1995 10:10:20 -0500
> Changes of variable in linear ODE's are used to
> convert an ODE into one of many normal or
> canonical forms. I thought it would be a simple task to
> get Mma to do the job for me. Well, yes and no. Consider
> the following two Mma versions of a particular
> Cauchy-Euler operator:
>
>
> (1) g = x^2 D[y[x],{x,2}] + 4 x D[y[x],x] + 2 y[x]
>
> and the more "natural" form
>
> (2) h = x^2 y''[x] + 4 x y'[x] + 2 y[x]
>
> The change of dependent variable y[x] = u[x]/x^2 (when
> appropriately effected) reduces (1) or (2) to the normal
> form u''[x]. The change of independent variable x =
> Log[t] reduces (1) or (2) to a constant coefficient 2nd
> order ODE. The catch is "appropriately effected". The
> following works for g.
>
> In: Hold[g]/.y[x_]->u[x]/x^2//ReleaseHold
>
> and
>
> In: Hold[g]/.y[x_]->y[Log[x]]//ReleaseHold
>
> It does not work for (2). After much labor I found an
> extremely awkward solution. Briefly:
>
> In:
> h/.Derivative[n_][y_][x]->Derivative[n][u[#]/#^2&][x]
>
> and
>
> In:
> h/.Derivative[n_][y_][x]->Derivative[n][y[Log[#]]&]][x]
>
> Actually, these don't quite work. These rules do not
> transform y[x] so a separate rule must be appended to
> change y[x] to u[x]/x^2 and y[x] to y[Log[x]]. I am
> particularly unhappy with this solution for these reasons:
> (1) They are awkward in the extreme. (2) They require
> the user to know the FullForm of y' and understand pure
> functions. Although I can't say that the method used on
> g is the best possible, it is easily understood by a
> student with a rudimentary knowledge of Mma. This is
> surely not the case with the rules used for h.
>
> Q1: Is there a way to effect the changes on h which
> requires less
> skill with Mma?
>
> Q2: Are there alternative ways to handle g?
>
> One last thought. I suppose one could write a package
> which contains the functions ChangeDependentVariable
> and ChangeIndependentVariable which would have the
> differential operator and the change of variable as
> arguments. Then all would be hidden from the user who
> would only need to call either of these commands.
>
> Q3: Is this the way to go?
>
Jack,
First of all, both g and h produce the same output (looks like h) when
evaluated, so it if you can do it for h, it will work for g too; just don't use
Hold.
For h, the following works.
In[8]:=
v[x_]:= u[x]/x^2
h /. y->v //Expand
Out[9]=
u''[x]
This avoids the explicit use of pure functions and is relatively simple. It is
not completely ideal in that it depends on y always occuring with an argument,
i.e. y[x], but as long as you stick with that syntax you should be alright.
Richard Mercer