Teaching objectives
When we only know a handful of values of a function — a table of measurements, a few points from an experiment — how do we estimate what happens between them, or near them? This is a classically dry topic when presented as pure formulas, so this lab builds it the other way round: first the visual intuition — guessing by eye, dragging points, watching curves move live — and only afterwards the symbolic machinery. Across 29 rooms full of sliders, drags and animations, it walks the full path from the tangent line to the cubic splines used by every design program. Aimed at University level (Calculus).
What you learn
The path goes from the simplest, most intuitive ideas to the tools actually used in practice.
- Start by estimating a value missing from a table, guess by eye the value of an unknown curve between three points, and reflect on why polynomials are so convenient for approximating functions (rooms 1 to 3).
- Use the tangent line to approximate nearby values, watch how its error grows as you move away, and estimate by hand without a calculator (rooms 4 and 5).
- Move on to linear interpolation with two known points, and compare it with the tangent (rooms 6 and 7).
- Build the Lagrange interpolating polynomial: its basis, its assembly, and why adding a new data point forces you to recompute it from scratch — ending in a free playground where the polynomial recomputes live as you drag any point (rooms 8 to 13).
- Discover Newton's divided differences, an equivalent but far more convenient way to update the polynomial as new data arrives, and compare what adding a node costs in each of the two forms (rooms 14 to 19).
- Understand interpolation error, watch the nodal polynomial grow outside the data range, and witness the famous Runge phenomenon — and how Chebyshev nodes avoid it (rooms 20 and 21).
- See the Taylor polynomial as the limiting case of Lagrange interpolation when all nodes collapse onto one point, and compare its reach with that of interpolation using spread-out nodes (rooms 22 to 25).
- Close with cubic splines: why splitting the curve into smooth pieces avoids the problems of a high-degree global polynomial, with the historical analogy of a draftsman's flexible ruler (rooms 26 to 29).
Key mathematical ideas
- The tangent line is the best linear approximation near a point; its error grows fast as you move away.
- Linear interpolation uses two real values instead of one, so it usually beats the tangent far from the reference point.
- The Lagrange polynomial is the unique polynomial of degree ≤ n−1 passing exactly through n given points; it is built as a sum of pieces Lᵢ(x) that equal 1 at their own node and 0 at the rest.
- Newton's divided differences compute the same polynomial in nested form, with the practical advantage that adding a node only requires one new row in the table.
- Interpolation error is proportional to the nodal polynomial ∏(x−xᵢ): small within the node range, large outside it.
- The Runge phenomenon shows that raising the degree with equally spaced nodes can worsen the approximation near the edges; Chebyshev nodes, denser near the boundaries, avoid it.
- The Taylor polynomial is the limiting case of interpolation when all nodes approach the same point: it approximates very well nearby, but guarantees nothing far away.
- Cubic splines interpolate with low-degree piecewise polynomials, joined with continuity up to the second derivative: they avoid the oscillations of a global polynomial and underlie almost all computer-aided curve design.
Room-by-room contents
Room 1 · The ice-cream stand
The lab begins with a sales table and a question: how many ice creams will be sold at a temperature that is not in the table? With no formula at all, the student commits to a number, and from there the meaning of interpolation is explained. It is not scored: it is the hook.
Student tasks
- Predict a value that does not appear in the table.
- Put a name to what has just been done.
Room 2 · Guess it by eye
Given three points, the student drags the value they think the function takes at an intermediate point. It is scored by closeness, so it forces a commitment to an estimate before there are any tools to compute it.
Student tasks
- Estimate by eye the value of the function between two known data points.
Room 3 · Why polynomials?
Before building anything, the question of why we approximate with polynomials and not with something else. Out of six statements, the student keeps those that really are reasons: polynomials are easy to evaluate, differentiate and integrate, and with a high enough degree they pass through any points you want.
Student tasks
- Separate the true reasons from those that sound right but are false.
Room 4 · The tangent and its error
The first real approximation: near a point, the tangent line closely resembles the function. The room runs in three stages — the tangent and its challenge, the table of compared values, and the error graph — to show that the approximation is very good nearby and poor far away.
Student tasks
- Compute the approximate value given by the tangent at a nearby point.
- Read off the error graph where the approximation stops being useful.
Room 5 · Estimate without a calculator
A direct application: estimate an actual value by hand, using only the tangent formula. This is the moment the technique stops being a drawing and becomes something useful.
Student tasks
- Estimate a specific value with the tangent line, without a calculator.
Room 6 · Linear interpolation
The student places two points and the line through both appears, with a slider to move along it. Two guided challenges fix the difference from the tangent: here the line passes through the data instead of touching the curve at a single point.
Student tasks
- Place two points and read intermediate values on the line.
- Compute an interpolated value between two data points.
Room 7 · Tangent vs. linear interpolation
Both lines at once on the same exponential function. One is accurate at a point and its immediate neighbourhood, the other is exact at two points and misses in between: they are different approximations with different strengths.
Student tasks
- Compare the error of the two lines in several parts of the interval.
Room 8 · From 2 to 3 points
With one more point, the line becomes a parabola. Two challenges on what that implies: what degree the polynomial through n points has, and what the sign of the leading coefficient says about the shape of the curve.
Student tasks
- Deduce the degree of the polynomial through a given number of points.
- Relate the sign of the leading coefficient to the shape of the curve.
Room 9 · The Lagrange basis
Lagrange's trick, built step by step and with its historical context: for each node, a polynomial is made that equals 1 there and 0 at all the others. Four challenges check that this property has been understood, since it is what makes everything else work.
Student tasks
- Build the basis polynomial associated with a node.
- Check that it equals 1 at its node and 0 at the others.
Room 10 · Assembling the polynomial
With the pieces already built, the interpolating polynomial is simply the sum of each basis polynomial multiplied by its value. The reveal adds the terms one by one, so that you can see the curve gradually fitting the data.
Student tasks
- Assemble the polynomial from the basis polynomials and the values.
- Check that it passes exactly through all the data points.
Room 11 · Practice with 3 points
Guided practice: the student computes each piece of the Lagrange polynomial with three nodes, one at a time, with immediate feedback.
Student tasks
- Compute each basis polynomial and put together the full interpolating polynomial.
Room 12 · Practice with 4 points
The same script with one more node. The aim is not just repetition: it is to make the extra work of adding a point noticeable, something the Newton block will take advantage of later.
Student tasks
- Repeat the construction with four nodes.
- Notice how much the work grows when a point is added.
Room 13 · Your own interpolator
A playground: free nodes that can be dragged, with the polynomial recomputed live. It lets students discover for themselves that bringing two nodes close together makes the curve shoot up, and that with many points the polynomial starts to wiggle.
Student tasks
- Place and drag nodes, watching how the curve responds.
- Deliberately produce a curve that misbehaves.
Room 14 · First divided difference
Newton's method begins: the same polynomial, built in a different way. First-order divided differences are defined, one is shown worked out, and the student completes the rest of a five-point table.
Student tasks
- Compute the first-order divided differences of a table.
Room 15 · Second divided difference
The second order is built from the first. The accompanying graph relates these differences to curvature, so the table stops being a blind procedure.
Student tasks
- Complete the column of second differences.
- Relate their sign to the curvature of the data.
Room 16 · Newton's polynomial
With the third difference comes the nested form, which is how the polynomial is actually evaluated — Horner's scheme — and which is explained here. The room ends by checking that this polynomial and the Lagrange one are exactly the same, only written differently.
Student tasks
- Write the polynomial in nested form.
- Check that it coincides with the Lagrange polynomial.
Room 17 · Build your own table
Practice through chained challenges: each one recalls the relevant formula and asks for the numbers, until the table and the polynomial are complete.
Student tasks
- Fill in the whole divided-difference table.
- Put together the polynomial from the diagonal.
Room 18 · Newton's advantage
The payoff of the whole block: adding a new point only adds one row to the table, and everything computed before is still valid. The challenge compares that work with what it would cost using Lagrange.
Student tasks
- Add a node and see how much has to be recomputed.
- Compare the cost with that of the Lagrange method.
Room 19 · The problem with Lagrange
The other side of the coin: in Lagrange form, adding a node means redoing all the basis polynomials from the start. The room closes the block by making clear what each of the two forms is good for.
Student tasks
- Check what has to be redone when a node is added in Lagrange form.
- Decide which form suits each problem.
Room 20 · The interpolation error
What approximating costs. The error formula contains the nodal polynomial, the product of the distances to all the nodes, and its graph explains why the error is small between the data points and grows quickly outside them.
Student tasks
- Interpret the graph of the nodal polynomial.
- Decide where the error will be largest from the position of the nodes.
Room 21 · The Runge phenomenon
The surprise of the lab, with its historical context: adding more equally spaced nodes can make the approximation worse instead of better. The animation compares equally spaced nodes with Chebyshev nodes and shows the overall error of both, so the solution becomes apparent on its own.
Student tasks
- Increase the number of equally spaced nodes and watch the result get worse.
- Compare with Chebyshev nodes and explain the difference.
Room 22 · What is a Taylor polynomial?
A change of idea: instead of passing through several points, fit as closely as possible at a single one, matching the function and its successive derivatives. The definition and the formula are given and an example is worked through before one more term is asked for.
Student tasks
- Compute a term of the Taylor polynomial of a function.
Room 23 · Taylor as a limiting case
The link between the two worlds: if the Lagrange nodes are brought together until they collapse into one, their coefficients become the Taylor coefficients. This is shown live, with the coefficients changing as the nodes approach each other.
Student tasks
- Bring the nodes closer and observe what the coefficients tend to.
Room 24 · Increasing order
As the degree goes up, the Taylor polynomial hugs the function more closely near the point, but departs from it sooner further away. This is the price of staking everything on a single point.
Student tasks
- Raise the degree and measure the improvement nearby and the deterioration far away.
Room 25 · Taylor vs. Lagrange
A comparative challenge far from the expansion point, which is where the two strategies clearly diverge: one spreads its accuracy over several points, the other concentrates it at one.
Student tasks
- Decide which of the two approximations is better depending on where it is to be evaluated.
Room 26 · Why split the curve
If a high-degree polynomial misbehaves, the way out is not to use just one: split the interval and put a small polynomial on each piece. The analogy of a flexible ruler held at several points explains the idea before any formula.
Student tasks
- Explain what problem splitting the curve solves.
Room 27 · How a spline is built
The pieces are no good on their own: at each knot the value, the slope and the curvature must match, and these give the equations that determine the spline. The room shows what would break if each of these conditions were missing.
Student tasks
- Identify the conditions imposed at each knot.
- Recognize what fails if one of them is relaxed.
Room 28 · Build a cubic spline
The student builds a spline with draggable knots, watching each piece readjust to keep fitting its neighbours.
Student tasks
- Drag the knots and watch how the pieces readjust.
Room 29 · Lagrange vs. spline
The close of the lab: on the same data, the global Lagrange polynomial and the cubic spline side by side. With few points they look alike; with many, one wiggles and the other does not.
Student tasks
- Compare both curves on the same data.
- Choose the more suitable one and justify why.
Rooms to project
The most striking ones to show and discuss in class.