# How to change variables in differential equation?

Hey guys,

I'd like to find a way to make a change of variables in diff equation(why is there no intrinsic method?) My attempt: Assume that I have some random equation :

```
G=function('G')
F=G(r)*e^(-I*w*t)
equa = diff(F,r,2)+diff(F,t)F
```

and let's say I'd like to change the variable r to z = r^2 - a^2.

The way I do it now is using the following trick:

```
var('z')
p=solve(z==(r^2-a^2) ,r)
T = function('T')(z)
final = equat.substitute_function(G,T).subs(r=p[0].rhs()).full_simplify()
```

It gives the following depreciation message:

```
DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
```

It's very clumsy, but at least it is working.

But that is not it. The following code just gives rubbish output using more or less the same logic

```
var('m')
exm = function('exam')(x,y)
diffequ= diff(exm,x)
diffexp= function('probe')(m+y^2,y/x)
diffequ.substitute_function(exam,diffexp)
```

output: D_0(probe)(y^2+x,1)

Which is just plain wrong!

Is there a way to work around those problems?