Difference between revisions of "Physics 212, 2019: Lecture 10"

From Ilya Nemenman: Theoretical Biophysics @ Emory
Jump to: navigation, search
(Created page with "{{PHYS212-2019}} In this lecture, we will introduce models that involved coupled, nonlinear ordinary differential equations, as well as methods for solving them. The first m...")
 
Line 1: Line 1:
 
{{PHYS212-2019}}
 
{{PHYS212-2019}}
  
In this lecture, we will introduce models that involved coupled, nonlinear ordinary differential equations, as well as methods for solving them.
+
To date, we only considered simple dynamics, which has a single dynamical variable, whose first temporal derivative is determined by the variable itself. In this lecture, we will introduce models that involved coupled, nonlinear ordinary differential equations, as well as methods for solving them.
  
 +
==Growth with carrying capacity==
 
The first model we will consider is the Malthusian growth with carrying capacity -- where a population grows nearly exponentially fast, before it reaches the maximum population size that can be supported by the environment, <math>dn/dt = r n(n_0-n)</math>, where <math>n_0</math> is known as the carrying capacity. During the previous lecture and the lab, you were supposed to solve the corresponding ODE numerically -- and you will have noticed how the growth starts quickly, and then saturates.  
 
The first model we will consider is the Malthusian growth with carrying capacity -- where a population grows nearly exponentially fast, before it reaches the maximum population size that can be supported by the environment, <math>dn/dt = r n(n_0-n)</math>, where <math>n_0</math> is known as the carrying capacity. During the previous lecture and the lab, you were supposed to solve the corresponding ODE numerically -- and you will have noticed how the growth starts quickly, and then saturates.  
  
