I have the following system of ode: a = {{-3, 1}, {-1, -5}}; eqns = Thread[{y1'[x], y2'[x]} == a.{y1[x], y2[x]} + {1, 1}]; I solved the general solution for a system of ode. However, I cannot specify the initial conditions for y(0)=(0,0)? this is what I tried:

DSolve[{{y1[x] == y[x], y2[x] == y[x]}, {{y1[0], y2[x]} == {0, 0}}}, {y1[x], y2[x]}, x]

and how to plot the solution? Thank you so much!

  • $\begingroup$ a={{-3,1},{-1,-5}}; eqns=Thread[{y1'[x],y2'[x]}==a.{y1[x],y2[x]}+{1,1}]; ic Thread[{y1[0],y2[0]}=={0,0}]; f={y1[x],y2[x]} /. DSolve[{eqns,ic},{y1[x],y2[x]},x][[1]]; Plot[f,{x,-1,1}] $\endgroup$ – Bill Oct 22 '17 at 15:41
  • $\begingroup$ @Bill Thank you! when I type f={y1[x],y2[x]} /. DSolve[{eqns,ic},{y1[x],y2[x]},x][[1]]; it gives the following two errors: DSolve::deqn: Equation or list of equations expected instead of ic in the first argument {{(y1^[Prime])[x]==1-3 y1[x]+y2[x],(y2^[Prime])[x]==1-y1[x]-5 y2[x]},ic}. and ReplaceAll::rmix: Elements of {{(y1^[Prime])[x]==1-3 y1[x]+y2[x],(y2^[Prime])[x]==1-y1[x]-5 y2[x]},ic} are a mixture of lists and nonlists. $\endgroup$ – Omar Kan Oct 22 '17 at 15:56
  • $\begingroup$ Sorry, scrape-n-paste somehow "ate" the = between ic and Thread So a={{-3,1},{-1,-5}}; eqns=Thread[{y1'[x],y2'[x]}==a.{y1[x],y2[x]}+{1,1}]; ic=Thread[{y1[0],y2[0]}=={0,0}]; f={y1[x], y2[x]}/.DSolve[{eqns,ic}, {y1[x],y2[x]}, x][[1]]; Plot[f, {x,-1,1}] I SHOULD have scrape-n-pasted it back into MMA to verify it before trusting it. Again, sorry for my mistake. $\endgroup$ – Bill Oct 22 '17 at 18:21

Your Answer

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

Browse other questions tagged or ask your own question.