# NDSolve giving NDSolve::deqn: message when given my system of equations [closed]

I am so new on Mathematica. I hope my question is suitable. I have looked the Documentation Center and looked also on StackExchange but I could not handle the problem. It gives always the error

NDSolve::deqn: Equation or list of equations expected instead of False in the first argument.

My system is as follows;

dec = c'[t] == -Ïƒ c[t] (Î± k[t]^(Î± – 1) s[t]^Î² – Ï);
dek = k'[t] == -(k[t]^Î± s[t]^Î² – (Ï• s[t]^2 s[t])/2 – c[t]);
des = s'[t] == -(-s[t]);
dep = p'[t] == -((p[t] – (Ï• s[t]^2)/2) Î± k[t]^(Î± – 1) s[t]^Î²);

For calibration

Clear[Î±, Î², Ï•, Ïƒ, Ï, Î´, a];
Î± = 0.3; Ïƒ = 1; Ï = 0.04; Î´ = 0.02; Ï• = 0.0003; Î² = 0.1; a = 0.2;

Finally I write

sol1 =
NDSolve[{dec, dek, des, dep, c[0] == 1, k[0] == 1, s[0] == 1, p[0] == 1},
{c[t], k[t], s[t], p[t]}, {t, 0, 255}]

Whatever I have tried, it gives always the following error message quoted above.

P.S. Thanks for your colloboration and sorry for the bad coding.

=================

=================

2 Answers
2

=================

Replace c[t],k[t],s[t],p[t] for c,k,s,p

sol1 = NDSolve[{dec, dek, des, dep, c[0] == 1, k[0] == 1, s[0] == 1,
p[0] == 1}, {c, k, s, p}, {t, 0, 255}];
Plot[# /. sol1, {t, 0, 10}] & /@ {c[t], k[t], s[t], p[t]}

Thank you so much. Is there any precise reason for this change ? Because, in many other codes, people write c[t],k[t],s[t],p[t] for c,k,s,p
– user1905
Jul 25 ’15 at 20:38

@user1905 No there is no reason. In fact, your original code works fine. Either form works.
– Michael E2
Jul 26 ’15 at 3:22

Your code works fine with a clean kernel. That indicates that previous assignments to c, k, s, and p are interfering with your evaluation of NDSolve. So you should evaluate Clear[c, k, s, p]; before evaluating NDSolve. The main difference between your NDSolve expression and Zviovich’s is yours returns interpolating function expressions and his the actual interpolating functions. The difference may seem subtle to you, but it is important. If you want the interpolation functions assigned to the variables c, k, s, and p, they are a little easier to extract with Zviovich’s form.

Î± = 0.3; Ïƒ = 1; Ï = 0.04; Î´ = 0.02; Ï• = 0.0003; Î² = 0.1; a = 0.2;
dec = c'[t] == -Ïƒ c[t] (Î± k[t]^(Î± – 1) s[t]^Î² – Ï);
dek = k'[t] == -(k[t]^Î± s[t]^Î² – (Ï• s[t]^2 s[t])/2 -c[t]);
des = s'[t] == -(-s[t]);
dep = p'[t] == -((p[t] – (Ï• s[t]^2)/2) Î± k[t]^(Î± – 1) s[t]^Î²);

Your form

Clear[c, k, s, p];
sol1 =
NDSolve[{dec, dek, des, dep,
c[0] == 1, k[0] == 1, s[0] == 1, p[0] == 1},
{c[t], k[t], s[t], p[t]}, {t, 0, 255}]

The extraction of the interpolation functions is done with

{c, k, s, p} = Head /@ sol1[[1, All, 2]];

Now c, k, s, and p can be used like any other Mathematica functions.

Zviovich’s form

Clear[c, k, s, p];
sol2 =
NDSolve[{dec, dek, des, dep,
c[0] == 1, k[0] == 1, s[0] == 1, p[0] == 1},
{c, k, s, p}, {t, 0, 255}]

The extraction dispenses with Head and Map and is a little simpler.

{c, k, s, p} = sol2[[1, All, 2]];