Our second model that we will consider is the predator-prey model of population growth. You can read a lot about such generic systems, including their history, [https://en.wikipedia.org/wiki/Lotka–Volterra_equations here]. Briefly, we consider a prey animal species <math>x</math>, which grows exponentially, but at the same time it's eaten by the predator species, denoted by <math>y</math>. The dynamics of the prey is <math>\frac{dx}{dt}=rx - \alpha xy</math>, where the second term denotes the capture of the prey. Indeed, the more prey animals there are, the easier it is to capture them, and the more predators there are, the more prey they will capture, resulting in the bilinear form <math>\alpha x y</math>.  At the same time, when the predators eat, they have enough food to procreate -- but usually killing one prey only produces fewer than one predators. Further, predators also die a natural death. As a result, <math>\frac{dy}{dt}= \beta xy - d y</math>, where <math>\beta<\alpha</math>. This is an interesting dynamical system that exhibits oscillations -- number of preys goes up, they become abundant, this leads to the growth of the number of predators. Predators start eating prey, and collapse their number; then there's an insufficient number of prey to support the predator population, and the latter collapses as well. The whole cycle restarts with the renewed growth of prey at that point.
+
==Predator-prey Lotka-Volterra model==
+
Our second model that we will consider is the predator-prey model of population growth. You can read a lot about such generic systems, including their history, [https://en.wikipedia.org/wiki/Lotka–Volterra_equations here]. Briefly, we consider a prey animal species <math>x</math>, which grows exponentially, but at the same time it's eaten by the predator species, denoted by <math>y</math>. The dynamics of the prey is <math>\frac{dx}{dt}=rx - \alpha xy</math>, where the second term denotes the capture of the prey. Indeed, the more prey animals there are, the easier it is to capture them, and the more predators there are, the more prey they will capture, resulting in the bilinear form <math>\alpha x y</math>.  At the same time, when the predators eat, they have enough food to procreate -- but usually killing one prey only produces fewer than one predators. Further, predators also die a natural death. As a result, <math>\frac{dy}{dt}= \beta xy - d y</math>, where <math>\beta<\alpha</math>. This is an interesting dynamical system that exhibits oscillations -- number of preys goes up, they become abundant, this leads to the growth of the number of predators. Predators start eating prey, and collapse their number; then there's an insufficient number of prey to support the predator population, and the latter collapses as well. The whole cycle restarts with the renewed growth of prey at that point. One can think of more complicated similar systems of equations, but we will leave this to the homework project.
==Runge-Kutta 2 integration==
 
  
 +
==Nonlinear pendulum==
 +
Consider a non-idealized pendulum, which undergoes oscillations with a non-infinitesimal amplitude. Then the restoring torque that it experiences is <math>M=mgl \sim \theta</math>, where <math>m</math> is the mass, <math>l</math> is the pendulum length, and <math>\theta</math> is the angle its axis forms with the vertical. Newton's equations of motion give for this system <math>\frac{d^2\theta}{dt^2}=gl\sin\theta</math>. This seems like a single equation, but it is second order in the temporal derivative. It is then equivalent to two coupled first order differential equations <math>\omega =\frac{d\theta}{dt}</math> and <math>\frac{d\omega}{dt^2}=gl\sin\theta</math>, where <math>\omega</math> is the angular velocity
 +
 +
==Runge-Kutta 2 integration of systems of ODEs==
 +
How do we solve such coupled, nonlinear dynamical systems numerically?
  
 
===Your work===
 
===Your work===

Revision as of 00:39, 17 February 2019

Emory Logo

Back to the main Teaching page.

Back to Physics 212, 2019: Computational Modeling.

To date, we only considered simple dynamics, which has a single dynamical variable, whose first temporal derivative is determined by the variable itself. In this lecture, we will introduce models that involved coupled, nonlinear ordinary differential equations, as well as methods for solving them.

Growth with carrying capacity

The first model we will consider is the Malthusian growth with carrying capacity -- where a population grows nearly exponentially fast, before it reaches the maximum population size that can be supported by the environment, , where is known as the carrying capacity. During the previous lecture and the lab, you were supposed to solve the corresponding ODE numerically -- and you will have noticed how the growth starts quickly, and then saturates.

Predator-prey Lotka-Volterra model

Our second model that we will consider is the predator-prey model of population growth. You can read a lot about such generic systems, including their history, here. Briefly, we consider a prey animal species , which grows exponentially, but at the same time it's eaten by the predator species, denoted by . The dynamics of the prey is , where the second term denotes the capture of the prey. Indeed, the more prey animals there are, the easier it is to capture them, and the more predators there are, the more prey they will capture, resulting in the bilinear form . At the same time, when the predators eat, they have enough food to procreate -- but usually killing one prey only produces fewer than one predators. Further, predators also die a natural death. As a result, , where . This is an interesting dynamical system that exhibits oscillations -- number of preys goes up, they become abundant, this leads to the growth of the number of predators. Predators start eating prey, and collapse their number; then there's an insufficient number of prey to support the predator population, and the latter collapses as well. The whole cycle restarts with the renewed growth of prey at that point. One can think of more complicated similar systems of equations, but we will leave this to the homework project.

Nonlinear pendulum

Consider a non-idealized pendulum, which undergoes oscillations with a non-infinitesimal amplitude. Then the restoring torque that it experiences is , where is the mass, is the pendulum length, and is the angle its axis forms with the vertical. Newton's equations of motion give for this system . This seems like a single equation, but it is second order in the temporal derivative. It is then equivalent to two coupled first order differential equations and , where is the angular velocity

Runge-Kutta 2 integration of systems of ODEs

How do we solve such coupled, nonlinear dynamical systems numerically?

Your work

Problem 1
Use a different differential equation from those provided to show that Runge-Kutta 2 has error , and the scaling of the error is not a scaling due to the equation being solved, but largely due to the methods used to solve it. Do this in a Jupyter notebook.

Scripts for this Lecture

GrowthFunctions -- module defining different growth functions.
Integrators -- module defining different integrators (Euler and Runge-Kutta, which we will use during the next lecture).
Module 2 -- catch-all scripts I used during the class.
Module 2 as a notebook -- integration as a notebook.