This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0340. It is primarily for students who have some experience using Mathematica. If you have never used Mathematica before and would like to learn more of the basics for this computer algebra system, it is strongly recommended looking at the APMA 0330 tutorial. As a friendly reminder, don't forget to clear variables in use and/or the kernel. The Mathematica commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts.

Finally, you can copy and paste all commands into your Mathematica notebook, change the parameters, and run them because the tutorial is under the terms of the GNU General Public License (GPL). You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015;

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Return to Part VII of the course APMA0340
Introduction to Linear Algebra with Mathematica


Example 1: The scaled equations (see Hal L. Smith and Paul Waltman, The Theory of the Chemostat: Dynamics of Microbial Competition, Cambridge University Press, 1995) for the growth of two populations of microorganisms x1 and x2, with corresponding parameters ai and mi, i=1,2, in a chemostat are

\[ \begin{cases} \frac{{\text d}S}{{\text d}t} &= 1 - S - \frac{m_1 S\,x_1}{a_1 +S} - \frac{m_2 S\,x_2}{a_2 +S} , \\ \frac{{\text d}x_1}{{\text d}t} &= x_1 \left( \frac{m_1 S}{a_1 +S} - 1 \right) , \\ \frac{{\text d}x_2}{{\text d}t} &= x_2 \left( \frac{m_2 S}{a_2 +S} - 1 \right) , \end{cases} \qquad\qquad S(0) \ge 0, \quad x_1 (0) > 0, \quad x_2 (0) > 0. \]
Here S(t) denotes the concentration of the nutrient at time t. Letting Σ = a - S - x1 - x2, we can see that
\[ \begin{cases} \frac{{\text d}\Sigma}{{\text d}t} &= - \Sigma , \\ \frac{{\text d}x_1}{{\text d}t} &= x_1 \left( \frac{m_1 \left( 1- \Sigma - x_1 - x_2 \right)}{a_1 + 1 - \Sigma - x_1 - x_2} - 1 \right) , \\ \frac{{\text d}x_2}{{\text d}t} &= x_2 \left( \frac{m_2 \left( 1- \Sigma - x_1 - x_2 \right)}{a_2 + 1 - \Sigma - x_1 - x_2} - 1 \right) , \end{cases} \qquad\qquad \Sigma (0) \le 1 , \quad x_1 (0) > 0, \quad x_2 (0) > 0. \]
It can be shown that
\[ \lim_{t\to \infty} \Sigma (t) =0 , \]
where the convergence is exponential. Introducing the break-even concentrations
\[ \lambda = \frac{a}{m-1} , \]
the trajectories on the set Σ=0 satisfy
\[ \begin{cases} \frac{{\text d}x_1}{{\text d}t} &= x_1 \left( \frac{m_1 \left( 1 - x_1 - x_2 \right)}{a_1 +1 -x_1 - x_2} -1 \right) , \\ \frac{{\text d}x_2}{{\text d}t} &= x_2 \left( \frac{m_2 \left( 1 - x_1 - x_2 \right)}{a_2 +1 -x_1 - x_2} -1 \right) , \end{cases} \qquad\qquad x_1 (0) > 0, \quad x_2 (0) > 0, \quad x_1 + x_2 \le 1; \]
\[ \begin{cases} \frac{{\text d}x_1}{{\text d}t} &= x_1 \, \frac{m_1 -1}{1+ a_1 -x_1 - x_2} \left( 1- \lambda_1 - x_1 - x_2 \right) , \\ \frac{{\text d}x_2}{{\text d}t} &= x_2 \, \frac{m_2 -1}{1+ a_2 -x_1 - x_2} \left( 1- \lambda_2 - x_1 - x_2 \right) , \end{cases} \qquad\qquad x_1 (0) > 0, \quad x_2 (0) > 0, \quad x_1 + x_2 \le 1. \]
The above system has three equilibrium solutions:
\[ E_0 = (0,0), \qquad E_1 = (1- \lambda_1 , 0), \qquad E_2 = (0,1-\lambda_2 ) . \]
If λ1 is different from λ2, then there is no "interior" rest point, that is, a rest point with both components positive. The only interesting cases are where mi > 1 and 0 < λi < 1 for i = 1,2.
Theorem: Suppose that mi > 1, i = 1,2, and that 0 < λ1 < λ2 < 1. Then any solution of the above chemostat system with xi > 0 satisfies
\begin{eqnarray*} \lim_{t\to \infty} S(t) &=& \lambda_1 , \\ \lim_{t\to \infty} x_1 (t) &=& 1- \lambda_1 , \\ \lim_{t\to \infty} x_2 (t) &=& 0. \end{eqnarray*}

Example 2: A standard single-species logistic model with continuous constant dispersal rate between two heterogeneous patches can be written as follows

\begin{eqnarray*} \frac{{\text d}N_1}{{\text d}t} &=& r_1 N_1 \left( 1 - \frac{N_1}{M_1} \right) - m\,N_1 + m \left( 1 - \delta \right) N_2 , \\ \frac{{\text d}N_2}{{\text d}t} &=& r_2 N_2 \left( 1 - \frac{N_2}{M_2} \right) - m\,N_2 + m \left( 1 - \delta \right) N_1 , \end{eqnarray*}
where N1, N2 represents the population density in the corresponding habitat at time t, ri and Mi are the intrinsic rate of population increase and the carrying capacity of population with index i, δ is the fraction of migrants dying during migration and m is the emigration rate, a constant. Above dispersal model may be used to characterize the mobility of bird or, insect    ■

Example 3: N. Gregory Mankiw, David Romer, and David Weil created a human capital augmented version of the Solow–Swan model that can explain the failure of international investment to flow to poor countries. In this model output and the marginal product of capital (K) are lower in poor countries because they have less human capital than rich countries. Similar to the textbook Solow–Swan model, the production function is of Cobb–Douglas type:    ■

Example 4: The Ramsey–Cass–Koopmans model, or Ramsey growth model, is a neoclassical model of economic growth based primarily on the work of Frank P. Ramsey (1903--1930), with significant extensions by David Cass (1937--2008) and Tjalling Koopmans (1910--1985).    ■

  1. Cass, David (1965). "Optimum Growth in an Aggregative Model of Capital Accumulation". Review of Economic Studies. 32 (3): 233–240. doi:10.2307/2295827
  2. Gourinchas, P.-O., The Ramsey-Cass-Koopmans Model, Berkely.
  3. Koopmans, T. C. (1965). "On the Concept of Optimal Economic Growth". The Economic Approach to Development Planning. Chicago: Rand McNally. pp. 225–287.
  4. Ramsey, Frank P. (1928). "A Mathematical Theory of Saving". Economic Journal. 38 (152): 543–559. doi:10.2307/2224098


Return to Mathematica page
Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions