Mathematica and Sage Notebooks for use with Calculus in Context

In teaching a second-semester calculus course for college students who have studied some calculus in high school, I think that using Calculus in Context is the way to go. Covering Chapters 1 and 2 reviews Calc I concepts in the context of modelling diseases, Chapters 4 and 8 apply these concepts to differential equations and dynamical systems, and Chapters 10 and 11 cover sequences/series and techniques of integration.

While teaching such a class at Smith College, I developed Mathematica notebooks to accompany the course, and here they are for others to use. These notebooks were last revised in Fall 2007; they all work with Mathematica 7.0. As far as I know, Mathematica commands are backwards-compatible with Mathematica 7.0, so these notebooks still work. There are no notebooks for Taylor series or techniques of integration, because Mathematica has built-in commands for use with these ideas.

While teaching a similar class at Sarah Lawrence College in Spring 2013, I created a matching set of Sage notebooks to accompany the course. In 2017, I created Jupyter notebook versions of them

(1) Introduction to Mathematica: I use this on the first day of class to introduce students to Mathematica command structure/syntax, show them how to get help, and start them on the most basic S-i-R code.

Introduction to Sage (SageNB) (Jupyter) and Basic S-I-R code (SageNB) (Jupyter)

(2) Flexible S-i-R Code: For use with Chapter 1. This contains more-customizable S-i-R code, two ways to implement there-and-back, and basic data generation and plotting commands. If you look ahead to other notebooks, you may wonder why the code is so rudimentary in this notebook; the reason is to help students understand how the code works before having them use it more like a black box later.

There-and-Back and Plotting (SageNB) (Jupyter)

(3) Interesting and Fancy Data Plotting: Still using the S-i-R example, this notebook helps students plot multiple sets of data on the same axes, animate the display of data sets, and generate and plot successive approximations to the solutions of a system of differential equations. There's also a section with instructions for adding mouseovers, color, labels, etc.

Fancy Data Plotting (SageNB) (Jupyter)

(4) Chapter 2 Exercises: Unsurprisingly, this is for use with Chapter 2. It contains code for somewhat-tabular display of S-i-R data, and several exercises designed by Jim Callahan to help students analyze issues including the stabilization (or lack thereof) of successive approximations, and interpret the numerical results of running various scenarios through S-i-R code.

Chapter 2 Exercises (SageNB) (Jupyter)

(4.5) Epidemic Investigations: This reviews the measles epidemic analysis and then sets up an analysis of seasonal influenza spread customized to your college or university.

Epidemic Investigations (SageNB) (Jupyter)

(5) Play with the May Model: For use with Chapter 4. The code in this notebook is designed to let students vary parameters in systems of differential equations and see how these changes affect the corresponding solutions. The example function is the May Model, but Lotka-Volterra and other models can easily be implemented by altering the code appropriately. The Manipulate function makes its first appearance here, and is particularly helpful in finding Hopf bifurcations.

Play with the May Model (SageNB) (Jupyter)

(6) Fun with Vector Fields: For use with Chapter 8. Here there are customizable chunks of code to generate and display data trajectories atop vector fields (and of course to generate/display trajectories separately from vector fields), and more Manipulate-ions.

Fun with Vector Fields (SageNB) (Jupyter)

(7) Lorenz Attractor Craziness! What would a study of dynamical systems be without a sample Lorenz Attractor to play with? This notebook generates a 3D trajectory for the Lorenz Attractor and an accompanying vector field, and the display is live-rotatable. Yes. There are also projections of the trajectory into the three 2D coordinate planes. This code can be adapted to show S-i-R data in 3D.

Lorenz Attractor (SageNB) (Jupyter)

(8) Computing S-i-R Series: This notebook computes the first 50 coefficients for the power series expansions of S, i, and R.

Computing S-I-R Series (SageNB) (Jupyter)