I am attempting to solve a differential equation of the form $$ \frac{dx}{dt}=ax+by \\ \frac{dy}{dt}=cx $$ with parameters $0<a<1$ and $a,b,c \in \mathbb{R}$. I am able to use NDParametric Solve, but would like to generate a stream vector plot of the solutions, with $a=\lbrace 0,0.2,0.4,0.6,0.8,1.0 \rbrace$ b and c as the x-axis and y-axis. I can solve for varying values of $a$, but how do I turn this into a stream vector plot?

  • 1
    $\begingroup$ Could you please post your code for the NDParametric Solve? $\endgroup$ Feb 28, 2015 at 18:24
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Feb 28, 2015 at 18:24
  • 1
    $\begingroup$ @user21807 for a, b, c constants the system is linear and has a simple analytic solution. Why not take that? $\endgroup$ Feb 28, 2015 at 21:10

1 Answer 1


As has been observed by Dr. Wolfgang Hintze if a,b and c are constant this coupled system has easily derived analytic solutions. In general, this site strongly encourages you to try to present your attempts and then focused clear guidance can be given. I post this as in this case this does not really require more than 'out of the box' functions. Perhaps it can be illustrative and motivate your own play:

 Show[StreamPlot[{a x + b y, c y}, {x, -3, 3}, {y, -3, 3}], 
    Evaluate[{x[t], y[t]} /. 
      First@DSolve[{{x'[t], y'[t]} == {{a, b}, {0, c}}.{x[t], y[t]}, 
         x[0] == ix, y[0] == iy}, {x[t], y[t]}, t]], {t, 0, 10}, 
    PlotStyle -> Red] /. Line[w__] :> Arrow[w], 
  Epilog -> {Red, PointSize[0.02], Point[{ix, iy}]}], {a, 0.01, 
  1}, {b, 0, 1}, {c, 0, 1}, {ix, -3, 3}, {iy, -3, 3}]

I have not aimed for efficiency, terseness or clarity just coded on the run to motivate starting...

enter image description here

  • $\begingroup$ How do you go about creating that movie (GIF I suppose)? $\endgroup$
    – Amzoti
    Mar 6, 2015 at 2:33
  • $\begingroup$ @Amzoti apologies for delay in replying. I use licecap.en.softonic.com to screen capture. You can can create animated gifs from Mathematica. There are a number of helpful searchable posts on this site. $\endgroup$
    – ubpdqn
    Mar 7, 2015 at 3:01
  • $\begingroup$ No problem - excellent +1, thanks. $\endgroup$
    – Amzoti
    Mar 7, 2015 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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