arminstraub.com

Fall 2022: Numerical Analysis (Math 436)

Overview

Instructor Dr. Armin Straub
MSPB 313
straub@southalabama.edu
(251) 460-7262 (please use e-mail whenever possible)
Office hours TR, 12:15-3:15pm, or by appointment
Class schedule TR, 11-12:15pm, in MSPB 235
Midterm exams The tentative dates for our two midterm exams are:
Thursday, September 29
Thursday, November 10
Final exam Tuesday, December 6 — 10:30am-12:30pm
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/16 lecture01.pdf Homework Set 1: Problems 1-3 (due 8/30)
08/18 lecture02.pdf Homework Set 1: Problems 4-6 (due 8/30)
08/23 lecture03.pdf Homework Set 1: Problems 7-8 (due 8/30)
08/25 lecture04.pdf Homework Set 2: Problems 1-2 (due 9/8)
08/30 lecture05.pdf Homework Set 2: Problem 3 (due 9/8)
09/01 lecture06.pdf Homework Set 2: Problems 4-5 (due 9/8)
09/06 lecture07.pdf Homework Set 3: Problems 1-2 (due 9/20)
09/08 lecture08.pdf Homework Set 3: Problems 3-5 (due 9/20)
09/13 lecture09.pdf Homework Set 3: Problems 6-7 (due 9/20)
09/15 lecture10.pdf Homework Set 4: Problems 1-3 (due 9/27)
09/20 lecture11.pdf Homework Set 4: Problems 4-5 (due 9/27)
09/22 lecture12.pdf exam practice problems (as well as solutions) are posted below
09/27 review get ready for the midterm exam on 9/29 (Thursday)
lectures-1-12.pdf (all lecture sketches up to the first exam in one big file)
10/04 lecture13.pdf Homework Set 5: Problems 1-2 (due 10/20)
10/11 lecture14.pdf Homework Set 5: Problems 3-4 (due 10/20)
10/13 lecture15.pdf Homework Set 5: Problem 5 (due 10/20)
10/18 lecture16.pdf Homework Set 6: Problem 1 (due 11/1)
10/20 lecture17.pdf Homework Set 6: Problem 2 (due 11/1)
10/25 lecture18.pdf Homework Set 6: Problem 3 (due 11/1)
10/27 lecture19.pdf Homework Set 7: Problem 1 (due 11/10)
11/01 lecture20.pdf Homework Set 7: Problem 2 (due 11/10)
11/03 lecture21.pdf Homework Set 7: Problems 3-4 (due 11/10)
11/08 review get ready for the midterm exam on 11/10 (Thursday)
exam practice problems (as well as solutions) are posted below
11/15 lecture22.pdf Homework Set 8: Problem 1 (due 12/1)
11/17 lecture23.pdf Homework Set 8: Problem 2 (due 12/1)
11/22 lecture24.pdf Homework Set 8: Problem 3 (due 12/1)
11/29 review final exam practice problems (as well as solutions) are posted below
12/1 review get ready for the final exam on 12/6 (Tuesday)
lectures-all.pdf (all lecture sketches in one big file)
Overview of all homework problems

About the homework

  • 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!

Exams and practice material

The following material will help you prepare for the exams.

Python assignments

  • As a part of the course, we will implement and analyze the discussed numerical methods in Python (version 3). In addition to regular homework problems, there will be occasional Python assignments asking you to write short Python code. No previous exposure to Python is expected and I will introduce you to Replit, which offers a free cloud service for running Python code (from within a web browser and without the need to install any software).
  • We will use Replit for submitting the assignments. Before the first Python assignment, you will receive an invitation to create a free account (you can choose any username and you do not need to provide any personal information or email address). Further instructions will be provided later (in particular, you will be able to test your code before submitting it; that way, you can get in touch with me if anything is not working as expected).

    If you are already familiar with Python, feel free to use your favorite IDE such as Spyder for writing code. For assignments, the final code then needs to be submitted via Replit.

  • If you just want to run some short code (without saving your work), you can use the text box below.

    (The box is prefilled with code to compute 10 binary digits of the fractional part of 0.1; this code is discussed in Lecture #4.)

    Alternatively, you can also quickly run some python code at Replit from any browser without logging into an account.

Here are some other things to try:

  • Professional numerical methods are implemented in the libraries numpy and scipy. In the following example, we interpolate the sine function and plot it against that interpolation (using the library matplotlib).
    from numpy import linspace, pi, sin
    from scipy import interpolate
    import matplotlib.pyplot as plt
    xpoints = [0, pi/2, pi]
    ypoints = [sin(x) for x in xpoints]
    poly = interpolate.lagrange(xpoints, ypoints)
    xplot = linspace(0, pi, 100)
    plt.plot(xpoints, ypoints, 'o', xplot, sin(xplot), '-', xplot, poly(xplot), ':')
    plt.show()
    
  • Similarly, the following code constructs a cubic spline and plots it.
    from numpy import linspace
    from scipy import interpolate
    import matplotlib.pyplot as plt
    xpoints = [1, 2, 4, 5, 7]
    ypoints = [2, 1, 4, 3, 2]
    spline = interpolate.CubicSpline(xpoints, ypoints, bc_type='natural')
    xplot = linspace(1, 7, 100)
    plt.plot(xplot, spline(xplot), '-', label='spline (natural)')
    plt.plot(xpoints, ypoints, 'o', label='knots')
    plt.legend()
    plt.show()