4
$\begingroup$

Consider the Jacobian:

$$ J = \begin{bmatrix} -\frac{\beta I}{N} -\xi & -\frac{\beta S}{N} -\xi \\[1ex] \phantom{-}\frac{\beta I}{N} & \phantom{-}\frac{\beta S}{N} -\gamma \end{bmatrix}. $$

Finding the eigenvalues of this matrix at its endemic equilibrium we have:

$$ \lambda_1=(-be-e^2 - \sqrt[]{e} \sqrt[]{-4 b g^2 + 4 g^3 + b^2 e - 8 b g e + 8 g^2 e - 2 b e^2 + 4 g e^2 + e^3}/(2 (g + e))$$, $$\lambda_2=(-b e - e^2 + \sqrt[]{e} \sqrt[]{-4 b g^2 + 4 g^3 + b^2 e - 8 b g e + 8 g^2 e - 2 b e^2 + 4 g e^2 + e^3}/(2 (g + e)$$

Where $b=\beta, \;g=\gamma,\; e=\xi$.

Mathematica wouldn't simplify(Fullsimplify doesn't work!) it to the following which I did by hand:

\begin{align} \lambda_1 &= \frac{-\xi\left(\beta +\xi\right) + \sqrt{\xi^2 \left(\beta +\xi\right)^2 -4\xi \left(\gamma+\xi\right)^2\left(\beta -\gamma\right)} }{2\left(\gamma + \xi\right)}, \\[2ex] \lambda_2 &= \frac{-\xi\left(\beta +\xi\right) - \sqrt{\xi^2 \left(\beta +\xi\right)^2 -4\xi \left(\gamma+\xi\right)^2\left(\beta -\gamma\right)} }{2\left(\gamma + \xi\right)}. \end{align}

Now my question is, how would I do something similar to the following:

(i)$$ J = \begin{bmatrix} -\frac{\beta I}{N} -\xi -\nu & -\frac{\beta S}{N} -\xi \\[1ex] \phantom{-}\frac{\beta I}{N} & \phantom{-}\frac{\beta S}{N} -\gamma -\nu \end{bmatrix}. $$

Finding the eigenvalues at the endemic equilibrium we have:

$${(1/(2 (e + g + v)))(-b e - e^2 - b v - e v - \sqrt[]{e + v} \sqrt[]{b^2 e - 2 b e^2 + e^3 - 8 b e g + 4 e^2 g - 4 b g^2 + 8 e g^2 + 4 g^3 + b^2 v - 6 b e v + 5 e^2 v - 8 b g v + 16 e g v + 12 g^2 v - 4 b v^2 + 8 e v^2 + 12 g v^2 + 4 v^3}, (1/( 2 (e + g + v)))(-b e - e^2 - b v - e v + \sqrt[]{e + v} \sqrt[]{b^2 e - 2 b e^2 + e^3 - 8 b e g + 4 e^2 g - 4 b g^2 + 8 e g^2 + 4 g^3 + b^2 v - 6 b e v + 5 e^2 v - 8 b g v + 16 e g v + 12 g^2 v - 4 b v^2 + 8 e v^2 + 12 g v^2 + 4 v^3}}$$ where $b=\beta$, $e=\xi$, $g=\gamma$, and $v=\nu$.

(ii)$$ J = \begin{bmatrix} -\frac{\beta I}{N} -\nu & -\frac{\beta S}{N} +\gamma \\[1ex] -\sigma & -\gamma -\sigma-\nu \end{bmatrix}. $$

Finding the eigenvalues at the endemic equilibria we have:

$$(1/(2 m (g + m + v)))(-g^2 m - b m^2 - g m^2 - m^3 - 2 g m v - 2 m^2 v - m v^2 - m \sqrt[]{g^4 - 2 b g^2 m + 6 g^3 m + b^2 m^2 - 6 b g m^2 + 11 g^2 m^2 - 2 b m^3 + 6 g m^3 + m^4 + 8 g^3 v - 4 b g m v + 28 g^2 m v - 4 b m^2 v + 28 g m^2 v + 8 m^3 v + 18 g^2 v^2 - 2 b m v^2 + 38 g m v^2 + 18 m^2 v^2 + 16 g v^3 + 16 m v^3 + 5 v^4}, (1/(2 m (g + m + v)))(-g^2 m - b m^2 - g m^2 - m^3 - 2 g m v - 2 m^2 v - m v^2 + m \sqrt[]{(g^4 - 2 b g^2 m + 6 g^3 m + b^2 m^2 - 6 b g m^2 + 11 g^2 m^2 - 2 b m^3 + 6 g m^3 + m^4 + 8 g^3 v - 4 b g m v + 28 g^2 m v - 4 b m^2 v + 28 g m^2 v + 8 m^3 v + 18 g^2 v^2 - 2 b m v^2 + 38 g m v^2 + 18 m^2 v^2 + 16 g v^3 + 16 m v^3 + 5 v^4}$$

where $b=\beta$, $m=\sigma$, $g=\gamma$, and $v=\nu$.

How can I factor the above like in the first example?

ADDENDUM

(iii)$$ J = \begin{bmatrix} -\frac{\beta I}{N} -\nu & -\frac{\beta S}{N} \\[1ex] -\sigma & -\sigma-\nu \end{bmatrix}. $$

Once again, finding the eigenvalues at the endemic equilibria we have

$$ (-b m^2 - m^3 - 2 m^2 v - m v^2 - m \sqrt[]{b^2 m^2 - 2 b m^3 + m^4 - 4 b m^2 v + 8 m^3 v - 2 b m v^2 + 18 m^2 v^2 + 16 m v^3 + 5 v^4})/(2 m (m + v)), (-b m^2 - m^3 - 2 m^2 v - m v^2 + m \sqrt[]{b^2 m^2 - 2 b m^3 + m^4 - 4 b m^2 v + 8 m^3 v - 2 b m v^2 + 18 m^2 v^2 + 16 m v^3 + 5 v^4})/(2 m (m + v)) $$

Using Fullsimplify we have

$$-((b m + (m + v)^2 + \sqrt[]{ b^2 m^2 - 2 b m (m + v)^2 + (m + v)^3 (m + 5 v)})/(2 (m + v))), -(( b m + (m + v)^2 - \sqrt[]{ b^2 m^2 - 2 b m (m + v)^2 + (m + v)^3 (m + 5 v)})/(2 (m + v)))$$

Considering Blue's solution to my other problems, is this the simplest it will get?

ADDENDUM 2

(iv)$$ J = \begin{bmatrix} -\frac{\beta I}{N} -\nu & -\frac{\beta S}{N} \\[1ex] \frac{\beta I}{N} & \frac{\beta S}{N} - \gamma - \nu \end{bmatrix}. $$

Once again, finding the eigenvalues at the endemic equilibria we have

$$ (-b v - \sqrt[]v \sqrt[]{-4 b g^2 + 4 g^3 + b^2 v - 8 b g v + 12 g^2 v - 4 b v^2 + 12 g v^2 + 4 v^3})/(2 (g + v)), (-b v + \sqrt[]v \sqrt[]{-4 b g^2 + 4 g^3 + b^2 v - 8 b g v + 12 g^2 v - 4 b v^2 + 12 g v^2 + 4 v^3})/(2 (g + v)) $$

Using Fullsimplify we have

$$-((b v + \sqrt[]v \sqrt[]{b^2 v - 4 b (g + v)^2 + 4 (g + v)^3})/( 2 (g + v))), (-b v + \sqrt[]v \sqrt[]{b^2 v - 4 b (g + v)^2 + 4 (g + v)^3})/(2 (g + v))$$

$\endgroup$
22
  • 1
    $\begingroup$ Mathematical modelling of infectious diseases? $\endgroup$
    – Deepak
    Apr 7 at 12:56
  • 3
    $\begingroup$ Can't you remove this unnecessary variable renaming ? $\endgroup$
    – user65203
    May 24 at 9:33
  • 1
    $\begingroup$ For (i), I get to $$\frac{-h k \mp \sqrt{\;k (h^2 k + 4 (g-h + k) (g+k)^2\;}}{2(g + k)}$$ where $h:=b+e$ and $k:=e+v$. Does something like that help? $\endgroup$
    – Blue
    May 24 at 10:50
  • 1
    $\begingroup$ @Math: ("Extended discussion" warning. This may be my last comment.) I don't get the Jacobian in (ii), with the above $S*$ and $I*$ substitutions, to yield the eigenvalues you gave without imposing additional relations on the parameters. Maybe I'm missing something. Be that as it may ... I guess the broadest solution requires a full description of the SEI/S model(s), which appears beyond the scope of discussion here, so I'll just leave my answer as-is and consider my contribution to this question complete. ... Cheers! $\endgroup$
    – Blue
    May 24 at 22:06
  • 1
    $\begingroup$ I made a typo: it should read $(S_2^*, E_2^*, I_2^*)$ $\endgroup$
    – Math
    May 25 at 15:21
1
+50
$\begingroup$

For (i), I get to $$\frac{-h k \mp \sqrt{\;h^2 k^2 + 4k\ell^2(\ell-h)\;}}{2\ell} \tag1$$ where $h:=b+e$, $k:=e+v$, $\ell:=e+g+v$.

For (ii),

$$\frac{ - (p^2 + q) \mp \sqrt{ (p^2 - q)^2 + 4 v p^3 }}{2 p} \tag2$$ where $p:=g+m+v$ and $q:=m(b-g)$.


Addendum. OP has provided a bit of backstory to (ii), so I thought I'd use it to illustrate how sneaking-up on a solution can sometimes be easier than trying to find patterns in a final result generated by brute-force application of a computer algebra system. (This a common strategy for me.)

Take OP's Jacobian $J$ for (ii) $$J = \begin{bmatrix}-\frac{bI}{N}-v & -\frac{bS}{N}+g \\ -m & -g-m-v\end{bmatrix} \tag{A.1}$$ and substitute $$S\to \frac{N(g+v)(m+v)}{bm} \qquad I\to\frac{Nm(g+v)(m+v)}{bm(g+m+v)}\left(\frac{bm}{(g+v)(m+v)}-1\right) \tag{A.2}$$ Now, generally, if the Eigenvalues command (with FullSimplify or whatever) gives a pretty result, take it and run. If the result is a mess, step back and take a semi-manual approach. Here, use CharacteristicPolynomial to get a polynomial of the form $Ax^2+Bx+C$. The coefficients may still be messes, but they're smaller messes. To isolate them, use CoefficientList (with, say, Factor). The results in this case are $$\begin{align} A &= g+m+v \\ B &= g^2 + b m + g m + m^2 + 2 g v + 2 m v + v^2 \\ C &= (g + m + v) (b m - g m - g v - m v - v^2) \end{align} \tag{A.3}$$ The forms of $A$ and $C$ suggest that $g+m+v$ wants to be a unified quantity; let's call it $p$. Note that we can find less-obvious instances of $p$ elsewhere in the coefficients: $$\begin{align} A &= p &&= p\\ B &= b m + g^2 + m^2 + v^2 + g m + 2 g v + 2 m v &&= bm + p^2 - gm = (b-g)m+p^2 \\ C &= p (b m - g m - g v - m v - v^2) &&= p((b-g)m-pv) \end{align} \tag{A.4}$$ These forms suggest that $(b-g)m$ also wants to be a unified quantity; call it $q$. So, we have: $$A = p\qquad B=p^2+q \qquad C = p(q-pv)$$ From here, applying the Quadratic Formula is almost effortless, and we get roots (ie, eigenvalues of $J$) of the form $$\frac{-B\pm\sqrt{B^2-4AC}}{2A}=\frac{-(p^2+q)\pm \sqrt{\Delta}}{2p} \tag{A.5}$$ where $$\begin{align} \Delta &:= (p^2+q)^2-4p^2(q-pv) \\ &\;= p^4+2p^2q+q^2\;-4p^2q+4p^3v \\ &\;= p^4-2p^2q+q^2\;+4p^3v \\ &\;= (p^2-q)^2+4p^3v \end{align} \tag{A.6}$$ Thus, $(A.5)$ gives us $(2)$ as before. $\square$

Finding a cleaner form of $\Delta$ was far easier in $pq$-form than when sifting through the $22$-term counterpart given in the original question. Seeing components in earlier stages of a problem can inform how they want to be organized. (I suspect that the groupings $g+m+v$ and $m(b-g)$ are meaningful even in the earliest stages of the problem, reflecting how parameters in the SEI(S) models influence each other.)

$\endgroup$
10
  • $\begingroup$ Nice, both solutions check out! Can you tell me how you did it in the answer so in the future I know what to do? I have added a small addendum, since you answered my previous question(s) you are most suited to answer this addendum, I hope you can do this favour! And thank you very much for your answer :) $\endgroup$
    – Math
    May 24 at 14:47
  • $\begingroup$ I will give you the bounty but I have one more question that is similar to this. Shall I add an addendum 2 here or ask a separate question? I would use your ideas above in Mathematica however I'm just started learning Mathematica so I don't really understand how to use all the commands. $\endgroup$
    – Math
    May 26 at 13:32
  • $\begingroup$ @Math: Repeatedly adding tasks to a question (especially after it has been answered) is generally discouraged, but if it's merely yet-another instance of simplifying the Jacobian eigenvalues, I don't see too much of a problem. Please, though, give the form of Jacobian $J$ and substitutions for $S$ and $I$ (watch for typos! :). As I like to think I made clear in my Addendum, the "final form" of the eigenvalues can be unnecessarily-difficult to sift through. $\endgroup$
    – Blue
    May 26 at 15:08
  • $\begingroup$ @Math: As for Mathematica commands: Don't get too hung-up on those. After all, my point is to ease-off the MMA gas pedal to get a better view of what's happening. Heck, you don't need MMA for any of this. The char-poly of a $2\times 2$ matrix, say $\begin{bmatrix}a&b\\ c&d\end{bmatrix}$, is dead-simple to calculate by hand: $x^2-(a+d)x+(ad-bc)$; whereupon applying the Quadratic Formula is straightforward. In your problem, $a$, $b$, $c$, $d$ are unweildy, so MMA is helpful in symbol-crunching, but you can ease-in to the convenience. Hitting each coeff w/FullSimplify can get you pretty far. $\endgroup$
    – Blue
    May 26 at 15:09
  • $\begingroup$ I felt guilty asking. I was following your steps but I must've made a mistake somewhere hence I ask. $\endgroup$
    – Math
    May 27 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.