# Replace variable with other variable containing a constant in differential expression [duplicate]

I have the following differential expression:

f =
{h''[t] + 0.25 alpha''[t] + 0.1 h'[t] + 0.2 h[t] + 0.1 q alpha[t],
0.25 h''[t] + 0.5 alpha''[t] + 0.1 alpha'[t] + (k0 - 0.04 q) alpha[t] +
e2 (alpha[t])^3}


Where k0, e2 are simple constants, and q is a parameter. I would like to change my time variable t, with a new variable:

tau -> t omega /n


Where omega and n are to be considered as constants. In order to obtain a differential equation of the following form:

$\qquad f(\omega^2 x'',\, \omega\, x',\, x, n\, \tau,\, q)=0$

If I try replacing in the simple manner,

f /. t -> (n tau)/omega

I get in turn:

{0.1 q alpha[(n tau)/omega] + 0.2 h[(n tau)/omega] +
0.1 Derivative[h][(n tau)/omega] + 0.25 (alpha^′′)[(n tau)/omega] +
(h^′′)[(n tau)/omega],
(k0 - 0.04 q) alpha[(n tau)/omega] + e2 alpha[(n tau)/omega]^3 +
0.1 Derivative[alpha][(n tau)/omega] + 0.5 (alpha^′′)[(n tau)/omega] +
0.25 (h^′′)[(n tau)/omega]}


Yet in this way I'm afraid Mathematica can't tell omega and n are constants.

I found that it is possible to declare "constants" in Dt. Yet I would have to apply it before introducing the change of variables.

### Update

Following Kuba's comment I tried implementing the following instruction:

dChange[f, tau == t omega/n, t, tau, {h[t], alpha[t]}]


having defined dChange from this question.

My problem is solved, thanks to Kuba.

• Try dChange[ f, tau == t omega/n, t, tau, { h[t], alpha[t] } ] from change of variables in differential expressions
– Kuba
Jan 7, 2016 at 15:10
• Thank you, I'll try as you have kindly suggested me. Jan 7, 2016 at 15:12
• Feedback appreciated if you find anything is not ok. Good luck.
– Kuba
Jan 7, 2016 at 15:26
• I gave you the code to use. You've put something different, with incorrect syntax.
– Kuba
Jan 7, 2016 at 15:38
• @Kuba's code works for me on the f given at the beginning of your Q. I get the error on the code following your "I get in turn," but that code has been miscopied. (You may also find this this meta Q&A helpful for copying the input form of code.) Jan 7, 2016 at 15:46