arminstraub.com

# Fall 2023: Differential Equations II (Math 332)

## Overview

 Instructor Dr. Armin Straub MSPB 313 straub@southalabama.edu (251) 460-7262 (please use e-mail whenever possible) Office hours MW 10:00am-1:00pm, or by appointment Lecture MWF, 1:25-2:15pm, in MSPB 235 Midterm exams The tentative dates for our two midterm exams are: Wednesday, October 4 Wednesday, November 15 Final exam Wednesday, December 13 — 1:00-3:00pm Online grades Homework Scores Exams: USAonline (Canvas) Syllabus syllabus.pdf

## Lecture sketches and homework

To help you study for this class, I am posting lecture sketches. These are not a substitute for your personal lecture notes or coming to class (for instance, lots of details and motivation are not included in the sketches). I hope that they are useful to you for revisiting the material and for preparing for exams.

Date Sketch Homework
08/23 lecture01.pdf Homework Set 1: Problems 1-6 (due 9/6)
08/25 lecture02.pdf Homework Set 1: Problems 7-8 (due 9/6)
08/28 lecture03.pdf Homework Set 1: Problem 9 (due 9/6)
08/30 lecture04.pdf Homework Set 2: Problem 1 (due 9/13)
09/01 lecture05.pdf Homework Set 2: Problems 2-6 (due 9/13)
09/06 lecture06.pdf Homework Set 2: Problems 7-8 (due 9/13)
09/08 lecture07.pdf Homework Set 3: Problems 1-2 (due 9/20)
09/11 lecture08.pdf Homework Set 3: Problems 3-4 (due 9/20)
09/13 lecture09.pdf Homework Set 3: Problems 5-6 (due 9/20)
09/15 lecture10.pdf Homework Set 4: Problem 1 (due 9/27)
09/18 lecture11.pdf Homework Set 4: Problems 2-4 (due 9/27)
09/20 lecture12.pdf Homework Set 4: Problems 5-6 (due 9/27)
09/22 lecture13.pdf Homework Set 5: Problems 1-3 (due 10/4)
09/25 lecture14.pdf Homework Set 5: Problems 4-6 (due 10/4)
09/27 lecture15.pdf work through Examples 81 and 82
09/29 lecture16.pdf exam practice problems (as well as solutions) are posted below
10/02 review get ready for the midterm exam on 10/4 (Wednesday)
10/06 lecture17.pdf work through Example 88
10/09 lecture18.pdf Homework Set 6: Problems 1-2 (due 10/25)
10/11 lecture19.pdf Homework Set 6: Problem 3 (due 10/25)
10/16 lecture20.pdf Homework Set 6: Problem 4 (due 10/25)
10/18 lecture21.pdf Homework Set 6: Problem 5 (due 10/25)
10/20 lecture22.pdf Homework Set 7: Problems 1-2 (due 11/3)
10/23 lecture23.pdf Homework Set 7: Problem 3 (due 11/3)
10/25 lecture24.pdf Homework Set 7: Problem 4 (due 11/3)
10/27 lecture25.pdf Homework Set 7: Problems 5-6 (due 11/3)
10/30 lecture26.pdf Homework Set 8: Problems 1-4 (due 11/10)
11/01 lecture27.pdf Homework Set 8: Problems 5-6 (due 11/10)
11/03 lecture28.pdf work through Example 140
11/06 lecture29.pdf Homework Set 9: Problems 1-2 (due 11/15)
11/08 lecture30.pdf Homework Set 9: Problem 3 (due 11/15)
11/10 lecture31.pdf exam practice problems (as well as solutions) are posted below
11/13 review get ready for the midterm exam on 11/15 (Wednesday)
11/17 lecture32.pdf Homework Set 10: Problems 1-2 (due 12/8)
11/20 lecture33.pdf Homework Set 10: Problem 3 (due 12/8)
11/27 lecture34.pdf Homework Set 10: Problem 4 (due 12/8)
11/29 lecture35.pdf Homework Set 10: Problems 5-6 (due 12/8)
12/01 lecture36.pdf Homework Set 10: Problem 7 (due 12/8)
12/04 lecture37.pdf complete all outstanding homework
12/06 lecture38.pdf final exam practice problems (as well as solutions) are posted below
12/08 review get ready for the final exam on 12/13 (Wednesday)
lectures-all.pdf (all lecture sketches in one big file)
Overview of all homework problems

