CHANGEVAR operator
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 7.6 CHANGEVAR operator

Author: G. Üçoluk.

The operator CHANGEVAR does a variable transformation in a set of diﬀerential equations. Syntax:

changevar(⟨depvars⟩,⟨newvars⟩,⟨eqlist⟩,⟨diﬀeq⟩)

⟨diﬀeq⟩ is either a single diﬀerential equation or a list of diﬀerential equations, ⟨depvars⟩ are the dependent variables to be substituted, ⟨newvars⟩ are the new depend variables, and ⟨eqlist⟩ is a list of equations of the form ⟨depvar⟩=⟨expression⟩ where ⟨expression⟩ is some function in the new dependent variables.

The three lists ⟨depvars⟩, ⟨newvars⟩, and ⟨eqlist⟩ must be of the same length. If there is only one variable to be substituted, then it can be given instead of the list. The same applies to the list of diﬀerential equations, i.e., the following two commands are equivalent

changevar(u,y,x=e^y,df(u(x),x) - log(x));
changevar({u},{y},{x=e^y},{df(u(x),x) - log(x)});

except for one diﬀerence: the ﬁrst command returns the transformed diﬀerential equation, the second one a list with a single element.

The switch DISPJACOBIAN governs the display the entries of the inverse Jacobian, it is OFF per default.

The mathematics behind the change of independent variable(s) in diﬀerential equations is quite straightforward. It is basically the application of the chain rule. If the dependent variable of the diﬀerential equation is F , the independent variables are xi and the new independent variables are ui (where i=1…n) then the ﬁrst derivatives are:

We assumed Einstein’s summation convention. Here the problem is to calculate the ∂uj∕∂xi terms if the change of variables is given by

The ﬁrst thought might be solving the above given equations for uj and then diﬀerentiating them with respect to xi, then again making use of the equations above, substituting new variables for the old ones in the calculated derivatives. This is not always a preferable way to proceed. Mainly because the functions fi may not always be easily invertible. Another approach that makes use of the Jacobian is better. Consider the above given equations which relate the old variables to the new ones. Let us diﬀerentiate them:

| = |  |
δij | = |  |

The ﬁrst derivative is nothing but the (j,k) th entry of the Jacobian matrix.

So if we speak in matrix language

where we deﬁned the Jacobian

and the matrix of the derivatives we wanted to obtain as

If the Jacobian has a non-vanishing determinant then it is invertible and we are able to write from the matrix equation above:

so ﬁnally we have what we want

The higher derivatives are obtained by the successive application of the chain rule and using the deﬁnitions of the old variables in terms of the new ones. It can be easily veriﬁed that the only derivatives that are needed to be calculated are the ﬁrst order ones which are obtained above.

#### 7.6.1 CHANGEVAR example: The 2-dim. Laplace Equation

The 2-dimensional Laplace equation in cartesian coordinates is:

Now assume we want to obtain the polar coordinate form of Laplace equation. The change of variables is:

The solution using CHANGEVAR is as follows

changevar({u},{r,theta},{x=r*cos theta,y=r*sin theta},
{df(u(x,y),x,2)+df(u(x,y),y,2)} );

Here we could omit the curly braces in the ﬁrst and last arguments (because those lists have only one member) and the curly braces in the third argument (because they are optional), but you cannot leave oﬀ the curly braces in the second argument. So one could equivalently write

changevar(u,{r,theta},x=r*cos theta,y=r*sin theta,
df(u(x,y),x,2)+df(u(x,y),y,2) );

If you have tried out the above example, you will notice that the denominator contains a cos2𝜃 + sin2𝜃 which is actually equal to 1. This has of course nothing to do with CHANGEVAR. One has to be overcome these pattern matching problems by the conventional methods REDUCE provides (a rule, for example, will ﬁx it).

Secondly you will notice that your u(x,y) operator has changed to u(r,theta) in the result. Nothing magical about this. That is just what we do with pencil and paper. u(r,theta) represents the the transformed dependent variable.

#### 7.6.2 Another CHANGEVAR example: An Euler Equation

Consider a diﬀerential equation which is of Euler type, for instance:

where prime denotes diﬀerentiation with respect to x. As is well known, Euler type of equations are solved by a change of variable:

So our call to CHANGEVAR reads as follows:

changevar(y, u, x=e**u, x**3*df(y(x),x,3)-
3*x**2*df(y(x),x,2)+6*x*df(y(x),x)-6*y(x));

and returns the result

df(y(u),u,3) - 6*df(y(u),u,2) + 11*df(y(u),u) - 6*y(u)

Up | Next | Prev | PrevTail | Front