Teaching · Assignments

Break It

A numerical method that only appears in examples chosen to flatter it is not being taught very hard. These exercises ask students to find the edge, cross it, and explain what failed.

The assignment is not “make the computer produce nonsense.” Computers are extraordinarily good at that and need very little encouragement. The useful task is to identify an assumption, violate it deliberately, observe the numerical consequence, and then connect the consequence back to the method.

A good submission should therefore contain the failed case and the repair. If Newton runs away, show why the tangent geometry caused it and then choose a better starting value. If an explicit PDE scheme becomes unstable, compute the parameter that predicts the instability and then bring it back into range. The explanation is the assignment. The ugly plot is evidence.

Chapters 1–2

Representation and error

B01

Make summation order matter

Construct a vector containing one very large value and many very small values. Sum it in different orders with ordinary summation and with Kahan summation. Find a case where the order changes the ordinary result enough to notice.

Turn in

The vector, the two orderings, the results, and a short explanation of where the small contributions were lost.

B02

Break the quadratic formula

Find coefficients for which the ordinary quadratic formula loses useful digits through cancellation. Compare the two CMNA implementations and explain why a mathematically equivalent form behaves better.

Turn in

The coefficients, both roots from both implementations, and the subtraction that causes the trouble.

B03

Too small to help

Use a smooth function with a known derivative. Keep shrinking h in a finite-difference approximation until the error stops improving and begins to grow.

Turn in

A table of h, approximation, and error, plus the range where truncation error gives way to floating-point effects.

Chapter 3

Linear algebra

B04

Make Jacobi regret meeting your matrix

Begin with a diagonally dominant system that converges under Jacobi iteration. Change as few matrix entries as possible until convergence becomes poor or fails.

Turn in

The original and modified matrices, residual histories, and the structural change that mattered.

B05

Reorder before giving up

Find a system for which Jacobi behaves badly in the original row order. Reorder the equations and test whether the behavior improves.

Turn in

Both systems, the permutation used, and an explanation of why reordering can change an iterative method without changing the underlying solution.

B06

Ignore structure on purpose

Construct a tridiagonal system and solve it once with the dedicated tridiagonal algorithm and once as a generic dense system. Increase the problem size until the structural advantage is hard to ignore.

Turn in

Problem sizes, timings, and a statement of what information the generic solver refused to use.

Chapter 4

Interpolation

B07

Make the polynomial wave

Choose evenly spaced points from a smooth function and increase the polynomial degree until the interpolant develops visibly unreasonable behavior near the ends of the interval.

Turn in

The data points, degree, plot, and the region where fitting every point stopped being reassuring.

B08

Move one point

Use the interpolation laboratory with a modest data set. Change one y-value substantially and compare the response of the global polynomial, piecewise linear interpolant, and cubic spline.

Turn in

Before-and-after plots and a description of which methods changed locally and which changed globally.

B09

Extrapolate until it becomes silly

Build an interpolant that behaves sensibly inside the data range, then evaluate it progressively farther outside the observed domain.

Turn in

The first point at which you would stop trusting the extrapolation, and why that judgment cannot be recovered from the interpolation fit alone.

Chapter 5

Differentiation and integration

B10

Give Simpson something awkward

Find an integrand for which a coarse Simpson approximation is poor. Increase the panel count, then compare with a smooth integrand where the same coarse rule performs much better.

Turn in

Both functions, panel counts, errors, and the feature of the difficult integrand that required more local resolution.

B11

Spend the same number of evaluations differently

Compare Simpson's rule and Gauss-Legendre quadrature on the same smooth function using roughly comparable numbers of function evaluations.

Turn in

Evaluation counts, estimates, errors, and a short explanation of why the node locations matter.

B12

Make Monte Carlo disagree with itself

Fix the integrand, interval, and sample count. Run Monte Carlo integration with several seeds and compare the resulting estimates. Then increase the sample count.

Turn in

The seed-to-seed spread at two sample sizes and what changed when m increased.

Chapter 6

Root finding and optimization

B13

Give bisection an illegal bracket

Choose a function with a real root but an interval whose endpoint values have the same sign. Explain why the existence of a root somewhere is not enough for bisection to start.

Turn in

The function, interval, endpoint values, and a repaired bracket.

B14

Make Newton leave

Find a function and starting value for which Newton's method moves away from the nearby root, cycles, or encounters a nearly zero derivative.

Turn in

The first several tangent steps and the local feature of the function that caused the behavior.

B15

Make the secant almost horizontal

Choose a function and initial value so that two successive function values are nearly equal. Watch what happens when the estimated secant slope becomes very small.

Turn in

The two points defining the problematic secant and the next proposed iterate.

B16

Turn gradient descent into gradient pinball

Use a simple convex objective and increase the step size until the iterates overshoot, oscillate, or diverge. Then reduce h until convergence becomes unnecessarily slow.

Turn in

One step size that is too large, one that is useful, one that is too small, and the corresponding paths.

B17

Cool too quickly

Run simulated annealing on a multimodal objective with the same starting point and seed but several cooling rates.

Turn in

The best value found under each schedule and evidence of when the search stopped accepting exploratory moves.

Chapter 7

Differential equations

B18

Let Euler get ahead of itself

Choose an initial value problem with a known or high-quality reference solution. Increase h until Euler visibly departs from the reference while RK4 remains useful.

Turn in

The equation, initial condition, step sizes, and final error for both methods.

B19

Make the heat equation explode

Hold alpha and dx fixed. Increase dt until the FTCS coefficient crosses the stable range and compare the resulting evolution with a stable run.

Turn in

Both coefficients, the same initial condition, and the first time step where the unstable solution becomes obviously unphysical.

B20

Break the Courant condition

Run the wave equation with a Courant number below one, then above one, without changing the initial displacement.

Turn in

The two parameter sets and a description of what the unstable numerical wave does that the physical wave did not request.

B21

A smooth curve is not a certificate

Choose any ODE or PDE laboratory and produce a visually smooth numerical solution that is still measurably wrong by changing the discretization.

Turn in

The plot, a quantitative error measure or reference comparison, and an explanation of why appearance alone was misleading.