Modules

COSC/MATH 201 · Fall 2026

These are the notes and code-along pages we use in class. Pages with multiple class meetings keep their materials together under one textbook module.

Getting started

Calculations, variables, vectors, graphs, loops, and decisions. Includes the complete downloadable R script from our introductory meetings.

Modeling change

Build an Euler simulation, compare it with the analytical solution, investigate time-step error, and model decay.

Textbook: Read Module 2.2, “Unconstrained Growth and Decay.”

Add carrying capacity to the growth model, interpret its balancing feedback, compare constrained and unconstrained trajectories, and answer threshold questions.

Textbook: Read Module 2.3, “Constrained Growth.”

Work through trout harvesting, bacterial growth, caffeine decay, and a constrained-growth challenge. Focus on choosing a model and using it to answer questions.

Interacting populations

Model two shark populations whose birth and competition flows depend on both species, then investigate equilibria and long-term behavior.

Textbook: Read Module 4.1, “Competition.”

Build a squirrel–hawk simulation with two coupled populations, compare their peak times, and examine the predator-versus-prey trajectory.

Textbook: Read Module 4.2, “Predator–Prey Models.”

Model infection and recovery as transfers between three groups, verify conservation, find the outbreak peak, and compare transmission rates.

Textbook: Read Module 4.3, “Modeling the Spread of SARS—Containing Emerging Disease.”

Checking our simulations

Locate errors in data, assumptions, implementation, and computation. Practice normalized notation, precision, and magnitude; measure absolute and relative error; investigate floating-point arithmetic; and test how time-step size changes an Euler result.

Textbook: Read Module 5.2, “Errors.”

See why an Euler update follows the current slope, compare one large step with several smaller steps, and weigh numerical error against the number of calculations.

Textbook: Read Module 6.2, “Euler’s Method.”

Use an Euler prediction to estimate the end-of-step rate, correct with the average rate, and compare RK2 with Euler at several time steps.

Textbook: Read Module 6.3, “Runge-Kutta 2 Method.”

Build four trial changes from one starting population, combine them with RK4’s weighted average, and compare its numerical error with Euler and RK2.

Textbook: Read Module 6.4, “Runge-Kutta 4 Method.”

Compare Euler, RK2, and RK4 on a familiar constrained-growth model. Test whether the method and time step change the first recorded year a population reaches a target.

Simulating with randomness

Compare uniform and normal random draws in R, then throw virtual darts to estimate π. Investigate why repeated estimates vary and how the number of darts affects reliability.

Textbook: Read Module 9.2, “Simulations.” Our rnorm() comparison previews Module 9.3, “Random Numbers from Various Distributions.”

Build one two-dimensional random walk, then repeat it to estimate a typical final distance and the chance of finishing near the start.

Textbook: Read Module 9.5, “Random Walk.”

Fitting models to data

Fit lines and curves to NIST data with lm(), use residuals to find what a model missed, straighten a curved pattern with a power transformation, and compare a sensible fit with a polynomial that fits too well.

Textbook: Read Module 8.3, “Empirical Models.”

Choose a function shape before fitting, fit a leveling-off model by searching for its rate, test three models on held-out vapor-pressure data, and measure how numerical-method errors shrink with the time step.

Back to top