• Homework problems are posted for each unit. Homework is submitted online, and you have an unlimited number of attempts. Only the best score is used for your grade.

Most problems have a random component (which allows you to continue practicing throughout the semester without putting your scores at risk).

• Aim to complete the problems well before the posted due date.

A 15% penalty applies if homework is submitted late.

• Collect a bonus point for each mathematical typo you find in the lecture notes (that is not yet fixed online), or by reporting mistakes in the homework system. Each bonus point is worth 1% towards a midterm exam.

The homework system is written by myself in the hope that you find it beneficial. Please help make it as useful as possible by letting me know about any issues!

## Sage

For more involved calculations, we will explore the open-source free computer algebra system Sage.

If you just want to run a handful quick computations (without saving your work), you can use the text box below.

A convenient way to use Sage more seriously is https://cocalc.com. This free cloud service does not require you to install anything, and you can access your files and computations from any computer as long as you have internet. To do computations, once you are logged in and inside a project, you will need to create a "Sage notebook" as a new file.

Here are some other things to try:

• Sage can solve (symbolically!) simple initial value problems. For instance, to solve Example 22 in Lecture 4:
y = function('y')(x)
desolve(diff(y,x,2) - diff(y,x) - 2*y == 0, y, ics=[0,4,5])

Unfortunately, this code currently only works for differential equations of first and second order. To likewise solve a third-order differential equation, we can add the instructions algorithm='fricas':
y = function('y')(x)
desolve(diff(y,x,3) == 3*diff(y,x,2) - 4*y, y, ics=[0,1,-2,3], algorithm='fricas')

The output shows that the function $y(x) = \frac13(3x - 2) e^{2x} + \frac53 e^{-x}$ is the unique solution to the initial value problem $y''' = 3 y'' -4 y$ with $y(0) = 1$, $y' (0) = -2$ and $y'' (0) = 3$.
• Sage is happy to compute eigenvalues and eigenvectors. For instance, to solve Example 57 in Lecture 10:
A = matrix([[8,-10],[5,-7]])
A.eigenvectors_right()

• Sage can even compute general powers of a matrix. For instance, to solve Example 64 in Lecture 12:
n = var('n')
M = matrix([[0,1],[2,1]])
M^n

• Similarly, Sage can compute matrix exponentials. For instance, to solve Example 72 in Lecture 13:
M = matrix([[8,-10],[5,-7]])
exp(M*x)

(Note that x is predefined as a symbolic variable in Sage; that's why we don't need x = var('x') as in the case of n above.)
• We can plot phase portraits as follows:
x,y = var('x y');
streamline_plot((x*(y-1),y*(x-1)), (x,-3,3), (y,-3,3))

• Using matrix exponentials, we can easily solve inhomogeneous systems of differential equations. For instance, to solve Example 94 in Lecture 20:
t = var('t')
A = matrix([[2,3],[2,1]])
y = exp(A*t)*integrate(exp(-A*t)*vector([0,-2*e^(3*t)]), t)
y.simplify_full()

Or, to solve Example 95 in Lecture 20:
s, t = var('s, t')
A = matrix([[1,2],[-1,4]])
y = exp(A*t)*vector([1,2]) + exp(A*t)*integrate(exp(-A*s)*vector([0,2*e^s]), s,0,t)
y.simplify_full()

• The following plots the solution to the heat equation with initial temperature profile equal to 1 and boundary conditions of zero on both ends.
x, t = var('x,t')
uxt = sum(4/(pi*n) * exp(-pi^2*n^2*t) * sin(pi*n*x) for n in range(1,20,2))
density_plot(uxt, (x,0,1), (t,0,0.4), plot_points=200, cmap='hot')