# solving ode and plotting solution vs time

I'm currently trying to solve this system of two ode's and can't seem to be able to solve them. I am new to coding, so I don't know where I could have done a mistake. I'm attaching the code which I thought would give a answer, but have gotten an error which I don't understand. What it is in reference too. Please, if you could guide me in the right direction, I would really appreciate it. Also, if it is not to much to ask for any hints on plotting x and y vs time. Thank you for you help.

equation1 := {x'[t] ==
1/(1 + (1/25) (y[t] - (2 y[t])/(1 + sqrt[1 + 1600 y[t]]))^2) -
0.1 x[t],
y'[t] ==
0.5 x[t] - (((20 y[t])/(1 + sqrt[1 + 1600 y[t]]) +
0.03 y[t])/(0.05 + y[t])) - 0.1 y[t], x[0] == 0, y[0] == 0};
DSolve[equation1, {x[t], y[t]}, t]


During evaluation, DSolve::ivar: 5 is not a valid variable. >>

(* DSolve[{0 == -0.1 5[t] + 1/(
1 + 1/25 (15[t] - (2 15[t])/(1 + sqrt[1 + 1600 15[t]]))^2),
0 == 0.5 5[t] - 0.1 15[t] - (
0.03 15[t] + (20 15[t])/(1 + sqrt[1 + 1600 15[t]]))/(
0.05 + 15[t]), 5[0] == 0, 15[0] == 0}, {5[t], 15[t]}, t] *)

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) 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! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Apr 30 '15 at 5:31

First, sqrt->Sqrt. Then, because you use real numbers (like 0.1, etc...) I will assume that you don't need an analytic solution. You want just plot. Then solution is easy.

equation1 = {x'[t] ==
1/(1 + (1/25) (y[t] - (2 y[t])/(1 + Sqrt[1 + 1600 y[t]]))^2) -
0.1 x[t],
y'[t] == 0.5 x[
t] - (((20 y[t])/(1 + Sqrt[1 + 1600 y[t]]) + 0.03 y[t])/(0.05 +
y[t])) - 0.1 y[t], x[0] == 0, y[0] == 0}; sol =
NDSolve[equation1, {x, y}, {t, 0, 10}]


and plot

Plot[{Tooltip[x[t], "x[t]"], Tooltip[y[t], "y[t]"]} /. sol[[1]], {t,
0, 10}, PlotStyle -> {Blue, Green}, Evaluated -> True]


• this still gives an error though – pkid58 May 1 '15 at 16:30
• Which version do you use? At least in 10.01 it is ok, I just checked once more by copying /pasting both cells. – user18792 May 2 '15 at 18:50

sqrt should be capitalized, if it is meant to be the standard Mathematica function, Sqrt. Also, there is no need to use SetDelayed. With these changes, no errors are produced, but the code does not produce an answer in a reasonable amount of time. It seems likely that DSolve cannot solve these equations. So, try

{sx, sy} = NDSolveValue[equation1, {x, y}, {t, 0, 10}]


Plot[{sx[t], sy[t]}, {t, 0, 10}]

• This is the correct solution, I believe. Moreover, setting the derivatives to zero yields a steady-state solution (using Solve) of {2.26164, 9.40081}, which agrees well with the late time solution of the differential equations. By the way, to use this site effectively, you really should read the two-minute tour that I mentioned in a comment yesterday. – bbgodfrey May 1 '15 at 16:46