Re: Change of variable in ODE's (fwd)
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg606] Re: [mg585] Change of variable in ODE's (fwd)
- From: mcdonald at delphi.umd.edu (William MacDonald)
- Date: Mon, 27 Mar 95 17:02:35 EST
>From mcdonald Mon Mar 27 16:58:47 1995 >Subject: Re: [mg585] Change of variable in ODE's >To: Jack.Goldberg at math.lsa.umich.edu (Jack Goldberg) >Date: Mon, 27 Mar 95 16:58:47 EST > 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 Jack, How is this? To do the first transformation y->u/x^2: In[78]:= h[y_,x_]:=x^2 D[y,{x,2}] + 2 x D[y,x] + 2 y In[80]:= h[u/x^2,x] Out[80]= 4 u --- 2 x and to change the dependent variable: In[82]:= h[y,x]/.x->Log[t] Out[82]= 2 y -- William M. MacDonald Professor of Physics University of Maryland Internet: mcdonald at delphi.umd.edu -- William M. MacDonald Professor of Physics University of Maryland Internet: mcdonald at delphi.umd.edu -- William M. MacDonald Professor of Physics University of Maryland Internet: mcdonald at delphi.umd.edu