# Error while using NDSolve?

**URL:** <https://community.wolfram.com/t/error-while-using-ndsolve/18213>\
**Category:** Questions\
**Tags:** calculus, equation-solving, graphics-and-visualization\
**Created:** [June 3, 2021, 3:07am UTC](https://community.wolfram.com/t/error-while-using-ndsolve/18213 "2021-06-03T03:07:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a01374548](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@a01374548](https://community.wolfram.com/u/a01374548)\
**Post date:** [June 3, 2021, 3:07am UTC](https://community.wolfram.com/t/error-while-using-ndsolve/18213/1 "2021-06-03T03:07:04Z")

</div>

This code doesn’t work, Please, I need help.

```
$Version
Clear[nN, beta0, gamma, sigma, iI0, sol, sS, eE, iI, rR]
nN = 100 000; (* Estudio para 100 mil personas *)
beta0 = 1.0;
gamma = 1 / 5; (* la enfermedad dura, de media, cinco días *)
sigma = 1 / 7; (* el periodo asintomático dura, de media, siete días *)
iI0 = 1; (* un infectado al principio *)
(* tiempo t en días *)
sol = NDSolve[\:f01csS'[t] == (-beta0) * (sS'[t]) * (iI[t]) \:f00c nN,
eE'[t] == (beta0)*(sS[t]) * (iI[t]) \:f00c (nN) - (sigma) * (eE[t]),
iI'[t] == (sigma)*(eE[t]) - (gamma) * (iI[t]),
rR'[t] == (gamma)*(iI[t]),
sS[0] == (nN) - (iI0), (eE[0]) == (iI0), (iI[0]) == 0, (rR[0]) == 0\:f027,
{sS, eE, iI, rR}, {t, 0, 240}];
Plot[Evaluate[{sS[t], eE[t], iI[t], rR[t]} /. sol], {t, 0, 120},
PlotRange \[RightArrow] All, AxesOrigin \[RightArrow] {0, 0}, AxesLabel \[RightArrow] {"días",},
PlotLegends \[RightArrow] {"susceptibles", "expuestos", "infectados", "recuperados"}]

```

[nofuncuiona.nb](https://community.wolfram.com/uploads/short-url/ckMwjgkqtj3FGc8FYCHCGjDhJ4o.nb) (6.63 KB)

---

<div class="post-metadata">

**Author:** ![kn](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kn/32/18980_2.png) [@kn](https://community.wolfram.com/u/kn)\
**Post date:** [June 3, 2021, 6:23am UTC](https://community.wolfram.com/t/error-while-using-ndsolve/18213/2 "2021-06-03T06:23:20Z")

</div>

Your first equation includes derivative of `sS` in both parts, left and right

```
sS'[t] == (-beta0) * (sS'[t]) * (iI[t]) / nN

```

---

<div class="post-metadata">

**Author:** ![dontdont9](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dontdont9](https://community.wolfram.com/u/dontdont9)\
**Post date:** [June 3, 2021, 6:31am UTC](https://community.wolfram.com/t/error-while-using-ndsolve/18213/3 "2021-06-03T06:31:07Z")

</div>

Restart Mathematica and, before doing anything else, scrape this code off the screen and paste it into your notebook and run it and report what you get

```
nN=100000;beta0=1.0;gamma=1/5;sigma=1/7;iI0=1;
sol=NDSolve[{sS'[t]==-beta0*sS'[t]*iI[t]/nN,
eE'[t]==beta0*sS[t]*iI[t]/nN-sigma*eE[t],
iI'[t]==sigma*eE[t]-gamma*iI[t],rR'[t]==gamma*iI[t],
sS[0]==nN-iI0,eE[0]==iI0,iI[0]==0,rR[0]==0},
{sS[t],eE[t],iI[t],rR[t]},{t,0,240}];
Plot[Evaluate[{sS[t],eE[t],iI[t],rR[t]}/.sol],{t,0,120},
PlotRange->All,AxesOrigin->{0,0}]

```

If it works then compare that character by character with the code you showed above and look at every tiny difference.
