1
$\begingroup$

When I input the following code to solve this system of equations (I specifically want to look at 0<d<1, 0<q<1, 0<t), I get the error:

'DSolve: The function y[t] was specified without dependence on all the independent variables. Each function must depend on all the independent variables.'

Here is my code:

  DSolve[{y'[t] == 1 - q x[t] - (3 + 2 d) y[t], x'[t] == 1 - d y[t] - (3 + 2 q) x[t], x[0] + y[0] == 1}, y[t], x[t], t]

What is the appropriate way to go about solving these differential equations?

$\endgroup$
1
$\begingroup$

You need to write it this way

ClearAll[x, y, t, q, d];
ode1 = y'[t] == 1 - q x[t] - (3 + 2 d) y[t];
ode2 = x'[t] == 1 - d y[t] - (3 + 2 q) x[t];
ic   = x[0] + y[0] == 1;
DSolve[{ode1, ode2, ic}, {y[t], x[t]}, t]

To answer comment:

What would I do if I now want to look at when y=0 and x'>0

May be this is something to get you started on this. You'd need numerical value for $q,d$. Since you have 2 ODE's and one IC. So even if you plug in numbers for q,d, there is still one unknown c1. But you can always plug in a number for this constant also

Here is an example

ClearAll[x,y,t,q,d];
q    = 1/2; 
d    = 1/3;
ode1 = y'[t]==1-q x[t]-(3+2 d) y[t];
ode2 = x'[t]==1-d y[t]-(3+2 q) x[t];
ic   = x[0]+y[0] == 1;

sol = First@DSolve[{ode1,ode2,ic},{y[t],x[t]},t];
sol = sol/.C[1]->1 %plug in some value for last constant of integration

Mathematica graphics

Now

Plot[{Evaluate[y[t] /. sol], Evaluate[D[(x[t] /. sol), t]]}, {t, 0, 
  2}, PlotLegends -> {"y(t)", "x'(t)"}]

Mathematica graphics

The above shows $y(t),x'(t)$ are both >= 0 when $t=2$. it looks like x'(t) does not go over zero actually. To get exact answer, you'd need to solve the equations which I am not sure they can be solved analytically, a numerical method would be needed. When you change $c_1$ you do the same again.

$\endgroup$
  • $\begingroup$ What would I do if I now want to look at when y=0 and x'>0 or when x'=0 and y=0 or when x'=0 and y>0 for example? $\endgroup$ – EverythingEnds Jul 24 at 11:18
  • $\begingroup$ @RyanSchiller do you have numerical values for all the parameters d,q else will be hard to solve analytically. Once you have the solution, you can do D[x[t],t] to get x'[t] and then you need to solve for t when y=0, x'[t]>0 but this will be hard to do as is since solutions are complicated, and also there is a constant of integration which is not defined. So you need initial conditions also. $\endgroup$ – Nasser Jul 24 at 11:24
  • $\begingroup$ All I know is 0<q<1, 0<d<1, x(0) + y(0) = 1, 0<=x<=1, 0<=y<=1, 0=<t. Is this not enough to solve analytically? $\endgroup$ – EverythingEnds Jul 24 at 11:34
  • $\begingroup$ @RyanSchiller you have essentially one IC in x(0) + y(0) = 1 If you look at the solution, you'll see $c_1$ in there. Since you have 2 ODE's and one IC. So even if you plug in numbers for q,d, there is still one unknown $c_1$. But you can always plug in a number for this constant also. I'll show an example. $\endgroup$ – Nasser Jul 24 at 11:40
  • $\begingroup$ Ah that makes sense. Looking forward to seeing your example anyway so I can learn a bit more about the syntax of this language. $\endgroup$ – EverythingEnds Jul 24 at 11:46
0
$\begingroup$

You have to group {x[t],y[t]}in a list

DSolve[{y'[t] == 1 - q x[t] - (3 + 2 d) y[t], x'[t] == 1 - d y[t] - (3 + 2 q) x[t], x[0] + y[0] == 1}, {y[t],x[t]}, t]
$\endgroup$

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.