I have three variables $X, Y, Z$ whose functional form is the following (I also have a function for $Z$ which is somewhat complicated but is not essential for my question here; so it is omitted.):



where $a,b,c,d$ are abstract parameters, and the overdot refers to time derivative of the variable, i.e. $\frac{dY}{dt}$.

Setting aside an obvious fact that this system is reduced to $\dot{X}=\dot{Z}$, I would like to know the Mathematica code for this system. For the first equation, I have

X[Y_] := a + b*Y

But I am stuck with the second one. Do I have to make the variables a function of time t? But in that case, doesn't the system become discrete, not continuous?


Yes, make X, Y, and Z functions of t. And use Equal instead of Set or SetDelayed.

Example with Z[t] = Exp[t]:

Block[{Z = Exp},
 DSolve[{X[t] == a + b Y[t], Y'[t] == c + d Z[t]}, {X[t], Y[t]}, t]
(*  {{X[t] -> a + b (d E^t + c t + C[1]), Y[t] -> d E^t + c t + C[1]}}  *)
  • $\begingroup$ thank you so much! Question: Why can we not include Z function into the DSolve bracket and instead use Block? $\endgroup$ – ppp Oct 1 '14 at 17:27
  • 1
    $\begingroup$ @ppp You're welcome. The C[1] is a constant of integration generated automatically by DSolve; if you add an initial condition for Y, C[1] will be replaced by a value. You can use an arbitrary Z: DSolve[{X[t] == a + b Y[t], Y'[t] == c + d Z[t]}, {X[t], Y[t]}, t] works as is. You said you had a function for Z, so I gave an example with a function for Z. :) $\endgroup$ – Michael E2 Oct 1 '14 at 17:30
  • 1
    $\begingroup$ @ppp Oops, I think I misunderstood your Q about Z. Of course you can substitute an expression for Z[t]. Your Q was in terms of Z, so I wanted to give an answer in terms of Z. $\endgroup$ – Michael E2 Oct 1 '14 at 17:31
  • $\begingroup$ I tried DSolve[{X[t] == a + b Y[t], Y'[t] == c + d Z[t], Z[t] == Exp[t]}, {X[t], Y[t], Z[t]}, t] and it says E^t cannot be used as a function. Many thanks :) $\endgroup$ – ppp Oct 1 '14 at 17:43
  • 1
    $\begingroup$ @ppp I get {{X[t] -> a + b (d E^t + c t + C[1]), Y[t] -> d E^t + c t + C[1], Z[t] -> E^t}}. (V10.0.1.) $\endgroup$ – Michael E2 Oct 1 '14 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.