1

I want to solve these equations numerically in Mathematica and plot them.

\begin{equation} u'(t)=1.5\,u(t)\,v(t)-u(t) \space \space \space \text{and} \space \space u(0)=0.001 \end{equation} \begin{equation} v'(t)=-1.5\,u(t)\,v(t) \space \space \space \text{and} \space \space v(0)=0.999 \end{equation} \begin{equation} z'(t)=u(t) \space \space \space \text{and} \space \space z(0)=0 \end{equation}

I have tried this:

sol = NDSolve[{u'[t] == -u[t] + 1.5 u[t] v[t], 
   v'[t] == 1.5 u[t] v[t], w'[t] = u[t], 
   u[0] == v[0] == z[0] = 0},
  {u, v, w}, {t, 10}]

But it doesn't seem to work. Thanks in advance.

MarcoB
  • 67,153
  • 18
  • 91
  • 189
Trix
  • 13
  • 3
  • Clear all the variables you used, and try again with the change z[0] == 0. Note the difference between equality (==) and assignment (=). – J. M.'s missing motivation Jun 17 '15 at 13:17
  • Still doesn't work. I get this: NDSolve::deqn: "Equation or list of equations expected instead of True in the first argument {!(True, *SuperscriptBox["u", "[Prime]", MultilineFunction->None][t] == (-5)\\ u[t]\\ v[t], True, 0.001` == u[0] == 0 == 0)}." – Trix Jun 17 '15 at 13:19
  • 1
    I said, clear everything. Start in a fresh session if need be. The error you showed tells me you didn't do the first thing I told you to do. – J. M.'s missing motivation Jun 17 '15 at 13:22
  • Welcome to Mathematica.SE! I suggest the following: 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! – Michael E2 Jun 17 '15 at 13:46
  • You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. – Michael E2 Jun 17 '15 at 13:46
  • Some duplicates: http://mathematica.stackexchange.com/q/40314/; and http://mathematica.stackexchange.com/q/46214, http://mathematica.stackexchange.com/q/80210. – Michael E2 Jun 17 '15 at 15:08

1 Answers1

3

This is mostly because your code is completely unrelated to your equation.

  • What is w?
  • Why do you use = when you want ==?
  • Where does the 5 come from when you want 1.5?
  • Why are all of your initial values 0?

Here is something to start with but first go to Evaluation -> Quit Kernel

sol = NDSolveValue[{
   u'[t] == 1.5 u[t] v[t] - u[t],
   v'[t] == -1.5 u[t] v[t],
   z'[t] == u[t],
   u[0] == 0.001,
   v[0] == 0.999,
   z[0] == 0}, {u, v, z}, {t, 10}]

Plot[Through[sol[t]], {t, 0, 10}, PlotRange -> All, Evaluated -> True]

Mathematica graphics

halirutan
  • 112,764
  • 7
  • 263
  • 474