Day | Section | Topic |
---|---|---|
Mon, Aug 25 | 1.1 | Modeling with Differential Equations |
Wed, Aug 27 | 1.2 | Separable Differential Equations |
Fri, Aug 29 | 1.3 | Geometric and Quantitative Analysis |
We talked about some examples of differential equations.
We talked about dependent and independent variables, the order of a differential equation and how to tell if a function is a solution of a differential equation. We also talked about initial conditions.
Spring-Mass Model. The force of a mass at the end of a spring can be modeled by Hooke’s Law which says where is the displacement of the spring from its rest position.
The last question led to a discussion of linear versus non-linear differential equations. It’s usually much harder to solve non-linear equations! We will also study systems of differential equations, like the following.
Here is a graph showing these equations as a vector field (with constants ).
Logistic Growth. where is a proportionality constant and is the carrying capacity.
Today we talked about separable equations. We solved the following examples.
Solve .
Solve . (https://youtu.be/1_Q4kndQrtk)
Not every differential equation is separable. For example: is not separable.
Which of the following differential equations are separable? (https://youtu.be/6vUjGgI8Dso)
We finished with this example:
Newton’s Law of Cooling. The temperature of a small object changes at a rate proportional to the difference between the object’s temperature and its surroundings.
Mixing Problem. Salty water containing 0.02 kg of salt per liter is flowing into a mixing tank at a rate of 10 L/min. At the same time, water is draining from the tank at 10 L/min.
We didn’t get to this last example in class, but it is a good practice problem.
Today we talked about slope fields.
Here is a slope field grapher tool that I made a few years ago. You can also use Sage to plot slope fields. Here is an example from the book, with color added.
= var('t, y')
t, y = y^2/2 - t
f(t, y) -1, 5), (y, -5, 10), headaxislength=3, headlength=3,
plot_slope_field(f, (t, =['$t$','$y(t)$'], color = "blue") axes_labels
Consider the logistic equation with harvesting. where is a number of rabbits that are harvested each year.
The logistic equation (with or without harvesting) is autonomous which means that the rate of change does not depend on time, just on . An equilibrium solution for an autonomous differential equation is a solution where for all .
Day | Section | Topic |
---|---|---|
Mon, Sep 1 | Labor day - no class | |
Wed, Sep 3 | 1.7 | Bifurcations |
Fri, Sep 5 | 1.6 | Existence and Uniqueness of Solutions |
Last time we talked about equilibrium solutions of autonomous equations. An equilibrium for is stable (also known as a sink or attactor) if any solution with initial value close to converges to as . An equilibrium is unstable (also known as a source or repeller) if all solutions move away from as .
We talked about the phase line for an autonomous ODE.
Suppose that is a family of differential equations that depends on a parameter . A bifurcation point is a value of the parameter where the number of equilibrium solutions changes. A bifurcation diagram is a graph that shows how the phase lines change as the value of a parameter changes.
You can use Desmos to help with the previous problem. Using to represent , you can graph the region where is positive in blue and the region where is negative in red. Then it is easier to draw the phase lines in the bifurcation diagram.
Today we talked about two important theorems in differential equations.
Existence Theorem. Suppose that where is a continuous function in an open rectangle . For any inside the rectangle, there exists a solution defined on an open interval around such that .
This theorem guarantees that in most circumstances, we are guarantee to have solutions to differential equations. But there are things to watch out for. Solutions might blow up in finite time, so they might not be defined on the whole interval .
Uniqueness Theorem. Suppose that where both and its partial derivative are continuous in an open rectangle . Then for any , there exists a unique solution defined on an open interval around such that .
If the partial derivative is not continuous, then we might not get unique solutions. Here is an example.
One very nice consequence of the uniqueness theorem is this important concept:
No Crossing Rule. If and are both continuous, then solution curves for the differential equation cannot cross.
This illustrates that a formula for a solution to might not apply after we reach a point where is no longer continuous.
Day | Section | Topic |
---|---|---|
Mon, Sep 8 | 1.4 | Analyzing Equations Numerically |
Wed, Sep 10 | 1.4 | Analyzing Equations Numerically - con’d |
Fri, Sep 12 | 1.5 | First-Order Linear Equations |
Many ODEs cannot be solved analytically. That means there is no formula you can write down using standard functions for the solution. This is true even when the existence and uniqueness theorems apply. So there might be a solution that doesn’t have a solution you can write down. But you can still approximate the solution using numerical techniques.
Today we introduced Euler’s method which is the simplest method to numerically approximate the solution of a first order differential equation. We used it to approximate the solution to
from numpy import *
import matplotlib.pyplot as plt
def EulersMethod(f,a,b,h,y0):
'''
Approximates the solution of y' = f(t, y) on the interval a < t < b with initial
condition y(a) = y0 and step size h.
Returns two lists, one of t-values and the other of y-values.
'''
= a, y0
t, y = [a], [y0]
ts, ys while t < b:
= y + f(t,y)*h
y = t + h
t
ts.append(t)
ys.append(y)return ts, ys
= lambda t,y: y**2 / 2 - t
f
# h = 1
= EulersMethod(f, -1, 5, 1, 0)
ts, ys
plt.plot(ts,ys)# h = 0.1
= EulersMethod(f, -1, 5, 0.1, 0)
ts, ys
plt.plot(ts,ys)# h = 0.01
= EulersMethod(f, -1, 5, 0.01, 0)
ts, ys
plt.plot(ts,ys) plt.show()
Here’s the output for this code and here is a version with the slope field added.
After demonstrating how to implement Euler’s method in code, we talked about some simpler questions that we can answer with pencil & paper.
Euler’s method is only an approximation, so there is a gap between the actual y-value at and the Euler’s method approximation. That gap is the error in Euler’s method. There are two sources of error.
As
gets smaller, the discretization error gets smaller, but the rounding
error gets worse.
A worst case upper bound for the error is:
where
,
,
and
is the smallest floating point number our computer can accurately
represent. Using the standard base-64 floating point numbers,
.
In practice, Euler’s method tends to get more accurate as
gets smaller until around
.
After that point the rounding error gets worse and there is no advantage
to shrinking
further.
Today I announced Project 1 which is due next Wednesday. I’ve been posting Python & Sage code examples, but if you would rather use Octave/Matlab, here are some Octave code examples.
Runge-Kutta methods are a family of methods to solve ODEs numerically. Euler’s method is a first order Runge-Kutta method, which means that the discretization error for Euler’s method is which means that the error is less than a constant times to the first power.
Better Runge-Kutta methods have higher order error bounds. For example, RK4 is a popular method with fourth order error . Another Runge-Kutta method is the midpoint method also known as RK2 which has second order error.
Midpoint Method (RK2). Algorithm to approximate the solution of the initial value problem on the interval with initial condition .
In RK2 the slope used to calculate the next point from a point is the slope at the midpoint between and the Euler’s method next step. In RK4, the slope used is a weighted average of the slopes at , , , and shown in the diagram above. Specifically, it is 1/6 of the slopes at and plus 1/3 of the slopes at and .
There are even higher order Runge-Kutta methods, but there is a trade-off between increasing the order and increasing complexity.
After we talked about Runge-Kutta methods, we introduced the integrating factors method for solving first order linear ODEs The key idea is that if is an antiderivative of , then is an integrating factor for the ODE. Since by the product rule, we can re-write the ODE as: Then just integrate both sides to find the solution.
Today we looked at more examples of linear first order ODEs.
Write down an IVP to model this situation using to represent the amount of salt in the tank.
Use integrating factors to solve the IVP. (https://youtu.be/b5QWC2DA5l4)
Sometimes it can be faster to use a guess-and-check method instead of integrating factors to solve linear ODEs. Here is an example. Consider the first order linear ODE: You might guess that there is a constant such that is a solution of this differential equation. This is true!
So is one particular solution for this ODE. To get all of the solutions, we need some theory:
A first order linear differential equation is homogeneous if it can be put into the form Any inhomogeneous equation has a general solution where
Day | Section | Topic |
---|---|---|
Mon, Sep 15 | 2.1 | Modeling with Systems |
Wed, Sep 17 | 2.2 | The Geometry of Systems |
Fri, Sep 19 | 2.4 | Solving Systems Analytically |
Consider the inhomogeneous linear ODE:
If you know that waves can be modeled by equations of the form
,
then you might guess that the solution
might have this form. Then substituting into the equation, we get
By combining like terms, we get a system of equations
The solution is
,
which means that
is one solution to the ODE.
What is the corresponding homogeneous equation, and what is its solution?
What is the general solution to ?
Why is the method of integrating factors harder here?
After that, we introduced systems of differential equations. We started with this simple model of a predator-prey system with rabbits and foxes :
A graph of the vector field defined by a system of two differential equations is called a phase plane. Solution curves are parametric functions and that follow the vector field in the phase plane.
According to Hooke’s law the force of a spring is or equivalently This is a homogeneous 2nd order linear differential equation.
We can convert a second order ODE to a first order system of equations by using an extra variable equal to the first derivative . Then , so we get the system:
Today we looked at more examples of systems of ODEs.
Suppose that we have two species that compete for resources and their populations and satisfy
Later in chapter 3 we will learn how to classify different types of equilibrium solutions on the phase plane using linear algebra. For now, here is a preview of some of the types of equilibria.
A simple model used to understand epidemics is the SIR-model, which stands for Susceptible-Infected-Recovered. The idea is that a disease will spread from people who are infected to people who are still susceptible. After infected people recover, they are usually immune to the disease, at least for a little while. In the system below, is the percent of the population that is still susceptible, is the percent that are currently infected, and is the percent of the population that are recovered. The constants and are the transmission rate and recovery rate, respectively.
Under what circumstances is the number of infected people increasing?
If we introduce a vaccine, what effect might that have on the model?
What if the disease is fatal for some people? How would you change the model to account for that? Hint: You could have a constant that represents the fatality rate, i.e., the proportion of the infected population that die each day.
If you divide by , you get the differential equation Solve this differential equation with initial condition and .
Here is a plot showing the solution superimposed on the direction field (for and only).
Today we talked about decoupled systems and partially coupled systems.
A system of equations is called decoupled since the -variable doesn’t depend on , and the -variable doesn’t depend on . You can solve the differential equations in a decouple system separately.
A system of equations is partially coupled. You can solve for first, and then substitute into the first equation to create a single variable differential equation for .
Solve the system
Solve the system with initial conditions and . (https://youtu.be/sJ3CuM-QmOk)
Here is a Desmos graph showing the solutions to the last problem as different parametric curves.
Day | Section | Topic |
---|---|---|
Mon, Sep 22 | 2.3 | Numerical Techniques for Systems |
Wed, Sep 24 | C1 | Complex Numbers and Differential Equations |
Fri, Sep 26 | C2 | Solving System Analytically - con’d |
Today we introduced Euler’s method for systems of differential equations equations.
A more realistic model for the rabbits & foxes might be if the rabbits growth was constrained by a carrying capacity of 10 thousand rabbits (logistic growth), in the absence of foxes. How would this change the differential equation above?
Now use Euler’s method to investigate the long-run behavior of the rabbits & foxes with this new model. What changes?
Now talk about the equation for a pendulum:
Typically in introductory physics, you find an approximate solution of this equation by assuming that the angle stays small and so . But we can use Euler’s method instead to generate solutions numerically (Python).
Today we introduced complex numbers and talked about how they can arise in differential equations.
A complex number is an expression where are real numbers and has the property that .
The real-part of is and the imaginary part is .
The absolute value .
The complex conjugate of is .
Calculate .
Show that for any complex number .
Euler’s Formula.
A complex-valued function is a function where both and are real-valued functions. You can integrate and differentiate complex-valued functions by integrating/differentiating the real and imaginary parts.
Polar Form. Any complex number can be expressed as , where and is an angle called the argument of .
Convert and to polar form, then multiply them by applying the formula
Solve the differential equation .
Show that is a solution for the differential equation . Hint: The chain rule applies to complex-valued functions, so .
Today we talked about homogeneous second order linear differential equations with constant coefficients.
These equations are used to model simple harmonic oscillators such as a spring where the total force depends on a spring force and a friction or damping force :
General Solution of a 2nd Order Homogeneous Linear Differential Equation.
Theorem. If and are linearly independent solutions of then the general solution is
Using the language of linear algebra, we can describe the result above several ways:
We applied the theorem above to the following two examples:
Find the general solution to . (https://youtu.be/Pxc7VIgr5kc?t=241)
Find the general solution of . Hint: Use the quadratic formula.
Day | Section | Topic |
---|---|---|
Mon, Sep 29 | Review | |
Wed, Oct 1 | Midterm 1 | |
Fri, Oct 3 | 3.1 | Linear Algebra in a Nutshell |
We talked about the midterm 1 review problems. We also looked at this example:
Today we talked about homogeneous linear systems of differential equations. These can be expressed using a matrix. For example, if , then the system of differential equations can be re-written as It turns out that the eigenvectors and eigenvalues of tell you a lot about the solutions of the system. We did these exercises in class.
Find the characteristic polynomial and eigenvalues of the matrix
Show that is an eigenvector for . What is its eigenvalue?
Find an eigenvector for corresponding to the eigenvalue by finding the null space of .
After those examples, we did a workshop.
We also talked about how to calculate the eigenvectors of a matrix
using a computer. In Python, the sympy
library lets you
calculate the eigenvectors of a matrix exactly when possible. You can
also do this in Octave if you load the symbolic
package.
from sympy import *
= Matrix([[3,5],[2,6]])
A '''
The .eigenvects() method returns a list of tuples containing:
1. an eigenvalue,
2. its multiplicity (how many times it is a root), and
3. a list of corresponding eigenvectors.
'''
pretty_print(A.eigenvects())
Day | Section | Topic |
---|---|---|
Mon, Oct 6 | 3.2 | Planar Systems |
Wed, Oct 8 | 3.2 | Planar Systems - con’d |
Fri, Oct 10 | 3.3 | Phase Plane Analysis of Linear Systems |
Today we talked about how to solve a homogeneous linear system using the eigenvectors and eigenvalues of when the eigenvalues are all real with no repeats. We did the following examples:
Fact. If is an eigenvector of with eigenvalue , then is a solution of the linear system .
Fact 2. The general solution of a planar system with distinct real eigenvalues and corresponding eigenvectors is
We used these facts to find the general solutions for the following systems.
We also talked about how to graph the solutions.
We finished with the following question:
Day | Section | Topic |
---|---|---|
Mon, Oct 13 | Fall break - no class | |
Wed, Oct 15 | 3.4 | Complex Eigenvalues |
Fri, Oct 17 | 3.5 | Repeated Eigenvalues |
Day | Section | Topic |
---|---|---|
Mon, Oct 20 | 3.6 | Changing Coordinates |
Wed, Oct 22 | 3.7 | The Trace-Determinant Plane |
Fri, Oct 24 | 3.7 | The Trace-Determinant Plane - con’d |
Day | Section | Topic |
---|---|---|
Mon, Oct 27 | Review | |
Wed, Oct 29 | Midterm 2 | |
Fri, Oct 31 | 3.8 | Linear Systems in Higher Dimensions |
Day | Section | Topic |
---|---|---|
Mon, Nov 3 | 3.9 | The Matrix Exponential |
Wed, Nov 5 | 4.1 | Homogeneous Linear Equations |
Fri, Nov 7 | 4.2 | Forcing |
Day | Section | Topic |
---|---|---|
Mon, Nov 10 | 4.3 | Sinusoidal Forcing |
Wed, Nov 12 | 4.4 | Forcing and Resonance |
Fri, Nov 14 | 5.1 | Linearization |
Day | Section | Topic |
---|---|---|
Mon, Nov 17 | 5.1 | Linearization - con’d |
Wed, Nov 19 | Review | |
Fri, Nov 21 | Midterm 3 | |
Mon, Nov 23 | 6.1 | The Laplace Transform |
Day | Section | Topic |
---|---|---|
Mon, Dec 1 | 6.1 | The Laplace Transform - con’d |
Wed, Dec 3 | 6.2 | Solving Initial Value Problems |
Fri, Dec 5 | 6.2 | Solving Initial Value Problems - con’d |
Mon, Dec 8 | Recap & review |