Change of variable in ODE's
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg585] Change of variable in ODE's
- From: Jack Goldberg <Jack.Goldberg at math.lsa.umich.edu>
- Date: Tue, 21 Mar 1995 11:08:08 -0500 (EST)
Hi MathGroup!
Thanks to all of you who were so thoughtful in helping me
understand Function[x,Function[x,body]]. I hope I am not pushing
my luck by posing yet another problem.
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