# Solving a non-linear system of equations symbolically [closed]

How would I solve this systems of non-linear equations symbolically:

$$\mu N -\frac{\beta S I}{N} - \nu S = 0 \qquad (1)$$

$$\frac{\beta S I}{N} -\gamma I - \nu I = 0 \qquad (2)$$

$$\gamma I - \nu R = 0 \qquad (3)$$

where $$S+I+R=N$$ and $$\mu, \beta, \nu,\gamma >0$$

EDIT:

Solve[u*n - (b/n)*p*s - v*s =
0 && (b/n)*p*s - g*p - v*p = 0 && g*p - v*r = 0 {s, p, r},
n = s + p + r]


EDIT II:

How would I find the solution to this system:

$$-\frac{\beta S I}{N} =0 \qquad (1)$$

$$\frac{\beta S I}{N} -\gamma I=0 \qquad (2)$$

$$\gamma I=0 \qquad (3)$$

where $$S+I+R=N$$ and $$\beta,\gamma >0$$.

I have these as the solutions;

$$(S^*,I^*,R^*) = (K, 0, N-K),$$ for any $$0\leq K \leq N$$.

• Please provide Mathematica code. Which are the unknowns? It's not recommended to use N and I as variable names Mar 8 at 14:30
• Look into Solve and NSolve, with FindRoot as a numerical backup plan in case those don't work. Mar 8 at 14:39
• You don't have a code,but you tried Solve ? Mar 8 at 14:52
• Solve[{n == s + p + r, u*n - (b/n)*p*s - v*s == 0, (b/n)*p*s - g*p - v*p == 0, g*p - v*r == 0}, {s, p, r}, MaxExtraConditions -> All] works fine for me. Mar 8 at 14:58
• Syntax issue. Equal in infix is ==, not =. That latter is infix for Set (as in "set lhs to value on rhs"). Mar 8 at 15:05

An improved solution based on @MariuszIwaniuk straightforward comment follows with MaxExtraConditions -> Automatic

sol = Solve[{n == s + p + r,u*n - (b/n)*p*s - v*s == 0, (b/n)*p*s - g*p - v*p == 0,g*p - v*r == 0}
, {s, p, r } ,MaxExtraConditions ->   Automatic ]
(*{
{s -> ConditionalExpression[n, u == v],
p -> ConditionalExpression[0, u == v],
r -> ConditionalExpression[0, u == v]}
,
{s ->ConditionalExpression[(n (g + v))/b, u == v],
p -> ConditionalExpression[(v (n - (n (g + v))/b))/(g + v), u == v],
r -> ConditionalExpression[n - (n (g + v))/b - (v (n - (n (g + v))/b))/(g + v), u == v]}
}*)

• Why do I get the following when I use your input in Mathematica? "Solve[{True, -((b p s)/(p + r + s)) + (p + r + s) u - s v == 0, -g p + (b p s)/(p + r + s) - p v == 0, g p - r v == 0}, {s, p, r}, MaxExtraConditions -> {Automatic}]"
– Math
Mar 9 at 12:40
• Try to restart your kernel! I modified my answer and removed curly brackets in MaxExtraConditions -> Automatic  Mar 9 at 12:46
• aha! now it doesn't show solutions for "s"...
– Math
Mar 9 at 12:48
• Code runs as shown in my answer(with fresh kernel). My Mathematicaversion is 12.2 Windows 64 Mar 9 at 12:55
• I'm using 11.1 Mathematica windows 10 but I don't know what's wrong...
– Math
Mar 9 at 13:04
eq1 = mu *NN - beta*(SS*II)/NN - v *SS == 0;
eq2 = beta*(SS*II)/NN - gama*II - v*II == 0;
eq3 = gama*II - v*RR == 0;
eq4 = SS + II + RR == NN;
sol = Solve[{eq1, eq2, eq3}, {SS, II, RR}] Note that the solutions should satisfy eq4 with given parameters.

• Shouldn't SS be equal to N?
– Math
Mar 8 at 14:57
• @Math: Birth rate mu is assumed to be equal to the death rate v. Since these are two given parameters, they do not have to be equal in fact. But your formulation of the problem gives SS=(mu/v)*NN if II=0 and RR=0 (first solution). Mar 8 at 15:05
• This is understood. we have assumed $\mu = \nu$. but your solution omits the "$N$" in the first solution part which is why I was wondering. maybe a typo!
– Math
Mar 8 at 15:30
• @Math as Tugrul indicates, this solution is normalized such that NN=1, this is why it is “missing” from the first solution part as you observed. If mu/v is unitless as it should be, and it is scaled to NN=1, then to have the appropriate units as SS, it must be that (mu/v)*NN==SS and this is true because NN=1. Mar 8 at 16:53
• @Math: The formal symbolic solution includes NN but I dropped it because NN=1 is assumed. @CA Trevillian's explanation is right. Mar 8 at 17:45