TactivergeOffline

Level 4 Engineering Complex Systems · Term 1: Applied Calculus and Engineering Models

The calculus engineers use every day: functions as models, limits, derivatives as rates, optimisation, integrals as accumulation and the first differential equations. Every idea is tied to a physical quantity with units, worked analytically and checked numerically in an in-browser lab.

In this file: 30 lessons across weeks 1–9, with 151 practice questions (questions only, no answers).

Model, control, optimise and benchmark dynamic engineering systems using calculus, control theory, signal processing and computer architecture, with explicit assumptions and reproducible evidence. Levels describe what you can do, not your age. About About 3–4 hours a week: 1.5–2 hours of lessons and worked problems, 1–1.5 hours of simulation and 30 minutes of write-up..

Week 1: Functions and engineering relationships

This week you will

Functions as engineering models

A spring balance turns a stretch into a force reading. What is the rule inside it, and at what stretch does the rule start lying?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every simulation, controller and datasheet in this year rests on functions: a rule that turns one quantity into another. Engineers never write just F = 250x. They write F = k·x, k = 250 N/m, valid for 0 ≤ x ≤ 0.10 m. The units tell you what the numbers mean; the domain tells you where the model stops being true.

Goals

Predict

A spring was tested from 0 to 0.10 m of stretch and fits F = 250x newtons perfectly. What will it need to stretch 0.30 m?

  1. Exactly 75 N: the model says so
  2. Probably not 75 N: 0.30 m is outside the tested range, so the model may not hold
  3. 0 N: springs cannot stretch that far

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Start with the spring test and the linear family. Read the best-fit slope: what are its units? Nudge the slope to 80% and 120% and watch the RMS residual climb. Now switch to the wind-tunnel drag data with a linear model: the residuals form a smile-shaped run. That pattern means the shape, not the noise, is wrong.

What the interactive shows, in words

The fitter plots data points with a best-fit curve and a residual bar chart beneath it. For the spring data a straight line fits with stiffness about 250 N/m and residuals that flip sign often. For the drag data a straight line leaves a run of positive residuals at both ends and negative in the middle; a power law removes the pattern. The readout states the fitted equation, the RMS residual and how often the residuals change sign.

Understand

A model is a function with a job

A function takes an input (the independent variable) and returns exactly one output. In engineering both carry units: stretch x in metres, force F in newtons. The parameters are the fixed numbers that tailor a family to one device: stiffness k = 250 N/m. Write all three, every time, or the numbers are meaningless.

Domain: where the model is allowed to speak

Every model has a domain of inputs where it was tested or derived. A thermistor formula may hold from 0 to 100 °C; a spring law up to its elastic limit. Using a model outside its domain is extrapolation. Sometimes it is fine, often it is dangerous, and it must always be said out loud.

Residuals judge the shape

A residual is data minus model at each point. If the model's shape is right, residuals scatter randomly around zero, changing sign often. If they form long runs (all positive in the middle, all negative at the ends) the family is wrong, however small the numbers look. Fit quality has two parts: the size of the residuals and their pattern.

Explain it another way: intuitive

A function is a vending machine: put in a stretch, get out a force. The parameters are how the machine is set up. The domain is the coin slot: put the wrong thing in and it jams, even if it still gives you something.

Explain it another way: technical

Linear model y = a·x + b. Least squares chooses a and b to minimise Σ(yᵢ − a·xᵢ − b)². The slope a has units of y per unit of x (N/m); the intercept b has the units of y. The RMS residual √(Σrᵢ²/n) has the units of y and is a typical misfit.

Explain it another way: mathematical

For data (xᵢ, yᵢ), the least-squares slope is a = Σ(xᵢ − x̄)(yᵢ − ȳ) / Σ(xᵢ − x̄)² and b = ȳ − a·x̄. The fitted line always passes through the centroid (x̄, ȳ).

Explain it another way: applied

Sensor datasheets are functions with domains: "output 10 mV/°C, 0.5 V at 0 °C, accuracy ±1 °C from 0 to 100 °C". Firmware converts voltage back to temperature with the inverse function, and must clamp or flag readings outside the domain.

Try these examples

Example 1

A temperature sensor outputs V = 0.01·T + 0.5 volts for 0 ≤ T ≤ 100 °C. Write the inverse function and find T when V = 1.2 V.

The worked solution is in the online lesson.

Example 2

A fit to a spring gives F = 251x − 0.1 N. What do 251 and −0.1 mean?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A sensor obeys V = 0.01·T + 0.5 volts (T in °C, valid 0–100 °C). What voltage does it give at 37 °C?

Answer: V

2. Same sensor, V = 0.01·T + 0.5. The firmware reads 1.20 V. What temperature is that, in °C?

Answer: °C

3. You fit a straight line to drag force against speed. The residuals are positive at low and high speeds and negative in the middle. What does that tell you?

  • The data are noisy; take more readings
  • The line's shape is wrong: the relationship is curved
  • The fit is good because the residuals add up to zero

4. A fitted model is battery voltage V (V) against time t (h): V = −0.05t + 12.6. What are the units and meaning of −0.05?

  • Volts: the voltage at t = 0
  • Volts per hour: the voltage falls by 0.05 V each hour
  • Hours per volt: the time to lose one volt

5. An alternating voltage is v(t) = A·sin(2π·f·t) with A = 12 V and f = 2 Hz. What is v at t = 0.003 s, in volts? (Angles in radians.)

Answer: V

Apply it

Pick a device at home with a dial or display (kitchen scale, bathroom scale, phone battery percentage). Write its function with input, output, units, parameters and domain as you imagine its designer did. Where would extrapolating it be dangerous?

Reflect

Why do engineers write the domain next to a model, and what could go wrong if they left it off?

Go further (online)

Power laws and exponentials

Double a cyclist's speed and the air pushes back four times harder. Halve a capacitor's charge and it takes the same time to halve again. Two very different curves: how do you tell them apart?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Drag, stiffness of a beam, heat lost through a wall, the brightness of a light with distance: power laws. Battery self-discharge, a capacitor emptying, a hot drink cooling, bacteria multiplying: exponentials. Confusing the two gives predictions that are wildly wrong outside the data, so engineers have a quick test for each.

Goals

Predict

Air drag on a cyclist is about F = c·v². At 10 m/s it is 40 N. What is it at 20 m/s?

  1. 80 N
  2. 160 N
  3. 400 N
  4. 40 N, drag does not depend on speed

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Load the wind-tunnel drag data and try each family. Which gives random-looking residuals, and what exponent n does it find? Now load the capacitor discharge: compare the power and exponential fits. Read the exponential's k and work out the time constant τ = −1/k in seconds.

What the interactive shows, in words

In the fitter, the drag data are curved upwards. A linear fit leaves patterned residuals; a power-law fit finds an exponent close to 2 with random residuals. For the capacitor discharge an exponential fits with k close to −0.67 per second, so τ is about 1.5 s. The readout states each fitted equation and its RMS residual.

Understand

Scaling test for a power law

For y = k·xⁿ, multiplying x by any factor s multiplies y by sⁿ, whatever x you start from. Drag (n = 2): double speed, four times the force. Cylinder volume against radius at fixed height (n = 2). A beam's deflection against length under its own weight (n = 4). The exponent n carries the physics.

Constant-ratio test for an exponential

For y = A·e^(kx), adding a fixed amount to x multiplies y by a fixed ratio. A capacitor V = V₀·e^(−t/τ) loses 63% of its remaining voltage every τ seconds and halves every τ·ln 2. The quantity τ (the time constant) has the units of time and sets the speed of the whole process.

e and the natural logarithm

e ≈ 2.718 is the base for which the exponential's slope equals its value: d/dx eˣ = eˣ. That makes e^(kt) the natural language of anything whose rate of change is proportional to its size. Its inverse is ln: ln(eˣ) = x. You will use both constantly from week 3 on.

Explain it another way: intuitive

A power law is about size: make something twice as big and it behaves a fixed multiple differently. An exponential is about time or steps: every equal step multiplies by the same amount, like a battery that loses 2% of whatever it has each day.

Explain it another way: technical

Power law y = k·xⁿ: straight on log–log axes, slope n. Exponential y = A·e^(kx): straight on semi-log axes, slope k. For decay k = −1/τ; half-life t½ = τ·ln 2 ≈ 0.693τ.

Explain it another way: mathematical

Exponent rules: e^(a+b) = eᵃ·eᵇ, so e^(k(x+Δ)) = e^(kx)·e^(kΔ): a constant ratio per step Δ. For a power law, k(sx)ⁿ = sⁿ·kxⁿ: a constant ratio per scale factor s.

Explain it another way: applied

Engineers plot on log axes as a first diagnostic. A battery-life curve that is straight on a semi-log plot is a sign of exponential self-discharge; a wind-tunnel drag curve that is straight on log–log with slope 2 confirms turbulent drag.

Derivation: Why logarithms straighten both families
  1. Power law: y = k·xⁿ. Take natural logs of both sides: ln y = ln k + n·ln x.

  2. So plotting ln y against ln x gives a straight line with slope n and intercept ln k. A log–log plot that is straight means a power law.

  3. Exponential: y = A·e^(kx). Take logs: ln y = ln A + k·x.

  4. So plotting ln y against x (only the y-axis logged) gives a straight line with slope k. A semi-log plot that is straight means an exponential.

  5. Both tricks need y > 0 (and x > 0 for the power law) because the logarithm of zero or a negative number is not defined. That is why the lab refuses log fits on data that cross zero.

Try these examples

Example 1

A capacitor discharges as V = 9·e^(−t/1.5) volts. When has it fallen to 4.5 V?

The worked solution is in the online lesson.

Example 2

Drag measurements: 10 N at 5 m/s and 40 N at 10 m/s. Power law or exponential, and what parameter?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Drag F = 0.4·v² newtons (v in m/s). What is the drag at 15 m/s?

Answer: N

2. V = 9·e^(−t/1.5) volts. How long until V = 4.5 V, in seconds?

Answer: s

3. You plot ln(y) against x and get a straight line with slope −0.4. What model fits?

  • y = A·x^(−0.4)
  • y = A·e^(−0.4x)
  • y = −0.4x + A

4. Light intensity from a lamp falls to one quarter when you double the distance. Which model is consistent?

  • I = k·e^(−d)
  • I = k/d² (a power law with n = −2)
  • I = k − d

5. An alternating voltage is v(t) = A·sin(2π·f·t) with A = 12 V and f = 2 Hz. What is v at t = 0.003 s, in volts? (Angles in radians.)

Answer: V

6. A quantity decays as e^(−t/τ) with τ = 10 s. How long until it falls to 25% of its start value, in seconds?

Answer: s

Apply it

Find a real datasheet curve plotted on log axes (battery discharge, LED brightness against current, or a resistor's power derating). Say which family it is and estimate its exponent or time constant from two points.

Reflect

Describe in one sentence each how you would tell a power law from an exponential if you could only double the input or add to it.

Go further (online)

Sinusoids: models that repeat

The voltage in a wall socket swings from +325 V to −325 V fifty times a second. The harbour tide does the same thing twice a day. One function describes both.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Mains electricity, vibration in a washing machine, a robot arm waving, sound, radio, the tides, daylight hours: all periodic. The sinusoid is the building block engineers use for every one of them, and later in this year (signals and filters) every signal will be built from sums of sinusoids.

Goals

Predict

UK mains voltage has a frequency of 50 Hz. How long is one complete cycle?

  1. 50 s
  2. 0.5 s
  3. 20 ms
  4. 2 ms

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Load the harbour tide. Try the exponential and power families first: why does the lab refuse? Now fit the sinusoid. Read its period in hours (it should be close to the real semidiurnal tide, about 12.4 h). Nudge the amplitude and watch the residuals change.

What the interactive shows, in words

In the fitter, the harbour tide data rise and fall over 24 hours and go below zero. Power and exponential fits are refused because the data are negative. A sinusoid fits with an amplitude near 1.8 m and a period near 12.4 h, with random-looking residuals; the readout states the fitted equation.

Understand

Four parameters, four jobs

y = A·sin(2πft + φ) + c. Amplitude A: the peak swing (325 V). Frequency f in hertz: cycles per second. Phase φ in radians: where in the cycle it starts. Offset c: the level it swings around (zero for mains, mean sea level for tides). Period T = 1/f.

Angular frequency

Inside the sine the angle must be in radians. One cycle is 2π radians, so the angle grows at ω = 2πf radians per second. For 50 Hz, ω = 314 rad/s. You will meet ω constantly: in derivatives of sinusoids (week 3), in vibration and in control.

Why other families fail here

Power laws and exponentials are fitted on log axes, and logs need positive values. A sinusoid with zero offset is negative half the time. More fundamentally, neither family can turn round and come back: a periodic quantity needs a periodic model.

Explain it another way: intuitive

Picture a point going round a wheel at a steady speed. Its height above the axle, traced against time, is a sine wave. Amplitude is the wheel's radius, frequency is how fast it turns, phase is where the point started.

Explain it another way: technical

v(t) = A·sin(ωt + φ), ω = 2πf, T = 1/f. UK mains: 230 V rms means a peak A = 230√2 ≈ 325 V at f = 50 Hz.

Explain it another way: mathematical

Any A·sin(ωt + φ) can be written p·sin ωt + q·cos ωt with A = √(p² + q²) and tan φ = q/p. That identity is how the lab fits a sinusoid by least squares once ω is chosen.

Explain it another way: applied

Power engineers keep the grid at 50 Hz (60 Hz in some countries) within a fraction of a hertz. A falling frequency means demand is outrunning supply, so frequency is itself a sensor of the whole grid's health.

Try these examples

Example 1

v(t) = 325·sin(2π·50·t) volts. What is v at t = 2.5 ms?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. What is the angular frequency ω of a 50 Hz supply, in rad/s?

Answer: rad/s

2. v(t) = 325·sin(2π·50·t) V. What is v at t = 2.5 ms, in volts? (Radians.)

Answer: V

3. A tide model is h(t) = 1.8·sin(2πt/12.4 + 0.6) metres with t in hours. What is its frequency in cycles per day?

Answer: cycles/day

4. Two 50 Hz voltages have the same amplitude, but one has phase φ = π/2. What does that mean?

  • It is twice as large
  • It reaches its peak a quarter-cycle (5 ms) earlier
  • It has twice the frequency

5. An alternating voltage is v(t) = A·sin(2π·f·t) with A = 12 V and f = 2 Hz. What is v at t = 0.003 s, in volts? (Angles in radians.)

Answer: V

Apply it

Daylight hours where you live vary over the year. Sketch a sinusoid model for them: estimate the amplitude, period, phase (which day is longest?) and offset. Where might the model be least accurate?

Reflect

Name one periodic quantity in a machine you use and say what its amplitude and period might be, with units.

Go further (online)

Week 2: Limits and continuity

This week you will

Limits: where is it heading?

Put x = 0 into sin(x)/x and your calculator says error. Put in 0.001 and it says 0.9999998. What is the function trying to tell you?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Speed at an instant, current at an instant, the slope of a curve at a point: every one of them is a 0/0 that only makes sense as a limit. This week is the foundation for every derivative you will take.

Goals

Predict

As x gets closer and closer to 0 (from either side), what does sin(x)/x approach? (x in radians.)

  1. 0
  2. 1
  3. It grows without limit
  4. There is no answer because 0/0 is undefined

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Start with (x² − 4)/(x − 2). Zoom in step by step: the graph flattens into a line through a hollow point. Read the table: what value do both columns approach? Repeat with sin(x)/x and (eˣ − 1)/x. Then try 1/x: what is different?

What the interactive shows, in words

The zoom lab shows a function near a chosen point with a table of values on both sides. For (x² − 4)/(x − 2) both sides approach 4 (3.9999 and 4.0001 at h = 0.0001) and the graph has a hollow point at (2, 4). sin(x)/x and (eˣ − 1)/x both approach 1. For 1/x the values grow without bound in opposite directions.

Understand

What a limit says

lim (x→a) f(x) = L means: you can make f(x) as close to L as you like by taking x close enough to a, from both sides, never needing x = a itself. A limit is about the trend near a point, not the value at it.

Three ways to find one

Numerically: tabulate f(a − h) and f(a + h) for h = 0.1, 0.01, 0.001 and watch both columns. Graphically: zoom in; a smooth function looks like a straight line through the point. Algebraically: simplify (factorise, cancel, expand) until substituting a no longer gives 0/0.

When numbers lie

Computers store about 16 significant digits. For tiny h, f(a + h) − f(a) loses most of its digits to rounding (catastrophic cancellation), so tables go wrong for h around 10⁻⁸ and below. Use h down to about 10⁻⁴, then confirm with algebra.

Explain it another way: intuitive

A limit is where the road is heading, even if the bridge at the end is out. You can see where you would arrive by looking at the road just before and just after the gap.

Explain it another way: technical

Two-sided limit exists iff both one-sided limits exist and are equal: lim (x→a⁻) f = lim (x→a⁺) f = L.

Explain it another way: mathematical

Formally (ε–δ): for every ε > 0 there is δ > 0 such that 0 < |x − a| < δ implies |f(x) − L| < ε. The '0 <' is what excludes x = a itself.

Explain it another way: applied

Software that computes rates from logs divides small differences by small time steps. Knowing which limits exist, and how floating-point rounding spoils very small steps, is the difference between a good speed estimate and garbage.

Derivation: A 0/0 limit by factorising
  1. f(x) = (x² − 4)/(x − 2). At x = 2 this is 0/0: not defined.

  2. Factorise the top: x² − 4 = (x − 2)(x + 2).

  3. For every x ≠ 2, f(x) = (x − 2)(x + 2)/(x − 2) = x + 2. Cancelling is allowed precisely because x − 2 is not zero.

  4. As x → 2, x + 2 → 4. So lim (x→2) f(x) = 4, even though f(2) does not exist. The graph is the line y = x + 2 with a single hole at (2, 4).

Try these examples

Example 1

Find lim (h→0) [(3 + h)² − 9]/h.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Find lim (x→3) (x² − 9)/(x − 3).

Answer:

2. Find lim (h→0) [(2 + h)² − 4]/h.

Answer:

3. Use a table (h = 0.1, 0.01, 0.001) to estimate lim (x→0) (eˣ − 1)/x. Give your answer to 2 decimal places.

Answer:

4. f(2) is not defined but lim (x→2) f(x) = 4. Which statement is true?

  • That is impossible: a limit needs f(2)
  • f(x) gets as close to 4 as we like for x near (but not equal to) 2
  • f(2) must secretly equal 4

5. What is lim (x→0) 1/x?

  • 0
  • Infinity, so the limit is ∞
  • It does not exist: the right side grows to +∞ and the left side to −∞

Apply it

On a spreadsheet or calculator, tabulate (1 + 1/n)ⁿ for n = 10, 100, 1000, 10⁶. What number is it approaching? (It is the e you met last week.)

Reflect

In your own words: why can a limit exist at a point where the function has a hole?

Go further (online)

Continuity, switches and saturation

Flip a switch and the voltage leaps from 0 to 5 V in an instant. Or does it? Some quantities in a circuit are forbidden from jumping at all.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Engineering signals are full of switching, clipping and saturation. Knowing exactly where a signal is discontinuous, or merely has a corner, tells you where derivatives blow up, where controllers misbehave and where real hardware must absorb a spike.

Goals

Predict

An amplifier output is 2x, but it clips at ±1 V. Is its output a continuous function of the input at x = 0.5 (where clipping starts)?

  1. No: there is a sudden change there
  2. Yes: it is continuous, but it has a corner
  3. It is not defined at 0.5

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose 'Switch closes at t = 0'. Compare the f(a − h) and f(a + h) columns: they never agree. Then choose the saturating amplifier and zoom in as far as you can: the two sides meet, but the graph never straightens into one line. Write down which is a jump and which is a corner.

What the interactive shows, in words

For the switch, the zoom lab's table shows 0 on the left side and 5 on the right side at every h, so the limit does not exist. For the saturating amplifier both sides approach 1 and the function equals 1 there, so it is continuous, but zooming in always shows a bend from slope 2 to slope 0.

Understand

Continuity in three checks

f is continuous at a when: (1) f(a) is defined, (2) lim (x→a) f(x) exists, and (3) the limit equals f(a). Fail any one and the function is discontinuous there. Polynomials, exponentials, sines and cosines are continuous everywhere; trouble comes from division by zero, switching and piecewise rules.

One-sided limits for switching

A switch closing at t = 0 gives v = 0 V for t < 0 and 5 V for t ≥ 0. The left limit is 0 V and the right limit 5 V. They differ, so there is a jump discontinuity. Real switches are not quite instant, but on a millisecond scale the jump model is excellent.

Physics forbids some jumps

A capacitor's voltage cannot jump, because that would need infinite current (I = C·dV/dt). An inductor's current cannot jump, because that would need infinite voltage. Continuity is a physical law there. Break an inductor's current suddenly with a switch and the voltage spike can destroy the switch, which is why motor drivers have flyback diodes.

Explain it another way: intuitive

A continuous function can be drawn without lifting your pen. A jump makes you lift it. A corner lets you keep the pen down but makes you change direction sharply.

Explain it another way: technical

Jump discontinuity: both one-sided limits exist but differ. Removable discontinuity: the limit exists but f(a) is missing or different. Infinite discontinuity: a one-sided limit is ±∞. A corner is continuous with unequal one-sided slopes.

Explain it another way: mathematical

Piecewise f(x) = g(x) for x < a, h(x) for x ≥ a is continuous at a iff lim (x→a⁻) g(x) = h(a). Choosing a parameter to make that true is called matching.

Explain it another way: applied

Controllers saturate: a motor can only take so much voltage. The output becomes clamp(u, −u_max, u_max), continuous but with corners. Integral action that keeps growing while the output is clamped causes windup, a problem you will meet in term 2.

Try these examples

Example 1

f(x) = 2x for x < 1 and f(x) = a·x + 1 for x ≥ 1. Which a makes f continuous at 1?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. f(x) = 3x² for x < 2 and f(x) = 5x + b for x ≥ 2. What value of b makes f continuous at x = 2?

Answer:

2. v(t) = 0 V for t < 0 and v(t) = 12·(1 − e^(−t)) V for t ≥ 0. What is the right-hand limit of v as t → 0⁺, in volts?

Answer: V

3. A logic signal is 0 V before t = 0 and 3.3 V from t = 0 on. What kind of point is t = 0?

  • Continuous
  • Removable discontinuity
  • Jump discontinuity

4. Why can't the voltage across a real capacitor jump instantly?

  • Capacitors are too slow to switch
  • A jump would need infinite current, because I = C·dV/dt
  • The voltage is always zero

5. Which of these is continuous at the point but not differentiable there?

  • |x| at x = 0
  • 1/x at x = 0
  • A switch closing at t = 0

Apply it

In a robot or appliance you know, find one signal that switches (a relay, a PWM output) and one that saturates (a motor at full power, a sensor at full scale). Sketch each against time and mark jumps and corners.

Reflect

Why does a motor driver need a flyback diode? Explain using the idea that an inductor's current must be continuous.

Go further (online)

From average speed to speed at an instant

Your phone's speedometer shows a speed at one instant. But speed is distance divided by time, and in one instant you travel no distance in no time. How?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every rate an engineer cares about (speed, current, power, the rate a tank fills) is an instantaneous rate. This lesson turns 0/0 into a number using last lesson's limits, and builds the derivative's definition from scratch.

Goals

Predict

A ball is dropped: s(t) = 4.9t² metres. What is its average speed between t = 1 s and t = 2 s?

  1. 4.9 m/s
  2. 9.8 m/s
  3. 14.7 m/s
  4. 19.6 m/s

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the dropped ball with a = 1. Start with h = 1, then drag h smaller. Watch the orange secant swing until it lies along the curve. Read the table: by how much does the gap fall each time h shrinks tenfold? Predict the limit, then reveal the tangent.

What the interactive shows, in words

The secant lab draws s = 4.9t² with a secant line from t = 1 to t = 1 + h. As h shrinks from 1 to 0.001 the secant slope falls from 14.7 to 9.8049 m/s, approaching the tangent slope of 9.8 m/s; the table shows the gap shrinking tenfold each time h does.

Understand

Average rate = secant slope

Over an interval [a, a + h], the average rate of change is [f(a + h) − f(a)]/h. Graphically it is the slope of the secant line through the two points. Its units are output units per input unit: metres per second, volts per second, litres per minute.

Instantaneous rate = limit = tangent slope

The instantaneous rate at a is the limit of the average rate as h → 0. Graphically it is the slope of the tangent line, the line the curve hugs when you zoom in. Where the limit exists the function is differentiable at a. This limit is the derivative, written f′(a) or df/dt.

What the gap tells you

For a smooth curve, average minus instantaneous rate is roughly proportional to h: halve the interval, halve the error. That simple fact is what makes numerical rate estimates (week 4) and numerical integration (week 7) predictable, and it is something you can measure in the lab table.

Explain it another way: intuitive

Zoom in on any smooth curve far enough and it looks like a straight line. The slope of that line is the instantaneous rate: how steep the curve is right there.

Explain it another way: technical

f′(a) = lim (h→0) [f(a + h) − f(a)]/h. For displacement s(t), ds/dt is velocity; for charge Q(t), dQ/dt is current.

Explain it another way: mathematical

For f(t) = c·t², [f(a + h) − f(a)]/h = c(2a + h) exactly, so f′(a) = 2ca and the secant error is c·h.

Explain it another way: applied

A GPS receiver does not measure speed by differencing positions a second apart (too crude); it uses the Doppler shift of the satellite signals, a physical measurement of the instantaneous rate.

Derivation: The average speed of a falling ball, then its limit
  1. s(t) = 4.9t². Over the interval from t to t + h: Δs = 4.9(t + h)² − 4.9t².

  2. Expand: 4.9(t² + 2th + h²) − 4.9t² = 9.8th + 4.9h².

  3. Average speed = Δs/h = 9.8t + 4.9h (for h ≠ 0).

  4. As h → 0 the second term vanishes: the instantaneous speed is v(t) = 9.8t m/s. At t = 1 s, 9.8 m/s; at 2 s, 19.6 m/s.

  5. The gap between average and instantaneous speed is exactly 4.9h: proportional to h, just as the lab's table shows.

Try these examples

Example 1

A tank's volume is V(t) = 2t² + 3t litres (t in minutes). Find the average filling rate from t = 2 to t = 2.1 min, then the instantaneous rate at t = 2.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A trolley's position is s(t) = 4.9t² + 0t metres. What is its average velocity between t = 3 s and t = 3.01 s, in m/s?

Answer: m/s

2. s(t) = 4.9t² m. What is the average speed from t = 2 s to t = 3 s, in m/s?

Answer: m/s

3. Using average speed = 9.8t + 4.9h from the derivation, what is the instantaneous speed of the ball at t = 2 s, in m/s?

Answer: m/s

4. A battery's charge Q (coulombs) is plotted against time t (seconds). What is the slope of a secant on this graph?

  • Average current in amps (C/s)
  • Average voltage
  • Total charge

Apply it

Walk or cycle a route with a phone that logs position. Compute the average speed over 60 s, 10 s and 1 s windows around one moment. Which is closest to the speedometer reading, and which is noisiest?

Reflect

Explain to a friend, without equations, how something can have a speed at a single instant.

Go further (online)

Week 3: Derivatives

This week you will

The derivative from first principles

You can find the slope of x³ at any point with nothing but algebra and one limit. Do it once properly and every derivative rule stops being magic.

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Rules are fast, but the definition is what you fall back on when a rule does not apply, when you write code that estimates a derivative, or when you need to know why a result is true. It is also exactly what a numerical differentiator computes, just without the limit.

Goals

Predict

From first principles, what is the derivative of f(x) = x³?

  1. x²
  2. 3x²
  3. 3x³
  4. x⁴/4

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the shuttle s = t³ − 6t² + 9t. Put a at 1, then 3: the tangent is flat at both. Shrink h and compare the secant slope with 3a² − 12a + 9 worked by hand. Where is the shuttle momentarily stopped?

What the interactive shows, in words

The secant lab plots the shuttle position t³ − 6t² + 9t. At a = 1 and a = 3 the tangent is horizontal (slope zero). As h shrinks, the table's secant slope approaches 3a² − 12a + 9, the slope found from first principles.

Understand

The definition

f′(x) = lim (h→0) [f(x + h) − f(x)]/h. The recipe: write f(x + h), subtract f(x), simplify until you can divide every term by h, then let h → 0. If the limit exists, f is differentiable at x.

The derivative is a function

Doing the algebra with a general x gives a new function f′(x) that returns the slope at every point. For the shuttle s = t³ − 6t² + 9t, v(t) = 3t² − 12t + 9 = 3(t − 1)(t − 3), so it stops at t = 1 s and t = 3 s and moves backwards in between.

Notation

f′(x), dy/dx, ds/dt, d/dx[f]: all the same idea. Leibniz's dy/dx reminds you it came from Δy/Δx and carries units: if y is metres and x is seconds, dy/dx is metres per second. ẋ (x with a dot) is used in physics and control for a time derivative.

Explain it another way: intuitive

Nudge the input by a tiny h, see how much the output moves, and divide. The derivative is that ratio when the nudge is vanishingly small.

Explain it another way: technical

Differentiability implies continuity, but not the other way round: |x| is continuous at 0 but its difference quotient tends to +1 from the right and −1 from the left.

Explain it another way: mathematical

For a polynomial, f(x + h) = f(x) + f′(x)·h + (terms in h², h³, …). The derivative is the coefficient of h: the best linear approximation f(x + h) ≈ f(x) + f′(x)·h.

Explain it another way: applied

The linear approximation f(x + h) ≈ f(x) + f′(x)·h is how engineers estimate sensitivity: if a resistor's value drifts by 1%, how much does the circuit's output change? The derivative is the sensitivity.

Derivation: Differentiating x³ from the definition
  1. Definition: f′(x) = lim (h→0) [f(x + h) − f(x)]/h with f(x) = x³.

  2. Expand (x + h)³ = x³ + 3x²h + 3xh² + h³ (binomial expansion).

  3. Subtract f(x): f(x + h) − f(x) = 3x²h + 3xh² + h³.

  4. Divide by h (h ≠ 0): 3x² + 3xh + h².

  5. Take the limit h → 0: f′(x) = 3x². The extra terms are the secant's error, which shrinks like h.

  6. Same steps for xⁿ: (x + h)ⁿ = xⁿ + n·xⁿ⁻¹h + (terms with h² or higher), so the derivative is n·xⁿ⁻¹: the power rule.

Try these examples

Example 1

From first principles, differentiate f(x) = 5x² − x and evaluate at x = 2.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. From first principles, find the derivative of f(x) = x² at x = 3. (Hint: simplify [(3 + h)² − 9]/h first.)

Answer:

2. f(x) = 5x² − x. Using the first-principles result f′(x) = 10x − 1, what is f′(2)?

Answer:

3. Which expression is the definition of f′(a)?

  • [f(a) − f(0)]/a
  • lim (h→0) [f(a + h) − f(a)]/h
  • f(a)/a

4. The shuttle s = t³ − 6t² + 9t has v = 3t² − 12t + 9. At which time after t = 1 s does it stop again, in seconds?

Answer: s

5. A trolley's position is s(t) = 5t² + 1t metres. What is its average velocity between t = 1 s and t = 1.1 s, in m/s?

Answer: m/s

6. A joint angle follows θ(t) = 2t⁴ − 2t² + 2 radians. Using the power rule, find the angular velocity dθ/dt at t = 0.5 s, in rad/s.

Answer: rad/s

Apply it

Differentiate f(x) = 1/x from first principles. (Combine the fractions over a common denominator before dividing by h.) Check your answer numerically at x = 2 with h = 0.001.

Reflect

What role does the limit play in the definition of the derivative, and what would go wrong without it?

Go further (online)

The power rule and friends

One rule, d/dx xⁿ = n·xⁿ⁻¹, differentiates every polynomial you will ever meet. Add sin, cos and eˣ and you can differentiate most engineering models in your head.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

From now on you will differentiate quickly. The rules are consequences of the definition you used last lesson, so every one can be checked numerically, and the lab does exactly that.

Goals

Predict

Look at f(x) = x³ − 3x. At x = 1 its graph has a local minimum. What is f′(1)?

  1. −2
  2. 0
  3. 1
  4. 3

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose x³ − 3x and hide f′. Slide the point from left to right and predict, out loud, whether the slope is positive, negative or zero. Sketch f′ on paper. Then show f′ and compare. Repeat with sin x: which familiar function appears below it?

What the interactive shows, in words

The derivative grapher shows f on top and f′ below, linked by the chosen point. For x³ − 3x, f′ = 3x² − 3 is a parabola that crosses zero at x = −1 and x = 1, exactly where f has a peak and a trough. For sin x the lower graph is cos x. The readout states the value, the slope and whether f is rising, falling or stationary.

Understand

Three rules for polynomials

Power: d/dx xⁿ = n·xⁿ⁻¹ (any real n, so √x = x^½ gives ½x^(−½)). Constant multiple: d/dx [c·f] = c·f′. Sum: d/dx [f + g] = f′ + g′. A constant on its own has derivative 0: it does not change.

Three functions to know by heart

d/dx sin x = cos x, d/dx cos x = −sin x (angles in radians), d/dx eˣ = eˣ. The sine result rests on the limit sin(h)/h → 1 from week 2; the exponential result on (eʰ − 1)/h → 1.

Reading f′ from a graph

Where f rises, f′ > 0; where it falls, f′ < 0; at peaks, troughs and flat spots, f′ = 0; where f is steepest, |f′| is largest. You can sketch f′ without any formula, and engineers do this constantly with sensor plots.

Explain it another way: intuitive

The derivative graph is a 'steepness meter' for the original graph: above zero while you climb, below zero while you descend, crossing zero at the top of each hill and bottom of each valley.

Explain it another way: technical

Derivative is a linear operator: d/dx[a·f + b·g] = a·f′ + b·g′. Combined with the power rule, d/dx Σ aₖxᵏ = Σ k·aₖxᵏ⁻¹.

Explain it another way: mathematical

From the binomial theorem, (x + h)ⁿ − xⁿ = n·xⁿ⁻¹h + O(h²), so the power rule holds for positive integers; for other real n it follows from xⁿ = e^(n ln x) and the chain rule (next lesson).

Explain it another way: applied

A robot joint's angle is often planned as a cubic in time, θ(t) = a + bt + ct² + dt³. The power rule gives its angular velocity and acceleration, which must stay within the motor's limits.

Try these examples

Example 1

Differentiate f(x) = 4x³ − 2√x + 7 and evaluate at x = 4.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A joint angle follows θ(t) = 2t³ + 5t + 7 radians. Using the power rule, find the angular velocity dθ/dt at t = 1 s, in rad/s.

Answer: rad/s

2. What is the derivative of √x at x = 4?

Answer:

3. What is the slope of sin x at x = π/3? (Radians.)

Answer:

4. Where is f′(x) = 0 for f(x) = x³ − 3x?

  • x = 0 only
  • x = −1 and x = 1
  • x = −√3, 0 and √3

5. A joint angle follows θ(t) = 0.5t⁴ + 3t² + 2 radians. Using the power rule, find the angular velocity dθ/dt at t = 1.5 s, in rad/s.

Answer: rad/s

Apply it

A joint follows θ(t) = 0.3t² − 0.05t³ radians for 0 ≤ t ≤ 4 s. Find its angular velocity and acceleration as functions of t. When is it fastest, and is that inside the 4 s window?

Reflect

Describe how you sketched f′ from f before seeing it. Which feature of f was most useful?

Go further (online)

Product and chain rules

A capacitor's voltage is 12·e^(−t/2). How fast is it falling at t = 1 s? You need a rule for a function inside a function.

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Real models are built from pieces: an exponential decay times a sine (a ringing circuit), a sine of 2πft (any AC signal), a decay with time constant τ. The product and chain rules let you differentiate all of them, and the derivative of e^(kt) being k·e^(kt) is the key to every differential equation in week 8.

Goals

Predict

What is d/dt of sin(2t)?

  1. cos(2t)
  2. 2·cos(2t)
  3. 2·cos(t)
  4. cos(2)

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose sin(2x) and compare its f′ with the sin x case: what changed in height and in spacing? Then choose x·e^(−x): find the point where the slope is zero and check it against (1 − x)e^(−x) = 0.

What the interactive shows, in words

In the derivative grapher, sin(2x) has a derivative 2cos(2x): twice as tall and oscillating twice as fast as cos x. For x·e^(−x) the derivative (1 − x)e^(−x) crosses zero at x = 1, where the original function peaks at about 0.368.

Understand

Product rule

d/dt [u·v] = u′·v + u·v′. Picture a rectangle of sides u and v: when both grow, the area gains a strip along each side. It is not u′·v′. Example: d/dt [t²·sin t] = 2t·sin t + t²·cos t.

Chain rule

If y = f(g(t)), then dy/dt = f′(g(t))·g′(t): the outer slope (evaluated at the inner value) times the inner slope. The workhorse cases: d/dt e^(kt) = k·e^(kt); d/dt sin(ωt) = ω·cos(ωt); d/dt (at + b)ⁿ = n·a·(at + b)ⁿ⁻¹.

Why e^(kt) matters so much

d/dt e^(kt) = k·e^(kt): the rate is k times the value. A capacitor V = V₀·e^(−t/τ) therefore falls at a rate −V/τ, proportional to the voltage left. Any quantity whose rate is proportional to itself must be an exponential: that is week 8 in one line.

Explain it another way: intuitive

Chain rule: if the inner gear turns twice as fast and the outer gear turns three times as fast as the inner, the outer turns six times as fast overall. Rates multiply through a chain.

Explain it another way: technical

Leibniz form: dy/dt = (dy/du)·(du/dt) with u = g(t). Combined with the product rule you can differentiate any expression built from elementary functions.

Explain it another way: mathematical

Quotient rule follows: u/v = u·v⁻¹, so (u/v)′ = u′/v − u·v′/v² = (u′v − uv′)/v².

Explain it another way: applied

In an AC circuit the current through a capacitor is I = C·dV/dt. With V = V₀·sin(ωt), I = C·V₀·ω·cos(ωt): the current leads the voltage by a quarter-cycle and grows with frequency, which is why capacitors pass high frequencies.

Derivation: Where does t·e^(−t) peak?
  1. f(t) = t·e^(−t) is a product of u = t and v = e^(−t). This shape models, for example, a drug concentration or the current pulse in some circuits.

  2. u′ = 1. For v, the chain rule with inner function −t gives v′ = e^(−t)·(−1) = −e^(−t).

  3. Product rule: f′ = u′v + uv′ = e^(−t) − t·e^(−t) = (1 − t)·e^(−t).

  4. e^(−t) is never zero, so f′ = 0 only when 1 − t = 0: t = 1.

  5. For t < 1, f′ > 0 (rising); for t > 1, f′ < 0 (falling): a maximum, f(1) = e⁻¹ ≈ 0.368.

Try these examples

Example 1

V(t) = 12·e^(−t/2) volts. Find dV/dt at t = 1 s.

The worked solution is in the online lesson.

Example 2

Differentiate y = (3t + 1)⁴.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. The charge on a plate is Q(t) = 0.002·sin(50t) coulombs. The current is I = dQ/dt. What is I at t = 0.02 s, in amps?

Answer: A

2. What is d/dt [t·e^(−t)] at t = 0?

Answer:

3. What is d/dt [t²·sin t] at t = π? (Give 4 significant figures.)

Answer:

4. What is d/dt of e^(−t/τ)?

  • e^(−t/τ)
  • −(1/τ)·e^(−t/τ)
  • −t/τ · e^(−t/τ − 1)
  • −τ·e^(−t/τ)

5. A sensor log grows as N(t) = 250·e^(0.05t) records (t in days). At what rate is it growing at t = 5 days, in records per day?

Answer: records/day

Apply it

A plucked guitar string's displacement is roughly y = A·e^(−t/τ)·sin(ωt). Use the product and chain rules to write its velocity. Which term dominates when τ is very long?

Reflect

Explain in words why d/dt e^(kt) = k·e^(kt) means 'the rate is proportional to the amount'.

Go further (online)

Week 4: Rates of change

This week you will

Velocity and acceleration

A car brakes hard: s(t) = 20t − 2.5t² metres. When does it stop, how far does it go, and how hard is it decelerating? Two derivatives answer all three.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Motion planning for robots, lifts and vehicles is written in positions, but motors, passengers and brakes care about velocity and acceleration. A lift that reaches the right floor with a 3 m/s² jolt has failed its passengers, so engineers check every derivative of a planned motion.

Goals

Predict

s(t) = 20t − 2.5t² m. At what time does the car stop?

  1. 2 s
  2. 4 s
  3. 8 s
  4. It never stops

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose 'Braking'. Slide to the point where the top curve flattens: read the time and the distance. Look at the lower graph: what is its slope everywhere, and what does that number mean physically?

What the interactive shows, in words

In the derivative grapher's braking case, position s = 20t − 2.5t² rises and flattens at t = 4 s, 40 m. Velocity 20 − 5t is a straight line falling from 20 m/s to zero at 4 s; its constant slope −5 m/s² is the deceleration.

Understand

Two derivatives of motion

Velocity v = ds/dt (m/s) is the rate of change of position. Acceleration a = dv/dt = d²s/dt² (m/s²) is the rate of change of velocity: the second derivative of position. For s = 20t − 2.5t²: v = 20 − 5t and a = −5 m/s², constant braking.

Signs tell the story

v > 0, a < 0: moving forwards and slowing down (braking). v < 0, a < 0: moving backwards and speeding up. When v and a have the same sign the object speeds up; opposite signs, it slows down. A negative acceleration is not always 'slowing down'.

Models stop at their domain

The braking model predicts reversing after 4 s because a quadratic keeps going. Real brakes stop the car and friction drops to zero. Stating the domain 0 ≤ t ≤ 4 s keeps the model honest, as in week 1.

Explain it another way: intuitive

Position is where you are; velocity is the speedometer; acceleration is the push you feel in your seat. Each is the steepness of the graph before it.

Explain it another way: technical

s(t) → v = ṡ → a = s̈. Jerk j = da/dt is the third derivative; lift and rail designers limit it for comfort, typically to around 1–2 m/s³.

Explain it another way: mathematical

For constant acceleration, s = s₀ + v₀t + ½at², so v = v₀ + at and stopping time t = −v₀/a, stopping distance −v₀²/(2a). For 20 m/s and −5 m/s²: 40 m.

Explain it another way: applied

Car safety tests quote stopping distances from the same formula; doubling speed quadruples braking distance because of the v₀² term.

Try these examples

Example 1

For s = 20t − 2.5t², find the stopping distance.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A cart brakes with s(t) = 12t − 1.5t² m. At what time does it stop, in seconds?

Answer: s

2. Same cart, s = 12t − 1.5t². How far has it travelled when it stops, in metres?

Answer: m

3. s(t) = 2t³ − 3t² m. What is the acceleration at t = 2 s, in m/s²?

Answer: m/s²

4. At some instant a robot has v = −0.4 m/s and a = +0.2 m/s². What is happening?

  • Moving backwards and speeding up
  • Moving backwards and slowing down
  • Moving forwards and slowing down

5. A joint angle follows θ(t) = 0.5t⁴ + 3t² + 2 radians. Using the power rule, find the angular velocity dθ/dt at t = 1.5 s, in rad/s.

Answer: rad/s

Apply it

A lift moves 12 m with s(t) = 12(3(t/T)² − 2(t/T)³) over T = 6 s. Find v and a. Where is the speed greatest, and is the acceleration largest at the start? Would passengers notice a jolt at t = 0?

Reflect

Why is it important to state the domain of a braking model?

Go further (online)

Current and power are derivatives

An ampere is a coulomb per second. A watt is a joule per second. Electrical engineering is full of derivatives hiding behind familiar units.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Battery fuel gauges, capacitor sizing, inrush current and power ratings all depend on rates. If you know how a quantity changes in time, its derivative tells you the current or power the hardware must deliver, and whether a part will overheat.

Goals

Predict

A capacitor (C = 100 µF) has its voltage falling at 3 V/s. What current flows out of it?

  1. 0.3 mA
  2. 3 mA
  3. 30 mA
  4. No current: the voltage is falling, not rising

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the capacitor V = 12e^(−t/2). Put a at 0, 1, 2 and 4 s and read the tangent slope in V/s. Multiply each by C = 100 µF to get the current. How does the current compare with the voltage at each time?

What the interactive shows, in words

In the secant lab's capacitor curve V = 12e^(−t/2), the tangent slope is −6 V/s at t = 0, −3.64 V/s at 1 s and −2.21 V/s at 2 s: always half the voltage, negative. Multiplying by the capacitance gives the discharge current.

Understand

Current is the rate of charge

I = dQ/dt: one ampere is one coulomb passing per second. If a capacitor's charge is Q(t) = 4(1 − e^(−t)) mC, the charging current is I = 4e^(−t) mA: largest at switch-on, falling as the capacitor fills.

Capacitors: I = C·dV/dt

Q = C·V, so differentiating gives I = C·dV/dt. A capacitor passes current only while its voltage changes. A steady voltage means zero current, and a fast change means a big current, which is why a discharged capacitor across a supply draws an inrush spike.

Power is the rate of energy

P = dE/dt: one watt is one joule per second. A battery whose stored energy falls as E = 50 000 − 12t joules supplies 12 W. In reverse, integrating power gives energy (week 7). Power and energy are a derivative–integral pair, just like velocity and distance.

Explain it another way: intuitive

Charge is water in a tank; current is the flow rate from the tap. Energy is fuel in a tank; power is how fast you burn it.

Explain it another way: technical

I = dQ/dt (A = C/s), P = dE/dt (W = J/s), I_C = C·dV/dt, V_L = L·dI/dt for an inductor.

Explain it another way: mathematical

For V = V₀e^(−t/τ), dV/dt = −V/τ, so I = −C·V/τ = −V/R with τ = RC: Ohm's law through the discharge resistor, recovered from calculus.

Explain it another way: applied

Hot-swap controllers and soft-start circuits limit dV/dt when a board is plugged in, precisely to keep I = C·dV/dt of the board's input capacitors below what the connector can take.

Try these examples

Example 1

Q(t) = 4(1 − e^(−t)) mC. What is the current at t = 0 and t = 2 s?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Q(t) = 4(1 − e^(−t)) mC. What is the current at t = 0, in mA?

Answer: mA

2. C = 100 µF and dV/dt = −3 V/s. What is the capacitor current, in mA? (Negative means discharging.)

Answer: mA

3. A battery's stored energy falls as E(t) = 50 000 − 12t joules. What power does it deliver, in watts?

Answer: W

4. A capacitor sits at a steady 5 V for an hour. What current flows into it?

  • 5 A
  • It depends on the capacitance
  • Zero (ideally)

5. A sensor log grows as N(t) = 250·e^(0.05t) records (t in days). At what rate is it growing at t = 5 days, in records per day?

Answer: records/day

Apply it

A 470 µF capacitor is connected to 12 V through a 10 Ω resistor. Its voltage is V = 12(1 − e^(−t/τ)) with τ = RC. Find the current at switch-on and after one τ. Is the switch-on current what Ohm's law alone would give?

Reflect

In your own words, why does a capacitor 'block' steady (DC) voltage but pass changing signals?

Go further (online)

Rates from data: finite differences and noise

Your robot logs its position 100 times a second. Dividing the differences by 0.01 s should give perfect speed. Instead the speed plot looks like static. Why?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Sensors give samples, not formulas. Estimating velocity from encoder counts, current from charge readings or the D term of a PID controller all use finite differences, and all suffer from the same trade-off between step size and noise.

Goals

Predict

Positions are measured with ±2 mm noise. If you shrink the sample spacing h, what happens to the velocity estimate?

  1. It always gets more accurate
  2. It gets more accurate at first, then noisier as h gets very small
  3. Nothing changes

Write down your guess and your reason. The reveal is in the online lesson.

Discover

With zero noise, try the forward method at h = 0.5, 0.2, 0.1 s: read the largest error. Switch to central: how much better? Now set noise to ± 5 mm and step h down to 0.01 s. Find the h that gives the smallest error with noise, for each method.

What the interactive shows, in words

The finite-difference lab compares the true velocity 3cos(1.5t) + 0.5 with estimates from sampled positions. Without noise, forward errors fall in proportion to h and central errors much faster. With noise of a few millimetres, very small h gives scattered estimates; the readout reports the largest error and both error bounds.

Understand

Forward and central

Forward: v ≈ (sᵢ₊₁ − sᵢ)/h. Simple, usable in real time, error ∝ h. Central: v ≈ (sᵢ₊₁ − sᵢ₋₁)/(2h). Error ∝ h², so halving h quarters the error, but it needs the next sample, so it lags by one step in real time.

Differentiation amplifies noise

Noise of ε metres becomes a velocity error of order ε/h. With ε = 2 mm and h = 0.01 s that is up to 0.4 m/s of junk. Differentiating makes noise worse; integrating (week 7) averages it out. This is why the derivative term of a PID controller is usually filtered.

Choosing h

Balance the two errors: truncation falls as h shrinks, noise rises. In practice, either sample fast and then smooth (average several samples or fit a line through a window), or difference over a longer baseline than one sample.

Explain it another way: intuitive

Measuring speed from two marks 1 mm apart is hopeless if your ruler wobbles by 1 mm. Marks a metre apart give a rougher idea of 'instant' speed but a much steadier number.

Explain it another way: technical

Forward difference: O(h) truncation. Central: O(h²). Noise contribution: O(ε/h). Optimal h for central differences scales like (ε/|s‴|)^(1/3).

Explain it another way: mathematical

Minimise E(h) = (h²/6)M + ε/h: dE/dh = hM/3 − ε/h² = 0 gives h* = (3ε/M)^(1/3). Calculus choosing a numerical method's parameter.

Explain it another way: applied

Quadrature encoders count discrete ticks, so position noise is ±1 tick. Motor drivers estimate speed by timing the interval between ticks at low speed and counting ticks per period at high speed, switching to keep the error small.

Derivation: Why central differences are more accurate
  1. Taylor expansion: s(t + h) = s(t) + h·s′(t) + (h²/2)·s″(t) + (h³/6)·s‴(t) + …

  2. Forward difference: [s(t + h) − s(t)]/h = s′(t) + (h/2)·s″(t) + … The error is about (h/2)·s″: proportional to h.

  3. Also s(t − h) = s(t) − h·s′(t) + (h²/2)·s″(t) − (h³/6)·s‴(t) + …

  4. Central difference: [s(t + h) − s(t − h)]/(2h) = s′(t) + (h²/6)·s‴(t) + … The s″ terms cancel, so the error is proportional to h².

  5. Noise: if each sample is off by up to ε, the forward difference can be off by up to 2ε/h and the central by ε/h. Total error ≈ C·hᵖ + ε/h, smallest at a moderate h.

Try these examples

Example 1

Samples: s(0.9 s) = 1.10 m, s(1.0 s) = 1.32 m, s(1.1 s) = 1.50 m. Estimate v(1.0) by forward and central differences.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. s(0) = 0 m and s(0.1 s) = 0.29 m. Estimate the velocity at t = 0 with a forward difference, in m/s.

Answer: m/s

2. s(0.9) = 1.10 m and s(1.1) = 1.50 m. Estimate v(1.0) with a central difference, in m/s.

Answer: m/s

3. Position noise is up to ±2 mm and h = 0.01 s. What is the largest velocity error the noise could cause in a forward difference, in m/s?

Answer: m/s

4. Without noise, you halve h for a central difference. Roughly what happens to its error?

  • Halves
  • Quarters
  • Stays the same
  • Doubles

5. A trolley's position is s(t) = 5t² + 1t metres. What is its average velocity between t = 1 s and t = 1.1 s, in m/s?

Answer: m/s

Apply it

Write a short program (any language) that takes a list of positions sampled every h seconds and returns forward and central velocity estimates. Test it on s = 2·sin(1.5t) + 0.5t with and without added noise and plot the errors against h.

Reflect

Why does a PID controller's derivative term usually come with a filter?

Week 5: Optimisation

This week you will

Stationary points: the top of the hill

At the very best design, a small change in either direction makes things slightly worse. In calculus, that has a name: the derivative is zero.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Least material, most power, lowest cost, fastest time: optimisation is what engineers are paid for. For problems with one design variable and a smooth objective, calculus finds the optimum exactly, and gives a number to check any numerical search against.

Goals

Predict

You have 40 m of fence for three sides of a pen against a wall. Which side length x (the two sides touching the wall) gives the biggest area?

  1. x = 5 m
  2. x = 10 m
  3. x = 13.3 m (all sides equal)
  4. x = 20 m

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose 'Biggest pen against a wall'. Slide x and watch the sign of dA/dx in the readout: it tells you which way to move. Find the top by following the sign, then reveal the optimum. Change L and predict where the new optimum is before you look.

What the interactive shows, in words

In the optimiser's pen mode, area A(x) = x(L − 2x) is a downward parabola. The readout gives dA/dx = L − 4x: positive for small x, negative for large x, zero at x = L/4, where the area is L²/8 (200 m² for L = 40 m).

Understand

Stationary points

Where f′(x) = 0 the tangent is horizontal: a stationary point. It may be a local maximum, a local minimum or a stationary inflection (like x³ at 0, flat but still rising). Solve f′ = 0 to find the candidates.

Classifying

Second-derivative test: f″ < 0 means a maximum (concave down), f″ > 0 a minimum, f″ = 0 inconclusive. Sign test: if f′ changes from + to − the point is a maximum; − to +, a minimum. The sign test always works.

Endpoints and domains

On a closed interval, the best value may sit at an end, not at a stationary point. A pump limited to 0 ≤ q ≤ 10 L/s whose stationary point is at 15 L/s has its best allowed design at q = 10. Always list candidates: stationary points inside the domain plus both endpoints.

Explain it another way: intuitive

Walk along the cost curve: if each step downhill makes it lower, keep going. When the ground is flat under your feet, you are at the bottom (or the top, or a ledge: check).

Explain it another way: technical

Necessary condition for an interior optimum of a differentiable f: f′(x) = 0. Sufficient: f′(x) = 0 and f″(x*) ≠ 0 with the right sign.

Explain it another way: mathematical

Near x, f(x) ≈ f(x) + ½f″(x)(x − x)². This is why optima are 'flat': a small design error δ costs only about ½f″δ², second order.

Explain it another way: applied

Because optima are flat, engineers can round an optimal radius or gain to a convenient value with little penalty, but must not round across the edge of a constraint.

Derivation: The optimum of a quadratic cost
  1. Many design costs are well modelled near their optimum by a quadratic C(q) = a·q² − b·q + c with a > 0 (for example, wear rising with the square of flow rate while faster pumping saves time).

  2. Differentiate: C′(q) = 2a·q − b.

  3. Set C′(q) = 0: q* = b/(2a).

  4. Second derivative: C″(q) = 2a > 0, so the curve is concave up and q* is a minimum.

  5. Minimum cost: C(q*) = c − b²/(4a). The same steps give the vertex of any parabola.

Try these examples

Example 1

Classify the stationary points of f(x) = x³ − 3x.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A rectangular pen is built against a long wall with 24 m of fencing for the other three sides. If each side touching the wall is x m long, the area is A(x) = x(24 − 2x). Which x gives the largest area, in metres?

Answer: m

2. f(x) = −2x² + 8x + 1. What is its maximum value?

Answer:

3. At a stationary point f′(a) = 0 and f″(a) = 5. What is it?

  • A local maximum
  • A local minimum
  • An inflection point

4. A cost C(q) = 0.1q² − 3q + 50 has its stationary minimum at q = 15, but the pump can only run for 0 ≤ q ≤ 10. Where is the cheapest allowed setting?

  • q = 15
  • q = 10
  • q = 0

5. A rectangular pen is built against a long wall with 40 m of fencing for the other three sides. If each side touching the wall is x m long, the area is A(x) = x(40 − 2x). Which x gives the largest area, in metres?

Answer: m

Apply it

A rectangular solar panel frame has a fixed perimeter of 4 m. Show that the area is greatest for a square. Then add a constraint that the height may not exceed 0.8 m: what is the best design now, and why is it not at f′ = 0?

Reflect

Why is an optimum 'flat', and why is that good news for manufacturing tolerances?

Go further (online)

The minimum-material can

A drinks company makes billions of cans. Shave a few square centimetres of aluminium from each and you save thousands of tonnes. What shape uses the least metal?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Constrained design is the everyday form of optimisation: fixed volume, minimum material; fixed budget, maximum performance. The pattern here (write the objective, use the constraint to eliminate a variable, differentiate) is the one you will reuse all year.

Goals

Predict

For a closed cylinder holding a fixed volume, which shape uses the least metal?

  1. Tall and thin, like a tube
  2. Height equal to the diameter
  3. Wide and flat, like a tuna tin
  4. All shapes use the same metal

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the minimum-metal can at 330 mL. Drag the radius from 1.5 to 10 cm and watch the can's shape and the area curve. Use the sign of dA/dr to home in on the minimum, then reveal it and check h/r. Change the volume: does h = 2r still hold?

What the interactive shows, in words

In the optimiser's can mode, a can is drawn to scale beside its area curve A(r) = 2πr² + 2V/r, which falls steeply, bottoms out and then rises. For 330 cm³ the minimum is at r ≈ 3.74 cm, h ≈ 7.49 cm, area ≈ 264 cm². The readout gives h/r and the sign of dA/dr.

Understand

Objective, constraint, decision

Name three things before any calculus. Objective: what to minimise or maximise (metal area). Constraint: what must hold (volume = 330 cm³). Decision variable: what you choose (radius). The constraint lets you write everything in terms of one variable.

Reading the result

For 330 cm³: r* = (330/2π)^(1/3) ≈ 3.74 cm, h* ≈ 7.49 cm, A* ≈ 264 cm². A 3 cm radius needs 277 cm²: 5% more metal. Because the optimum is flat, being a few millimetres off costs very little; being far off costs a lot.

Why real cans are taller

Real drinks cans are about 6.6 cm wide and 11.5 cm tall. The model assumed uniform metal thickness, but can ends are much thicker than walls (they resist the pressure), so wall area is cheaper than end area. Grip, stacking and vending machines matter too. The model is right about its assumptions; the assumptions differ from reality.

Explain it another way: intuitive

Squash a can flat and its two big lids waste metal. Stretch it tall and the long wall wastes metal. Somewhere in between the two wastes balance: that is where the derivative is zero.

Explain it another way: technical

Constrained optimisation by substitution. With different costs per area for ends (cₑ) and wall (c_w), the same method gives h/r = 2cₑ/c_w: thicker ends push the optimum taller.

Explain it another way: mathematical

At the optimum, the area saved on the ends by shrinking r (dA_ends/dr = 4πr) exactly equals the area added to the wall (−dA_wall/dr = 2V/r²): marginal costs balance.

Explain it another way: applied

Packaging engineers run exactly this calculation, with real material costs and manufacturing constraints, every time they design a container. Reducing metal by 1% across a product line saves a large mass of aluminium per year.

Derivation: Minimising the surface area of a can
  1. Objective: surface area A = 2πr² (two ends) + 2πrh (the wall). Constraint: volume V = πr²h is fixed.

  2. Use the constraint to eliminate h: h = V/(πr²).

  3. Substitute: A(r) = 2πr² + 2πr·V/(πr²) = 2πr² + 2V/r, a function of r alone.

  4. Differentiate: A′(r) = 4πr − 2V/r².

  5. Set A′ = 0: 4πr³ = 2V, so r* = (V/(2π))^(1/3).

  6. Then h* = V/(πr²) = 2πr³/(πr²) = 2r: height equals diameter.

  7. A″(r) = 4π + 4V/r³ > 0 for all r > 0, so this is the minimum.

Try these examples

Example 1

Find the minimum-metal radius for a 500 mL can.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. At the minimum-metal optimum, what is the ratio h/r?

Answer:

2. What is the minimum-metal radius for a 500 cm³ closed can, in cm?

Answer: cm

3. For V = 330 cm³, what is the area A = 2πr² + 2V/r at r = 3 cm, in cm²?

Answer: cm²

4. Real drinks cans are taller than h = 2r. What is the most important reason?

  • The calculus is wrong
  • The model assumed equal thickness everywhere, but the ends are much thicker, so end area costs more
  • Tall cans hold more drink

5. A rectangular pen is built against a long wall with 40 m of fencing for the other three sides. If each side touching the wall is x m long, the area is A(x) = x(40 − 2x). Which x gives the largest area, in metres?

Answer: m

Apply it

Redo the can with end metal three times as expensive per cm² as wall metal: minimise cost C = 3·(2πr²) + 2πrh. Show h/r = 6 at the optimum and compare with a real can's ratio (about 3.5).

Reflect

What did the gap between the ideal can and real cans teach you about the role of assumptions in a model?

Go further (online)

Maximum power transfer

A 12 V battery with 4 Ω of internal resistance drives a load. Make the load small and the current is huge; make it big and the current is tiny. Which load gets the most power?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Matching a load to its source appears in audio amplifiers, antennas, solar-panel trackers and sensor interfaces. But power grids and battery packs deliberately do not match, because matching wastes half the energy. Calculus tells you both facts.

Goals

Predict

A source has EMF 12 V and internal resistance 4 Ω. Which load resistance receives the most power?

  1. 0 Ω (largest current)
  2. 4 Ω (equal to the internal resistance)
  3. 100 Ω (largest voltage across it)

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose maximum power transfer. Set r = 4 Ω and slide R: find the peak using the sign of dP/dR. Read the efficiency there. Now change r and find the new peak. What rule links the best R to r?

What the interactive shows, in words

In the optimiser's power mode, load power P(R) rises from zero, peaks and falls slowly. For r = 4 Ω the peak is at R = 4 Ω with 9 W and 50% efficiency; the readout reports power, efficiency and the sign of dP/dR at the chosen load.

Understand

The model

A real source is an ideal EMF V in series with an internal resistance r. With a load R the current is V/(R + r) and the load gets P = V²R/(R + r)². Both extremes give zero power: R = 0 (no voltage across the load) and R → ∞ (no current).

The result

Calculus gives R = r, P_max = V²/(4r). For 12 V and 4 Ω: 9 W. The curve is flat near the top: R = 8 Ω still gives 8 W. Matching does not need to be exact.

Power is not efficiency

At R = r, as much power is wasted inside the source as is delivered: 50% efficiency. Power grids run with loads far larger than the source resistance, for efficiencies above 90%. Choose the objective first: maximum power (signals, antennas) or maximum efficiency (energy systems).

Explain it another way: intuitive

Too little load resistance and the source's own resistance eats all the voltage; too much and hardly any current flows. Halfway between, sharing the voltage equally, is the sweet spot for power.

Explain it another way: technical

P(R) = V²R/(R + r)², P′ = V²(r − R)/(R + r)³, optimum R = r, η = R/(R + r).

Explain it another way: mathematical

Write x = R/r: P = (V²/r)·x/(1 + x)². The shape is the same for every source; the peak is always at x = 1 with height ¼ in units of V²/r.

Explain it another way: applied

Solar panels have no fixed internal resistance, so a maximum-power-point tracker continually adjusts the effective load to find the top of the power curve, a numerical optimisation running all day.

Derivation: Why R = r maximises the load power
  1. Current I = V/(R + r), so the load power is P = I²R = V²R/(R + r)².

  2. Differentiate with the quotient rule (u = V²R, v = (R + r)²): P′ = V²[(R + r)² − R·2(R + r)]/(R + r)⁴.

  3. Simplify by cancelling one (R + r): P′ = V²(R + r − 2R)/(R + r)³ = V²(r − R)/(R + r)³.

  4. P′ = 0 only at R = r. For R < r, P′ > 0 (rising); for R > r, P′ < 0 (falling): a maximum.

  5. Maximum power P_max = V²r/(2r)² = V²/(4r). Efficiency R/(R + r) = ½ at the optimum.

Try these examples

Example 1

V = 12 V, r = 4 Ω. Find P at R = 8 Ω and compare with the maximum.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A 12 V source has internal resistance 4 Ω. What is the maximum power it can deliver to a load, in watts?

Answer: W

2. Same source (12 V, 4 Ω) with R = 8 Ω. What power reaches the load, in watts?

Answer: W

3. What is the efficiency (in %) when the load is matched, R = r?

Answer: %

4. Why do power stations not match their loads for maximum power transfer?

  • They do, it is required by law
  • Matching would waste half the generated energy as heat in the source and lines
  • Matching would make the voltage too high

Apply it

A sensor with 1 kΩ output resistance feeds an amplifier. For maximum signal power, what input resistance should the amplifier have? For maximum signal voltage (the usual goal), what should it have instead, and why?

Reflect

Give one situation where you would choose maximum power and one where you would choose maximum efficiency.

Go further (online)

Week 6: Integrals

This week you will

Riemann sums: adding up thin strips

A drone's climb rate changes every moment. How high has it gone after 4 seconds? Chop time into strips, pretend the rate is constant in each, and add.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Distance from speed, energy from power, charge from current, water from a flow meter: every total is a sum of rate × small time. This is the second half of calculus and the basis of every numerical integrator, from a step counter to a spacecraft navigation computer.

Goals

Predict

A drone climbs at v(t) = 0.5t² + 1 m/s. A left Riemann sum with 4 one-second strips over 0–4 s gives 11 m. Is the true height gained more or less than 11 m?

  1. More
  2. Less
  3. Exactly 11 m

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the drone climb rate, rule Left and n = 4. Read the estimate. Switch to Right and Midpoint. Then double n repeatedly: by what factor does the left-sum error shrink each time? What about the midpoint error?

What the interactive shows, in words

The accumulator draws rectangles under the drone climb-rate curve. With 4 left strips the estimate is 11 m against an exact 14.67 m; right strips give 19 m; midpoint 14.5 m. Doubling the strips halves the left and right errors and quarters the midpoint error, as the readout's error ratio shows.

Understand

Rate × width, added up

Split [a, b] into n strips of width Δt = (b − a)/n. In each, take one sample of the rate and multiply by Δt. Left uses the start of each strip, right the end, midpoint the middle. Each product has the units of the total: (m/s) × s = m.

Bracketing and error

For an increasing rate, left sums underestimate and right sums overestimate, so the truth lies between. Doubling n halves the left or right error (error ∝ Δt). The midpoint sum is far better: its error falls by about 4 each time n doubles (∝ Δt²).

The definite integral

As n → ∞ every rule converges to the same number, the definite integral ∫ₐᵇ f(t) dt: the exact accumulated quantity and the area under the curve (counting area below the axis as negative). The ∫ is a stretched S for 'sum' and dt recalls Δt.

Explain it another way: intuitive

Fill the area under the curve with Lego bricks. Thinner bricks fit the curve more closely. With infinitely thin bricks there is no gap left: that is the integral.

Explain it another way: technical

Rₙ = Σᵢ f(tᵢ)·Δt with tᵢ in the i-th strip. For continuous f, Rₙ → ∫ₐᵇ f dt as n → ∞. Left/right error ≈ ½(b − a)·Δt·f′ on average; midpoint ≈ (b − a)·Δt²·f″/24.

Explain it another way: mathematical

∫ₐᵇ f(t) dt = lim (n→∞) Σ f(tᵢ*)Δt. Linearity: ∫(αf + βg) = α∫f + β∫g. Additivity: ∫ₐᵇ + ∫ᵇᶜ = ∫ₐᶜ.

Explain it another way: applied

A car's trip computer adds speed × time for every short interval to estimate distance; a smart meter adds power × time every few seconds to bill you in kilowatt-hours.

Try these examples

Example 1

Left, right and midpoint sums for v = 0.5t² + 1 on [0, 4] with n = 4.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A drone's climb rate is v(t) = 2t² + 0 m/s. Estimate the height gained from t = 0 to t = 4 s with a midpoint Riemann sum of 6 equal strips, in metres.

Answer: m

2. Right Riemann sum of v = 0.5t² + 1 m/s on [0, 4] with 4 strips, in metres.

Answer: m

3. Midpoint sum for the same rate, [0, 4], 4 strips, in metres.

Answer: m

4. A tank drains with an outflow rate that decreases over time. A left Riemann sum of the outflow will…

  • underestimate the water lost
  • overestimate the water lost
  • be exact

5. A drone's climb rate is v(t) = 3t² + 1 m/s. Estimate the height gained from t = 0 to t = 2 s with a right Riemann sum of 5 equal strips, in metres.

Answer: m

Apply it

Record your speed every 10 s on a short walk or bike ride (a phone app or estimates). Estimate the distance with left and right sums. Compare with a map. Which sum is closer, and why?

Reflect

Why does the midpoint rule do so much better than the left and right rules for the same number of strips?

Go further (online)

Definite integrals, exactly

A thousand thin strips give 14.666 m. A million give 14.6666… Is there a way to get the exact answer without adding forever?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Exact integrals are the benchmark for every numerical method and the fast route to totals when the rate is a formula: the distance a planned motion covers, the charge in a pulse, the work to stretch a spring.

Goals

Predict

What is ∫₀² 3t² dt?

  1. 6
  2. 8
  3. 12
  4. 24

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the spring force F(x) = 200x and the midpoint rule: compare the estimate with the exact value even for n = 1. Why is it exact? Then choose the drone climb rate with n = 64 and compare with the exact 14.667 m from the antiderivative x³/6 + x.

What the interactive shows, in words

The accumulator shows sums converging to the exact integral. For the spring force 200x the midpoint rule is exact at any n because the curve is a straight line. For the drone, 64 midpoint strips give 14.6657 m against the exact 14.6667 m.

Understand

Antiderivatives

F is an antiderivative of f if F′ = f. Reverse the power rule: ∫tⁿ dt = tⁿ⁺¹/(n + 1) + C for n ≠ −1. Constants and sums carry through: ∫(4t³ + 2t + 5) dt = t⁴ + t² + 5t + C. Also ∫e^(kt) dt = e^(kt)/k and ∫cos t dt = sin t.

Evaluating F(b) − F(a)

∫ₐᵇ f(t) dt = F(b) − F(a), written [F(t)]ₐᵇ. The constant C cancels. For the drone: ∫₀⁴ (0.5t² + 1) dt = [t³/6 + t]₀⁴ = 64/6 + 4 = 14.667 m, the exact limit of last lesson's sums.

Signed area

Area below the axis counts as negative. ∫ of a velocity that goes negative gives displacement (net change in position), not total distance travelled. For distance, integrate |v| by splitting at the zeros. Units still multiply: A × s = C, W × s = J.

Explain it another way: intuitive

Integrating undoes differentiating. If you know how fast something changes, the antiderivative is the 'total so far' function, and subtracting its value at the start from its value at the end gives what accumulated in between.

Explain it another way: technical

∫ₐᵇ f dt = F(b) − F(a) for any antiderivative F of a continuous f. ∫ₐᵇ = −∫ᵇₐ, and ∫ₐᵃ = 0.

Explain it another way: mathematical

Simpson's rule ((b − a)/6)·[f(a) + 4f((a + b)/2) + f(b)] is exact for every cubic, which makes it a handy independent check on polynomial integrals.

Explain it another way: applied

Motion profiles for robots are often planned as polynomials precisely because their integrals (distance) and derivatives (velocity, acceleration) are exact and cheap to evaluate on a microcontroller.

Derivation: ∫₀ᴮ t² dt from a Riemann sum
  1. Right sum with n strips: Δt = B/n and tᵢ = iB/n for i = 1 … n.

  2. Sum: Σ (iB/n)²·(B/n) = (B³/n³)·Σ i².

  3. Use the formula Σᵢ₌₁ⁿ i² = n(n + 1)(2n + 1)/6.

  4. So the sum = (B³/6)·(n + 1)(2n + 1)/n² = (B³/6)·(2 + 3/n + 1/n²).

  5. As n → ∞ the 1/n terms vanish: ∫₀ᴮ t² dt = B³/3. That matches the antiderivative t³/3 evaluated from 0 to B.

Try these examples

Example 1

A current I(t) = 2t + 1 A flows from t = 1 s to t = 3 s. How much charge passes?

The worked solution is in the online lesson.

Example 2

v(t) = 4 − 2t m/s from 0 to 3 s. Find the displacement and the distance travelled.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Find the exact distance travelled (velocity in m/s) from t = 1 s to t = 5 s when v(t) = -1t² + 1t + 10.

Answer: m

2. Find ∫₀⁴ (0.5t² + 1) dt exactly, in metres (3 decimal places).

Answer: m

3. Evaluate ∫₀² 3t² dt.

Answer:

4. ∫₀⁶ v(t) dt = 0 for a robot's velocity. What can you conclude?

  • The robot never moved
  • The robot ended where it started
  • The robot travelled 0 m in total

5. Find the exact distance travelled (velocity in m/s) from t = 2 s to t = 5 s when v(t) = 1t² − 2t + 5.

Answer: m

Apply it

A planned joint motion has angular velocity ω(t) = 6t − 3t² rad/s for 0 ≤ t ≤ 2 s. How far does the joint turn? Check with the Riemann lab idea (midpoint, 4 strips) by hand.

Reflect

Why does the constant C disappear in a definite integral?

Go further (online)

The fundamental theorem: slope of the total

Why should 'area under a curve' and 'slope of a curve' have anything to do with each other? The answer is the single most useful idea in calculus.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

The fundamental theorem joins derivatives and integrals into one toolkit. It is why a battery gauge can be built by integrating current, why charge and current are two views of one thing, and why solving a differential equation means 'integrating' it.

Goals

Predict

A(x) is the area under f from 0 to x. If f(3) = 5, how fast is A growing at x = 3?

  1. 0
  2. 3
  3. 5
  4. 15

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose motor power P(t) = 20 + 15·sin t. Slide the upper limit b and watch the green running total and its dashed tangent. Where is the total growing fastest? Where is it barely growing? Compare each with the height of the power curve above.

What the interactive shows, in words

In the accumulator's motor-power case the lower green curve is the running energy total. It rises steepest near t = 1.6 s where power is greatest (35 W) and most gently near t = 4.7 s where power is lowest (5 W). Its dashed tangent slope always equals the power at the upper limit, as the readout states.

Understand

Accumulation functions

Fix a start a and let the end vary: A(x) = ∫ₐˣ f(t) dt is the total accumulated up to x. For a power trace, A(x) is the energy used so far; for a current, the charge delivered so far. A(a) = 0, and A grows wherever f is positive.

The theorem

Part 1: A′(x) = f(x). Adding a sliver from x to x + h adds about f(x)·h, so [A(x + h) − A(x)]/h → f(x). Part 2: if F is any antiderivative of f, then ∫ₐᵇ f = F(b) − F(a). Part 2 is what you used last lesson; Part 1 is why it works.

Reading graphs both ways

Where the rate f is large, the total A climbs steeply; where f = 0, A is flat (a stationary point); where f < 0, A falls. The total's slope is the rate, so every skill from week 3 (sketching f′) now runs in reverse: sketch the total from the rate.

Explain it another way: intuitive

Your bank balance is the accumulation of all money in and out. How fast the balance is changing today is exactly today's net income. Balance and income are integral and derivative of each other.

Explain it another way: technical

If f is continuous on [a, b], then A(x) = ∫ₐˣ f is differentiable and A′ = f. Hence differentiation and integration are inverse operations (up to a constant).

Explain it another way: mathematical

Mean value view: A(x + h) − A(x) = ∫ₓˣ⁺ʰ f = h·f(c) for some c between x and x + h. Divide by h and let h → 0: c → x, so A′(x) = f(x).

Explain it another way: applied

Battery fuel gauges use 'coulomb counting': integrate the measured current to track charge. Its derivative, the current, is what the gauge measures directly.

Try these examples

Example 1

A(x) = ∫₀ˣ 3t² dt. Find A(x) and A′(2).

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A(x) = ∫₀ˣ 3t² dt. What is A′(2)?

Answer:

2. Q(t) = ∫₀ᵗ I(s) ds is the charge delivered. If I(3 s) = 2 A, at what rate is Q increasing at t = 3 s, in C/s?

Answer: C/s

3. On a graph of energy used E(t) = ∫₀ᵗ P dt, where is E(t) momentarily flat?

  • Where P is largest
  • Where P = 0
  • Where P is negative

4. Which statement is the fundamental theorem (Part 1)?

  • d/dx ∫ₐˣ f(t) dt = f(x)
  • ∫ f′ = f′
  • Every function has an integral equal to its area

5. Find the exact distance travelled (velocity in m/s) from t = 2 s to t = 5 s when v(t) = 1t² − 2t + 5.

Answer: m

Apply it

Sketch the power drawn by a phone over a day (charging is negative from the battery's view). Below it, sketch the battery energy as an accumulation. Mark where the battery level peaks and explain using the theorem.

Reflect

Explain the fundamental theorem using a bath being filled and drained.

Go further (online)

Week 7: Accumulation and physical quantities

This week you will

Work, charge and energy as integrals

Stretching a spring gets harder the further you go. How much energy have you stored when it is 30 cm long? Force times distance fails: the force keeps changing.

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Product formulas (W = F·d, Q = I·t, E = P·t) only work when the rate is constant. Real springs, discharging capacitors and varying motor loads need the integral, and the integral is what sizing a battery, a spring or a fuse actually rests on.

Goals

Predict

A spring with k = 200 N/m is stretched from 0 to 0.3 m. The final force is 60 N. How much work is done?

  1. 18 J (60 N × 0.3 m)
  2. 9 J
  3. 60 J
  4. 0.3 J

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the spring force with the trapezoid rule and n = 1: why is even one trapezoid exact? Then choose the discharge current I = 3e^(−t/2) and slide b to the end: how much charge has flowed by 6 s, and how close is it to the 6 C total for all time?

What the interactive shows, in words

In the accumulator, the spring force 200x is a straight line, so one trapezoid gives the exact work of 9 J at 0.3 m. For the discharge current 3e^(−t/2), the running charge total rises steeply then levels off towards 6 C, reaching about 5.70 C by 6 s.

Understand

Work from a varying force

W = ∫ F dx: force times a small displacement, added up. For a spring F = kx, W = ½kx², the energy stored. A product W = F·d is only right if F is constant; otherwise use the area under the force–displacement graph, in N × m = J.

Charge from a varying current

Q = ∫ I dt. A discharging capacitor's current I = I₀e^(−t/τ) delivers Q = I₀τ(1 − e^(−t/τ)), approaching I₀τ in total. For I₀ = 3 A and τ = 2 s that is 6 C, of which 95% has flowed by t = 3τ = 6 s.

Energy from a varying power

E = ∫ P dt. A motor drawing 20 + 15·sin t watts for 6 s uses [20t − 15cos t]₀⁶ = 120 − 15cos 6 + 15 ≈ 120.6 J. Units: W × s = J; W × h = Wh = 3600 J. Battery capacities are given in Wh or mAh (charge, which becomes energy when multiplied by voltage).

Explain it another way: intuitive

Anything whose rate changes is totalled the same way: chop into small pieces where the rate is nearly constant, multiply, add. Spring work, battery drain and water through a meter are one idea.

Explain it another way: technical

W = ∫F·dx, Q = ∫I dt, E = ∫P dt = ∫V·I dt. For exponentials, ∫₀ᵗ e^(−s/τ) ds = τ(1 − e^(−t/τ)).

Explain it another way: mathematical

Spring: ∫₀ˣ ks ds = ½kx². The quadratic grows faster than the force, which is why doubling a spring's stretch stores four times the energy.

Explain it another way: applied

A catapult or bow is a spring energy store: ½kx² at full draw. Robot designers use the same integral to size the spring in a jumping robot's legs.

Try these examples

Example 1

A capacitor current I = 3e^(−t/2) A. How much charge flows in the first 2 s?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A spring with k = 200 N/m is stretched from 0 to 0.3 m. How much work is done, in joules?

Answer: J

2. I(t) = 3e^(−t/2) A flows for all time from t = 0. What total charge passes, in coulombs?

Answer: C

3. A motor draws a steady 20 W for 3 minutes. How much energy does it use, in joules?

Answer: J

4. What does the area under a force–displacement graph represent?

  • Power
  • Work (energy), in joules
  • Momentum

5. Find the exact distance travelled (velocity in m/s) from t = 2 s to t = 5 s when v(t) = 1t² − 2t + 5.

Answer: m

Apply it

A robot's jumping leg uses a spring of k = 800 N/m compressed 0.1 m. How much energy is stored? If all of it lifted a 0.5 kg robot, how high could it jump (E = mgh)? Name two reasons the real jump will be lower.

Reflect

When can you use 'rate × time' directly, and when do you need an integral?

Go further (online)

The trapezoid rule and its error

Replace rectangles with sloped tops and the error drops by a factor of four every time you halve the step. Why four, and when does it overshoot?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Real data arrive as samples, and the trapezoid rule is the standard way to integrate them: logged power, flow, speed. Knowing its error lets you choose a sample rate before collecting data, rather than discovering afterwards that it was too slow.

Goals

Predict

You integrate a smooth curve with the trapezoid rule, then halve the step size. Roughly what happens to the error?

  1. It halves
  2. It falls to about a quarter
  3. It stays the same
  4. It doubles

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the drone climb rate and the trapezoid rule. Step n through 1, 2, 4, 8, 16 and watch the error ratio in the readout settle near 4. Is the trapezoid estimate above or below the exact value? Look at the curve's shape to explain it.

What the interactive shows, in words

With the trapezoid rule on the drone climb rate, the estimate is 15 m at n = 4 against an exact 14.667 m, and each doubling of n divides the error by about 4. The estimate is always slightly high because the curve bends upwards.

Understand

The rule

Join neighbouring samples with straight lines and add the trapezoids: T = h·(y₀/2 + y₁ + y₂ + … + yₙ₋₁ + yₙ/2). End samples count half, inner samples fully. It is the average of the left and right sums.

Error and concavity

Error ≈ (b − a)·h²·f″/12. For a curve that bends upwards (f″ > 0, convex) the straight tops lie above it: the trapezoid overestimates. For a curve bending down it underestimates. For a straight line it is exact.

Choosing a sample rate

If you know roughly how sharply a signal bends (f″), the formula tells you the step needed for a target accuracy before you log anything. If you do not, integrate with h and with h/2: the difference is about three-quarters of the error of the coarser estimate, a check you can run on any data.

Explain it another way: intuitive

Rectangles have flat tops that miss the curve on one side of every strip. Trapezoids tilt their tops to touch the curve at both ends, so they only miss where the curve bends.

Explain it another way: technical

Composite trapezoid: E_T ≈ −(b − a)h²f″(ξ)/12 (sign: exact minus estimate). Richardson extrapolation (4T_{h/2} − T_h)/3 cancels the h² term; it equals Simpson's rule.

Explain it another way: mathematical

Since T = (L + R)/2 and L, R have errors ∓½h·[f(b) − f(a)] + O(h²), the first-order errors cancel, leaving O(h²).

Explain it another way: applied

Pharmacologists integrate blood-concentration samples with the trapezoid rule to get a drug's 'area under the curve', and battery test rigs integrate sampled current the same way.

Derivation: Where the h² error comes from
  1. Take one strip of f(x) = x² on [0, h] (any smooth curve looks like a parabola up close).

  2. Trapezoid: h × (f(0) + f(h))/2 = h × (0 + h²)/2 = h³/2.

  3. Exact: ∫₀ʰ x² dx = h³/3. Error per strip: h³/2 − h³/3 = h³/6.

  4. For a general curve the per-strip error is about (h³/12)·f″; here f″ = 2, giving h³/6 as found.

  5. An interval of length L has n = L/h strips, so the total error ≈ (L/h)·(h³/12)·f″ = L·h²·f″/12.

  6. Halve h: the error falls to a quarter. Check: v = 0.5t² + 1 (f″ = 1) on [0, 4] with h = 1 gives 4 × 1 × 1/12 = 0.333 m; the trapezoid sum is 15 m against 14.667 m exact.

Try these examples

Example 1

Trapezoid rule for v = 0.5t² + 1 on [0, 4] with h = 1.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A robot's power draw was logged every 10 s: 8, 15, 15, 4, 8, 10 W. Estimate the energy used over the log with the trapezoid rule, in joules.

Answer: J

2. Trapezoid rule for v = 0.5t² + 1 m/s on [0, 4] with h = 1 s, in metres.

Answer: m

3. Predict the trapezoid error for the same integral with h = 0.5 s, in metres, using (b − a)h²f″/12 (f″ = 1).

Answer: m

4. The trapezoid rule is applied to a curve that bends upwards (convex). The estimate is…

  • too high
  • too low
  • exact

5. A robot's power draw was logged every 30 s: 0, 10, 8, 5, 5, 2, 0 W. Estimate the energy used over the log with the trapezoid rule, in joules.

Answer: J

Apply it

Integrate sin t from 0 to π (exact answer 2) with the trapezoid rule using 2, 4 and 8 strips by hand or in a spreadsheet. Confirm the error ratios are near 4, then combine two estimates with (4T_{h/2} − T_h)/3. How close is it?

Reflect

How would you choose a logging interval for a power trace if you wanted the energy to within 1%?

Energy budget from a power log

A delivery robot logged its power draw every second for a whole route. Will its 10 Wh battery last two routes? Code the integral and find out.

About 45 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Battery-powered systems live or die by their energy budget. The data arrive as a log, not a formula, so the integral is a few lines of code. Getting the units and the sample rate right is where real projects go wrong.

Goals

Safety: Work with logs and simulations only. Do not open or short battery packs to measure them.

Predict

A log reads 0, 10, 10, 0 W at 60 s intervals. What energy does the trapezoid rule give?

  1. 600 J
  2. 1200 J
  3. 1800 J
  4. 20 J

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the Code Lab. Write trapezoid(samples, h) that returns h × (sum − first/2 − last/2). Test it on [0, 10, 10, 0] with h = 60 (expect 1200). Then generate a power log, for example 20 + 15·sin(t) sampled every 0.5 s for 6 s, and compare with the exact 120.6 J. Halve the step and check the error ratio.

What the interactive shows, in words

This lesson's activity is writing a short trapezoid-rule function in the Code Lab. The expected results: [0, 10, 10, 0] W at 60 s spacing gives 1200 J; 20 + 15·sin t over 6 s gives close to the exact 120.6 J, with the error falling by about four each time the step halves.

Understand

From samples to joules

With power samples p₀ … pₙ every h seconds: E ≈ h·(p₀/2 + p₁ + … + pₙ₋₁ + pₙ/2) joules. Ten lines of code, but test it on a case you can do by hand first (a constant power gives P × total time exactly).

Units that trip people up

1 Wh = 3600 J. Battery capacity in mAh is charge: a 2000 mAh cell at a nominal 3.7 V stores about 2 × 3.7 = 7.4 Wh. Divide energy by average power for run time: 10 Wh at an average 2.5 W lasts 4 h, ignoring the usable fraction and temperature effects.

Is the log fast enough?

A motor starting can draw several times its running power for a fraction of a second. If you sample once a second you may miss the spike or catch it by luck. Compare the integral at your rate with every second sample: a big change means the log is too coarse. Spikes also matter for peak current, even when their energy is small.

Explain it another way: intuitive

A power log is a tally of how hard the battery is being worked, moment by moment. Adding up 'how hard × how long' gives how much it has been drained.

Explain it another way: technical

E = Σ ½(pᵢ + pᵢ₊₁)h. Margin: design for E_route × safety factor (often 1.2–1.5) plus reserve, below the usable battery energy.

Explain it another way: mathematical

If noise in each sample is independent with spread σ, the noise in the trapezoid total grows only like σ·h·√n, much less than n·σ·h: integration averages noise, the opposite of differentiation.

Explain it another way: applied

Drone flight controllers integrate measured current continuously to estimate remaining battery and trigger return-to-home before the reserve is used.

Try these examples

Example 1

A route uses 5400 J. How many Wh is that, and how many routes fit in a 10 Wh battery with 20% kept in reserve?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A robot's power draw was logged every 10 s: 8, 15, 15, 4, 8, 10 W. Estimate the energy used over the log with the trapezoid rule, in joules.

Answer: J

2. Convert 5400 J to watt-hours.

Answer: Wh

3. A 10 Wh battery powers a device averaging 2.5 W. Ideal run time, in hours?

Answer: h

4. Power samples 0, 10, 10, 0 W every 60 s. Trapezoid energy, in joules?

Answer: J

5. A log sampled once every 10 s shows a smooth 3 W, but the robot has a 15 W motor that starts for 0.5 s every 20 s. What is the main risk?

  • None: the average is all that matters
  • The log can miss the motor bursts, underestimating energy and hiding the peak current
  • The trapezoid rule fails for constant power

Apply it

Estimate one day's energy for a device you own (phone, laptop or a sensor) by guessing its power in each activity and the time spent. Build the log in a spreadsheet at one-hour steps, integrate it, and compare with its battery capacity.

Reflect

Why does integrating noisy samples give a steadier answer than differentiating them?

Week 8: Introduction to differential equations

This week you will

Rate equations and exponential decay

A hot drink cools fastest when it is hottest. A capacitor discharges fastest when it is fullest. Write that sentence as an equation and the solution writes itself.

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

This is the first model in the course that says how fast something changes rather than what it is. The same equation, with different letters, describes thermal sensors, RC filters, tank draining, first-order robot joints and the first-order systems of next term's control unit.

Goals

Predict

A capacitor discharges with dV/dt = −V/τ, τ = 2 s, starting at 10 V. After 2 s, what is V closest to?

  1. 0 V
  2. 3.7 V
  3. 5 V
  4. 8 V

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the capacitor data. Turn on the log view: the points should lie on a straight line. Adjust k until the model line matches, then press Best fit. Read τ and the half-life. Why is ln(V) straight when V is curved?

What the interactive shows, in words

In the decay-fit lab the capacitor readings fall from 9 V towards zero. In the log view, ln V against time is a straight line whose slope is −k; the best fit gives k close to 0.45 per second, so τ ≈ 2.2 s and a half-life of about 1.5 s. The readout states k, τ, half-life and the RMS error.

Understand

Writing the equation

RC discharge: the current through R is V/R and it drains the capacitor: C·dV/dt = −V/R, so dV/dt = −V/(RC), τ = RC. Newton's cooling: heat flow is proportional to the temperature difference, so dT/dt = −k(T − Tₐ). Both: rate ∝ distance from equilibrium.

The time constant

τ (seconds or minutes) sets the speed. After 1τ, 37% of the initial difference remains; after 3τ, 5%; after 5τ, under 1%. Engineers call a first-order system 'settled' after about 4–5τ. For R = 10 kΩ and C = 100 µF, τ = 1 s.

Why the solution must be exponential

Only one family has a rate proportional to its value: e^(kt), from week 3's chain rule. So once you see 'rate ∝ amount', you can write the exponential solution straight away, then fit k (week 9). The equation also gives the units: k is per second, so kt has no units, as an exponent must.

Explain it another way: intuitive

Each second, the drink loses the same fraction of its 'extra' heat above room temperature. Losing a fixed fraction repeatedly is what exponential decay means.

Explain it another way: technical

Linear first-order ODE y′ + ky = 0. General first-order: τ·dy/dt + y = y_∞, solution y = y_∞ + (y₀ − y_∞)e^(−t/τ).

Explain it another way: mathematical

Uniqueness: if y and z both solve y′ = −ky with the same y(0), then d/dt[(y − z)e^(kt)] = 0, so y = z. The exponential is the only solution.

Explain it another way: applied

Temperature sensors in housings respond with a time constant of seconds to minutes. A controller that reads one too early sees a lagging value; engineers either wait 3–5τ or model the lag and correct for it.

Derivation: Solving dy/dt = −ky
  1. Model: the rate of decrease is proportional to the amount: dy/dt = −k·y, k > 0, with y(0) = y₀.

  2. Separate variables (for y > 0): (1/y) dy = −k dt.

  3. Integrate both sides: ln y = −kt + C.

  4. Exponentiate: y = e^C·e^(−kt). At t = 0, y = e^C = y₀, so y(t) = y₀·e^(−kt).

  5. Check by differentiating: dy/dt = y₀·(−k)·e^(−kt) = −k·y ✓.

  6. Time constant τ = 1/k: y(τ) = y₀e⁻¹ ≈ 0.368y₀. Half-life: e^(−kt) = ½ gives t½ = ln 2/k = τ·ln 2.

  7. Cooling: let u = T − Tₐ; then du/dt = dT/dt = −k·u, so T(t) = Tₐ + (T₀ − Tₐ)e^(−kt).

Try these examples

Example 1

R = 10 kΩ, C = 100 µF, V(0) = 9 V. Find τ and V at 2 s.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A cooling temperature difference halves every 12 minutes. What is its time constant τ, in minutes?

Answer: min

2. R = 10 kΩ, C = 100 µF, V(0) = 9 V. What is V at t = 2 s, in volts?

Answer: V

3. What percentage of the initial value remains after 5 time constants?

Answer: %

4. How can you check that T(t) = 20 + 70e^(−0.05t) solves dT/dt = −0.05(T − 20)?

  • Plot it and see that it curves
  • Differentiate: dT/dt = −3.5e^(−0.05t), and −0.05(T − 20) = −0.05 × 70e^(−0.05t) = −3.5e^(−0.05t) ✓
  • Substitute t = 0 only

5. A mug of tea at 75 °C cools in a 25 °C room as T(t) = Tₐ + (T₀ − Tₐ)·e^(−kt) with k = 0.02 per minute. What is its temperature after 20 minutes, in °C?

Answer: °C

Apply it

A greenhouse temperature sensor has τ = 40 s. The air jumps from 20 °C to 30 °C. What does the sensor read after 40 s, 2 minutes and 3 minutes? How long should the controller wait before trusting it to within 0.5 °C?

Reflect

Describe in words what dy/dt = −ky says about a system, without mentioning exponentials.

Go further (online)

Euler's method and step-size error

Most differential equations have no formula solution. So computers cheat: take the slope now, step forward a little, repeat. When does that cheating go badly wrong?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every physics engine, circuit simulator and robot simulator steps forward in time. Euler's method is the simplest stepper, and its two failure modes (slow convergence and outright instability) are the ones you must check for in any simulation you trust.

Goals

Predict

For dV/dt = −V/τ with τ = 2 s, you take Euler steps of h = 5 s. What happens?

  1. A slightly inaccurate decay
  2. The values flip sign and grow: the simulation explodes
  3. The answer is exact

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Start with τ = 2 and h = 0.5: read the error table and its ratio. Now try h = 1, 2, 2.5 and watch the regime change from smooth, to overshooting, to oscillating forever, to unstable. Change τ: does the boundary move with h/τ?

What the interactive shows, in words

The Euler lab plots the exact exponential decay with Euler's points. With τ = 2 and h = 0.5 the points track the curve slightly low and the error halves when h halves. At h = 3 they zigzag about zero while shrinking; at h = 4 they oscillate with constant size; at h = 5 they zigzag and grow. The readout names the regime from h/τ.

Understand

The method

Know the state yₙ at time tₙ. Compute the slope f(tₙ, yₙ) from the equation. Step: yₙ₊₁ = yₙ + h·f(tₙ, yₙ), tₙ₊₁ = tₙ + h. Repeat. That is all, and it is exactly how the week 4 forward difference is used in reverse.

Accuracy: first order

Euler's global error ∝ h. To get ten times more accurate, take ten times more steps. Check any simulation by halving h: if the answer changes noticeably, the step was too large. Better methods (such as Runge–Kutta) reach error ∝ h⁴ for a little more work per step.

Stability: a separate danger

Accuracy and stability are different. Too large a step can make a decaying system grow without limit. For dy/dt = −y/τ the limit is h < 2τ, and smooth results need h < τ. Fast processes (small τ) therefore force small steps even when you only care about slow ones.

Explain it another way: intuitive

Euler is driving with your eyes shut, opening them only every h seconds to check the road's direction. Short blinks keep you on the road; long ones put you in a ditch, or the other side of the road.

Explain it another way: technical

Forward Euler: yₙ₊₁ = yₙ + h·f(tₙ, yₙ). Local truncation error O(h²), global O(h). Region of absolute stability for y′ = λy: |1 + hλ| < 1.

Explain it another way: mathematical

yₙ = y₀(1 − kh)^(t/h) → y₀e^(−kt) as h → 0, because (1 − kh)^(1/h) → e^(−k): the same limit that defines e.

Explain it another way: applied

Real simulators choose step sizes adaptively: they estimate the error each step (by comparing two methods) and shrink h where things change fast, grow it where they are calm.

Derivation: Euler's step factor, its error and its stability limit
  1. For dy/dt = −k·y, one Euler step gives yₙ₊₁ = yₙ + h·(−k·yₙ) = (1 − kh)·yₙ.

  2. The exact solution multiplies by e^(−kh) = 1 − kh + (kh)²/2 − … each step. The difference per step is about (kh)²/2: the local error ∝ h².

  3. To reach a fixed time T takes T/h steps, so the errors add to about (T/h)·h² ∝ h: the global error is first order. Halve h, halve the error.

  4. After n steps yₙ = y₀(1 − kh)ⁿ. This decays only if |1 − kh| < 1, that is 0 < kh < 2, or h < 2τ.

  5. For 1 < kh < 2 the factor is negative: the numerical solution overshoots zero every step while shrinking. For kh > 2 it grows without bound: numerical instability, not physics.

Try these examples

Example 1

dV/dt = −V/2, V(0) = 5 V, h = 0.5 s. Take two Euler steps.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A falling object with linear drag obeys dv/dt = g − v/τ with g = 9.81 m/s², τ = 0.5 s and v(0) = 0. Take 5 Euler steps of h = 0.2 s. What is the Euler estimate of v, in m/s?

Answer: m/s

2. dV/dt = −V/τ with τ = 2 s and V(0) = 5 V. One Euler step of h = 0.5 s gives what V, in volts?

Answer: V

3. For dy/dt = −y/τ with τ = 2 s, what is the largest Euler step (in seconds) that does not blow up?

Answer: s

4. You halve Euler's step size (staying well inside the stable range). Roughly what happens to the error at a fixed time?

  • It halves
  • It quarters
  • It is unchanged

5. A falling object with linear drag obeys dv/dt = g − v/τ with g = 9.81 m/s², τ = 1 s and v(0) = 0. Take 4 Euler steps of h = 0.1 s. What is the Euler estimate of v, in m/s?

Answer: m/s

Apply it

Code Euler's method for dT/dt = −(T − 20)/8, T(0) = 90, up to t = 20. Run h = 4, 2, 1, 0.5 and tabulate T(20) against the exact value. Confirm the error halves, and find the step at which the solution first overshoots 20 °C.

Reflect

Explain the difference between an inaccurate simulation and an unstable one, with an example of each.

Falling with drag: terminal velocity

Drop a paper cone and it stops speeding up within a second. Gravity has not switched off. What is it fighting, and what speed does it settle at?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Parachutes, raindrops, sinking sensors, dropped parcels from drones and a robot arm moving through oil all approach a terminal speed. This lesson turns Newton's second law into a differential equation, the step every dynamics model in term 2 begins with.

Goals

Safety: Drop light paper objects from standing height only. Never climb on chairs or furniture to gain height.

Predict

With linear drag, you double the mass of a falling object (same shape). What happens to its terminal velocity?

  1. Unchanged
  2. Doubles
  3. Increases by √2
  4. Halves

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Set m = 0.2 kg and b = 0.1 kg/s. Read v_T and τ. Slide the time to τ, 2τ and 3τ: what fraction of v_T has it reached each time? Double the mass, then double b. Finally compare quadratic drag: same terminal speed, different approach.

What the interactive shows, in words

The drag lab plots speed against time: a dotted free-fall line v = gt, the linear-drag curve rising and flattening at the terminal velocity (a dashed horizontal line), and optionally a quadratic-drag curve with the same terminal speed that approaches it more sharply. For m = 0.2 kg and b = 0.1 kg/s, v_T = 19.6 m/s and τ = 2 s.

Understand

Same equation, new physics

Falling with linear drag is a first-order system approaching equilibrium v_T with time constant τ = m/b. After τ the object has reached 63% of v_T, after 3τ about 95%. For m = 0.2 kg and b = 0.1 kg/s: v_T = 19.6 m/s and τ = 2 s.

Linear or quadratic drag?

Drag ∝ v (linear) suits small, slow objects in thick fluids: dust, a sensor sinking in oil. Drag ∝ v² (quadratic) suits most everyday objects in air: a paper cone, a parachutist. Quadratic drag gives v = v_T·tanh(gt/v_T): the same start and end, but a sharper approach. Which you choose is an assumption to test against data.

Distance fallen

Integrate the velocity: x(t) = v_T·[t − τ(1 − e^(−t/τ))]. After a few τ the object falls almost exactly v_T metres each second, offset by v_T·τ: the distance 'lost' to the initial acceleration.

Explain it another way: intuitive

Gravity pulls steadily; drag pushes back harder the faster you go. Eventually drag matches gravity and the speed stops rising, like a car whose engine power is all spent fighting the wind.

Explain it another way: technical

m·v̇ = mg − bv. v_T = mg/b, τ = m/b, v = v_T(1 − e^(−t/τ)), a = g·e^(−t/τ). Quadratic: m·v̇ = mg − cv², v_T = √(mg/c).

Explain it another way: mathematical

The equation is linear with constant forcing, so its solution is equilibrium plus a decaying transient: v = v_T + (v₀ − v_T)e^(−t/τ). Every stable first-order linear system has this form.

Explain it another way: applied

Drone parcel drops and planetary landers use drag models to predict landing speed; engineers fit the drag coefficient from drop tests, which is your week 9 project idea.

Derivation: Solving m·dv/dt = mg − bv
  1. Free-body diagram (downwards positive): weight mg down, drag bv up. Newton's second law: m·dv/dt = mg − bv.

  2. Terminal velocity: when dv/dt = 0, v_T = mg/b.

  3. Rewrite: dv/dt = (mg − bv)/m = −(b/m)(v − v_T). Let τ = m/b and u = v − v_T.

  4. Then du/dt = −u/τ: exactly last lesson's decay equation, with u(0) = −v_T (dropped from rest).

  5. So u = −v_T·e^(−t/τ) and v(t) = v_T·(1 − e^(−t/τ)).

  6. Check: v(0) = 0; v → v_T as t → ∞; dv/dt at t = 0 is v_T/τ = g, free fall at the start, as it must be.

Try these examples

Example 1

m = 0.2 kg, b = 0.1 kg/s. When does it reach 95% of terminal velocity, and how fast is it then?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. An object of mass 0.05 kg is dropped from rest with linear drag b = 0.4 kg/s (g = 9.81 m/s²). Its speed is v(t) = v_T·(1 − e^(−t/τ)) with v_T = mg/b and τ = m/b. What is v at t = 3 s, in m/s?

Answer: m/s

2. m = 0.2 kg, linear drag b = 0.1 kg/s, g = 9.81 m/s². What is the terminal velocity, in m/s?

Answer: m/s

3. Same object (τ = m/b = 2 s). How long until it reaches 95% of v_T, in seconds?

Answer: s

4. With linear drag, what is the acceleration when the object is at half its terminal velocity, in m/s²? (g = 9.81 m/s².)

Answer: m/s²

5. A paper cone falls in air at a few m/s. Data show its speed approaches terminal velocity more sharply than the linear model predicts. What is the most sensible next step?

  • Increase g
  • Try a quadratic drag model and compare both with the data
  • Ignore the data

6. A falling object with linear drag obeys dv/dt = g − v/τ with g = 9.81 m/s², τ = 2 s and v(0) = 0. Take 3 Euler steps of h = 0.25 s. What is the Euler estimate of v, in m/s?

Answer: m/s

Apply it

Plan (do not perform at height) a safe drop test: a paper cone released from about 2 m, filmed with a phone beside a ruler. Which frames would you measure, how would you estimate v_T, and how would you decide between linear and quadratic drag?

Reflect

What does the time constant τ = m/b tell you physically about a falling object?

Week 9: Mathematical modelling investigation

This week you will

Fitting a cooling model to data

You have a column of temperatures from a cooling mug and one unknown number, k. How do you pull k out of noisy data, and how sure can you be?

About 45 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

A model is not finished until its parameter comes from data. Fitting k turns a textbook equation into a prediction for your mug, your sensor or your circuit, and the linearising trick here is used across engineering whenever a model is exponential.

Goals

Safety: Use warm tap water, not boiling water, and keep the cup on a stable table. A thermometer is all you need; never put electronics in liquid.

Predict

You plot ln(T − Tₐ) against time for cooling data. What should you see if Newton's law holds?

  1. A curve that flattens out
  2. A straight line with negative slope −k
  3. A horizontal line

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the mug of tea. Adjust k by eye until the curve runs through the points, and note your RMS error. Switch on the log view: are the points straight? Press Best fit and compare its k with yours. Which points scatter most in the log view, and why?

What the interactive shows, in words

The decay-fit lab shows synthetic cooling data: 16 readings from 86 °C towards a 21 °C room over 60 minutes. A model curve with the chosen k is drawn through them. In log view, ln(T − 21) against time is close to a straight line with slope −k; late points scatter more. The least-squares fit gives k close to 0.042 per minute.

Understand

Linearise, then fit a line

Subtract the room temperature, take natural logs, plot against t. The slope of the best straight line is −k, the intercept ln(T₀ − Tₐ). A least-squares line through all points uses every reading, so it is far less sensitive to one bad reading than a two-point estimate.

Two-point estimate

From readings at t₁ and t₂: k = ln[(T₁ − Tₐ)/(T₂ − Tₐ)]/(t₂ − t₁). Quick and useful as a sanity check, but it rests entirely on two noisy numbers. Example: 86 °C at 0 min and 63.7 °C at 10 min in a 21 °C room give k = ln(65/42.7)/10 ≈ 0.042 per minute.

What distorts the fit

Noise near Tₐ: when T − Tₐ is small, a 0.5 °C error is a large fraction, so late points scatter wildly in the log view. Weight them less or stop the fit early. Wrong Tₐ: guessing the room 2 °C too low makes the log plot curve. Early evaporation from a hot drink cools it faster at first than the model allows.

Explain it another way: intuitive

Fitting is turning a dial (k) until the model's curve lies as close as possible to all the dots at once. Taking logs turns the curve into a straight line, so the dial becomes a ruler's slope.

Explain it another way: technical

Least squares on yᵢ = ln(Tᵢ − Tₐ) against tᵢ: k̂ = −Σ(tᵢ − t̄)(yᵢ − ȳ)/Σ(tᵢ − t̄)². This minimises errors in log space, which overweights late, low readings compared with a direct nonlinear fit.

Explain it another way: mathematical

If each Tᵢ has error ε, the log has error ≈ ε/(Tᵢ − Tₐ): small near the start, large near the end. A weighted fit uses weights (Tᵢ − Tₐ)² to undo this.

Explain it another way: applied

Thermal engineers characterise a component's time constant exactly this way: heat it, log the cooling, fit k. That number then sets how long a sensor or a motor can be pushed before it overheats.

Try these examples

Example 1

Readings: 86 °C at t = 0, 63.7 °C at t = 10 min, room 21 °C. Estimate k and τ.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A mug reads 86 °C at t = 0 and 63.7 °C at t = 10 min in a 21 °C room. Estimate k in per minute (3 decimal places).

Answer: per min

2. With k = 0.042 per minute, what is the time constant τ, in minutes?

Answer: min

3. You assumed Tₐ = 18 °C but the room was really 22 °C. What will the ln(T − Tₐ) plot show?

  • A perfect straight line anyway
  • A curve that flattens at late times instead of a straight line
  • A line with positive slope

4. A mug of tea at 85 °C cools in a 20 °C room as T(t) = Tₐ + (T₀ − Tₐ)·e^(−kt) with k = 0.08 per minute. What is its temperature after 30 minutes, in °C?

Answer: °C

5. A quantity decays as e^(−t/τ) with τ = 5 s. How long until it falls to 5% of its start value, in seconds?

Answer: s

Apply it

If you can do so safely, log a cup of warm (not boiling) tap water cooling for 30 minutes with a kitchen thermometer, every 2 minutes, and note the room temperature. Fit k by both methods. If you cannot, use the lab's synthetic set and say so in your write-up.

Reflect

Why do the latest readings scatter most in the log view, and what would you do about it?

Validating a model and stating its limits

Your cooling model fits the first 30 minutes beautifully. Does it predict the next 30? The only honest way to find out is to keep some data back.

About 45 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

A model that is only checked on the data it was fitted to has not been tested at all. Validation, with honest limits, is what separates a model someone can rely on from a curve that happens to pass through some dots. It is also the core of your term project.

Goals

Predict

A model fitted to the first half of a data set has RMS error 0.4 °C on that half. On the held-out second half its error will most likely be…

  1. exactly 0.4 °C
  2. similar or somewhat larger
  3. always much smaller

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose the mug of tea and switch on 'Hold out the second half'. Press Best fit (it now uses the first half only). Compare the RMS errors on the fitting and held-out data. Then deliberately set k 20% too high: which error grows more, and why?

What the interactive shows, in words

With the hold-out option, the decay-fit lab fits k on the first eight cooling readings (filled dots) and tests it on the last eight (hollow dots). The readout gives the RMS error on both parts; with the best-fit k both are well under 1 °C. Setting k 20% too high makes the held-out error grow much more than the fitting error, because errors in k accumulate over time.

Understand

Verification and validation

Verification: does the code solve the equation correctly? Check against an exact solution and by halving the step (week 8). Validation: does the equation describe the real system? Check against data the model was not tuned on. A perfectly verified model of the wrong physics is still wrong.

Hold-out testing

Split the data before fitting: fit on one part, then predict the other. Report the error on the held-out part, with units: RMS = √(mean of squared residuals), or percentage error |model − data|/data. For time series, hold out the later part: that is what a prediction actually has to do.

Assumptions and their effects

Cooling model: well-mixed liquid (one temperature), constant room temperature, constant k (in fact convection and radiation make k vary with temperature), no evaporation (which speeds early cooling). Drag model: linear drag (often quadratic in air), still air. For each, say which way it pushes the prediction and when it matters.

Explain it another way: intuitive

Practising only the exam questions you have already seen tells you nothing about the real exam. Holding out data is keeping some questions back to test yourself honestly.

Explain it another way: technical

Report fit RMS, held-out RMS, and the residual pattern on the held-out set. A systematic held-out residual (all positive, growing) indicates a missing mechanism rather than noise.

Explain it another way: mathematical

RMS = √(Σrᵢ²/n). With one fitted parameter and n points, the fit RMS slightly underestimates the noise; dividing by n − 1 instead of n corrects for that.

Explain it another way: applied

Safety-critical models (aircraft loads, battery thermal runaway) are validated against tests that were planned before the model was tuned, and their reports list the conditions under which the model has not been validated.

Try these examples

Example 1

Held-out residuals are 1, −1, 2 and −2 °C. What is the RMS error?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Held-out residuals are 1, −1, 2 and −2 °C. What is the RMS error, in °C?

Answer: °C

2. The model predicts 50 °C where the held-out reading is 52 °C. What is the percentage error, relative to the reading?

Answer: %

3. You halve Euler's step and the simulated temperature barely changes. What have you shown?

  • The model is validated
  • The numerical solution is verified (converged), not that the model matches reality
  • The data are correct

4. On held-out data, a cooling model's residuals (data − model) are all positive and grow with time. Which explanation fits best?

  • Random sensor noise
  • A systematic mismatch, for example the room warming up or k falling as the drink cools
  • Too many data points

5. A mug of tea at 75 °C cools in a 25 °C room as T(t) = Tₐ + (T₀ − Tₐ)·e^(−kt) with k = 0.02 per minute. What is its temperature after 20 minutes, in °C?

Answer: °C

Apply it

Take your fitted k from the previous lesson. Predict the temperature 10 minutes beyond your last reading, then (if you collected data safely) measure it. Report the error and the one assumption most likely to explain it.

Reflect

What is the difference between verifying and validating a model, and which one did you find harder?

Your modelling investigation

Question, model, solve, fit, validate, report. Nine weeks of calculus in one investigation, run on a system you choose.

About 50 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

This is the term project in miniature: model and validate a cooling or falling system. The plan you write today is what makes the result trustworthy, because decisions made before seeing the data cannot be bent to fit it.

Goals

Safety: Only warm (not boiling) water for cooling experiments, and drops of light paper objects from standing height. Ask an adult before using anything hot.

Predict

Which should you decide before you look at the validation data?

  1. Nothing: decide everything at the end
  2. How you will split fit and test data and what error you will report
  3. Only the colours of your plots

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the Code Lab. Write three functions: exact(t) for your chosen model (cooling or linear-drag fall), euler(h, T) that steps the equation, and rms(model, data). Run Euler with h, h/2 and h/4 and print the error against exact(T): it should halve each time. Use the lab's synthetic data if you have none of your own.

What the interactive shows, in words

This lesson's activity is in the Code Lab: writing an exact solution, an Euler stepper and an RMS function, then printing a convergence table in which Euler's error halves each time the step halves. No diagram is needed to follow it.

Understand

The plan

Write it before collecting or opening data. Question: what will the model predict? Equation and every assumption. Parameter to fit (k or b) and its units. Data: what, how often, how accurate. Split: which readings fit, which test. Metric: RMS error in stated units. Success: what error would be good enough for the question.

The solution checks

Exact solution where it exists; Euler always; a convergence table (h, h/2, h/4) showing the Euler error halving. Agreement verifies your code. Then fit the parameter on the fit set with a log-linear fit, and predict the test set without changing anything.

The report

One page: the question; the model with assumptions; the fitted parameter with units and method; a validation plot with labelled axes; the held-out error; the residual pattern; limits, each with the direction of its effect. Say clearly whether the data are yours or synthetic. Keep code and parameters so anyone can regenerate every figure.

Explain it another way: intuitive

A good investigation is a story told in an order that cannot cheat: what I expected, how I checked, what happened, what I still do not know.

Explain it another way: technical

Pipeline: model → verification (exact vs numerical, convergence) → calibration (fit parameter on fit set) → validation (predict held-out set, report error) → limitations.

Explain it another way: mathematical

For Euler's first-order error, two runs give an error estimate without the exact solution: error(h/2) ≈ y(h/2) − y(h) (Richardson). Use it when no formula exists.

Explain it another way: applied

Engineering simulation reports follow this structure because reviewers, regulators and future colleagues need to know exactly how far the model can be trusted, and where it has never been tested.

Try these examples

Example 1

Euler gives T(20) = 40.0 °C with h = 1 and 40.5 °C with h = 0.5. Estimate the error of the h = 0.5 result without the exact solution.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Which order is right for a modelling investigation?

  • Fit, choose the model, decide the test split, report
  • Question and assumptions, choose split and metric, fit on fit set, test on held-out set, report limits
  • Collect data, try models until one fits, report the best

2. Euler gives 40.0 at h = 1 and 40.5 at h = 0.5. Using first-order behaviour, what is the estimated size of the error in the h = 0.5 result?

Answer:

3. You had no time to collect data and used the lab's synthetic cooling set. What must your report say?

  • Nothing, data are data
  • That the data are synthetic (a model plus noise), so the validation tests your method, not real physics
  • That the model is validated for real mugs

4. A tank's dye concentration obeys dy/dt = −0.5·y with y(0) = 100 mg/L. Take 3 Euler steps of h = 0.5 min. What is the Euler estimate of y after 1.5 min, in mg/L?

Answer: mg/L

5. An object of mass 0.2 kg is dropped from rest with linear drag b = 0.05 kg/s (g = 9.81 m/s²). Its speed is v(t) = v_T·(1 − e^(−t/τ)) with v_T = mg/b and τ = m/b. What is v at t = 2 s, in m/s?

Answer: m/s

Apply it

Write your one-page project plan now (question, equation, assumptions with expected effects, parameter, data source, split, metric, success threshold). Then carry out the term project: model and validate a cooling or falling system.

Reflect

Which of your assumptions do you expect to be the first to fail, and what would you see in the residuals if it did?

Beam bending: why depth beats width

A plank that sags under you when laid flat barely flexes when you stand it on its edge. Same wood, same weight. What changed?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Shelves, bridges, robot arms, aircraft spars and floor joists are all beams: long parts loaded across their length. They rarely fail by being pulled apart. They fail by bending: the top squeezes, the bottom stretches, and the outermost fibres reach their limit first. Knowing where that stress peaks, and how the shape of the cross-section controls it, is how engineers make parts both light and strong.

Goals

Predict

A 200 mm × 20 mm plank spans 1 m with a person standing in the middle. Turning it from flat to on-edge (20 mm wide, 200 mm deep) changes the maximum bending stress by roughly…

  1. Nothing: same area, same stress
  2. It halves
  3. It drops to about a tenth
  4. It drops to about a hundredth

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Start with the steel 40 × 80 mm beam. Press 'Turn the section on its side' and watch the stress double and the sag quadruple. Then find the smallest depth that keeps a 3,000 N load under 50 % of yield on a 3 m span.

What the interactive shows, in words

The beam explorer draws a beam resting on two supports with a downward load arrow at mid-span and a triangular bending-moment diagram below it, tallest under the load. Sliders set the load (100–5,000 N), span (0.5–4 m), width (10–100 mm) and depth (10–200 mm), and buttons choose steel, aluminium or timber. A readout gives I = bh³/12, the maximum stress Mc/I with its percentage of yield, and the mid-span sag PL³/(48EI). A button swaps width and depth: for the default 40 × 80 mm steel beam this doubles the stress from 17.6 to 35.2 MPa and quadruples the sag from 0.73 to 2.93 mm.

Understand

Moment first

Cut the beam anywhere and the two halves must still balance. For a simply supported span L with a single load P in the middle, each support pushes up P/2, and the bending moment grows linearly from zero at the supports to a peak of M = P·L/4 under the load. The moment diagram is a triangle, and the beam is most at risk where the triangle is tallest.

Stress across the section

Bending curves the beam. Fibres on the inside of the curve shorten (compression), fibres on the outside lengthen (tension), and one layer in between, the neutral axis, does neither. For a symmetric section it runs through the middle. Stress grows linearly with distance y from it: σ = M·y/I. The worst case is the outer fibre, y = c = h/2, so σ_max = M·c/I.

The second moment of area

I measures how far the material sits from the neutral axis, weighted by the distance squared. For a rectangle b wide and h deep, I = b·h³/12. Put that into σ = Mc/I and you get σ = 6M/(b·h²): depth appears squared for strength and cubed for stiffness. That is why floor joists stand on edge and why I-beams put most of their metal in flanges far from the middle.

How far does it sag?

For the same beam and load, the mid-span deflection is δ = P·L³/(48·E·I). E (Young's modulus) is the material's stiffness; I is the shape's. Doubling the span multiplies the sag by eight. Many beams are sized by deflection, not strength: a floor that bends 20 mm under a party may be perfectly safe and still feel terrible.

Explain it another way: intuitive

Bend a ruler flat and it flops; bend it on edge and it fights back. Bending squeezes one face and stretches the other, and material far from the middle does most of the fighting. Moving material away from the middle is the cheapest way to make a beam stronger.

Explain it another way: technical

Euler–Bernoulli beam theory assumes plane sections stay plane, small deflections and a linear-elastic material. Then strain varies linearly with y, so σ = E·ε = M·y/I with I = ∫y² dA, and curvature 1/R = M/(EI). Integrating curvature twice with the support conditions gives δ_max = PL³/(48EI) for a centre load.

Explain it another way: mathematical

With N and mm, stresses come out in N/mm² = MPa. Example: P = 1,500 N, L = 2,000 mm, b = 40 mm, h = 80 mm. M = 750,000 N·mm; I = 40 × 80³/12 ≈ 1,706,667 mm⁴; σ = 750,000 × 40 / 1,706,667 ≈ 17.6 MPa. For steel (E = 200,000 N/mm²) δ = 1,500 × 2,000³ / (48 × 200,000 × 1,706,667) ≈ 0.73 mm.

Explain it another way: applied

Robot arms use hollow tubes because a tube keeps its material far from the centre: a high I per kilogram. Aircraft wing spars, bicycle frames and steel I-beams follow the same rule. Timber joists are sized from span tables that are mostly deflection limits such as L/360.

Derivation: From plane sections to σ = My/I
  1. Assume cross-sections stay flat as the beam bends to radius R. A fibre at distance y from the neutral axis then has strain ε = y/R (it is on a circle of radius R + y instead of R).

  2. Linear-elastic material: σ = E·ε = E·y/R. Stress is zero at the neutral axis and grows linearly with y.

  3. No net axial force: ∫σ dA = (E/R)∫y dA = 0, so the neutral axis passes through the centroid of the section.

  4. The stresses add up to the bending moment: M = ∫σ·y dA = (E/R)∫y² dA = E·I/R, where I = ∫y² dA.

  5. Combine σ = E·y/R with E/R = M/I to get σ = M·y/I. For a rectangle, I = ∫ from −h/2 to h/2 of b·y² dy = b·h³/12.

Try these examples

Example 1

A steel beam 40 mm wide and 80 mm deep spans 2 m with 1,500 N at the centre. Find σ_max and the sag. Then turn it on its side.

The worked solution is in the online lesson.

Example 2

The 200 × 20 mm plank from the prediction spans 1 m with an 800 N person at mid-span. Compare flat and on edge.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. In a simply supported beam with a centre load, where is the bending stress biggest?

  • At the supports, on the neutral axis
  • Under the load, at the top and bottom surfaces
  • Under the load, on the neutral axis
  • Evenly spread along the whole beam

2. A simply supported rectangular beam spans 2.6 m and carries a single 800 N load at mid-span. Its cross-section is 15 mm wide and 30 mm deep (load acting on the deep side). Ignoring its own weight, what is the maximum bending stress, in MPa?

Answer: MPa

3. You double the depth h of a rectangular beam and keep everything else the same. By what factor does the maximum bending stress change? (Give the multiplier, e.g. 0.5)

Answer:

4. A aluminium alloy beam (E = 70 GPa), simply supported over 3.3 m, has a rectangular section 60 mm wide and 75 mm deep. A 2100 N load sits at mid-span. Using δ = PL³/(48EI), how far does the middle sag, in mm?

Answer: mm

5. A robot-arm designer swaps a solid round bar for a hollow tube of the same mass but larger diameter. What happens?

  • It gets weaker: there is a hole in it
  • It gets stiffer and stronger in bending
  • Nothing: same mass means same strength
  • It only gets stiffer in tension

Apply it

Design a 1.2 m shelf from 18 mm plywood (assume E = 8 GPa and an allowable bending stress of 10 MPa) to hold 300 N of books placed in the middle. Choose the shelf depth (front to back, the b in your formulas), check the stress and sag, then decide whether a 30 mm deep wooden lip glued under the front edge would help more than a thicker board. Show your numbers.

Reflect

Where in something you use every day (a desk, a bike, a phone case) has a designer moved material away from the neutral axis? What would happen if they hadn't?

Buckling: when a column bows instead of crushing

Press down on a strand of dry spaghetti and it snaps sideways long before the pasta itself is crushed. Why does a long, thin column fail by bending when you only pushed along it?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Columns, truss members, robot legs, drone landing struts and the thin walls of drinks cans all carry compression. A stocky part fails when the material crushes, but a slender one fails at a much lower load by suddenly bowing sideways. Buckling is sudden and gives little warning, so engineers check it separately from stress.

Goals

Predict

You halve the length of a pinned steel strut and keep its diameter. Its buckling load becomes…

  1. Half as big
  2. The same
  3. Twice as big
  4. Four times as big

Write down your guess and your reason. The reveal is in the online lesson.

Discover

With the 20 mm, 1.5 m strut pinned at both ends, note the Euler load. Switch through the four end conditions and watch the mode shape and load change. Then shorten the strut until crushing, not buckling, governs: what slenderness KL/r does that happen at?

What the interactive shows, in words

The column explorer shows a vertical strut with its buckled shape drawn as a curve for the chosen end condition: a half sine wave when pinned at both ends, a quarter wave leaning to one side when fixed at the base and free at the top, a full S-shaped wave when fixed at both ends, and an asymmetric bow when fixed–pinned. Buttons choose the end condition; sliders set the diameter (4–60 mm) and length (0.2–4 m) of a solid steel bar. A readout lists the Euler load, the squash load (yield stress × area), the slenderness KL/r and which one governs. The default 20 mm, 1.5 m pinned strut buckles at 6.89 kN against a 78.5 kN squash load.

Understand

A stability failure

A perfectly straight column under a central load can stay straight. Nudge it sideways and two things compete: the load's moment (P × sideways deflection) tries to bend it further, while its bending stiffness EI tries to straighten it. Below the critical load stiffness wins and it springs back. Above it the load wins and the column bows out, even though the compressive stress may be far below yield.

Euler's formula

For an ideal elastic strut pinned at both ends, P_cr = π²EI/L². Strength (yield stress) does not appear at all: only stiffness E, shape I and length. Doubling the length quarters the load. For a solid round bar I = πd⁴/64, so the diameter counts to the fourth power: a bar 2 mm thicker can be much safer.

Ends matter: effective length

Other end conditions are handled with an effective length KL: the length of the equivalent pinned column. Pinned–pinned K = 1; fixed at the base and free at the top (a flagpole) K = 2, the worst; fixed–fixed K = 0.5; fixed–pinned K ≈ 0.7. Bolting both ends firmly makes a strut four times stronger against buckling than pinning them.

Buckle or crush?

Divide P_cr by the area to get the buckling stress σ_cr = π²E/(KL/r)², where r = √(I/A) is the radius of gyration (d/4 for a solid round bar) and KL/r is the slenderness. A column fails at whichever is lower: σ_cr or the yield stress. For steel with E = 200 GPa and yield 250 MPa they cross at KL/r ≈ 89. Above that, buckling governs.

Explain it another way: intuitive

A long thin ruler pushed end-on bends out sideways easily; a short thick block does not. Once it starts to bow, the push acts with a lever arm and makes the bow worse. Buckling is that runaway.

Explain it another way: technical

Euler's analysis solves EI·y″ + P·y = 0 with y = 0 at both pinned ends. Non-zero solutions exist only when √(P/EI)·L = nπ, so the lowest critical load is P_cr = π²EI/L² and the shape is a half sine wave. Real columns have initial crookedness and load offsets, so they deflect progressively and fail below P_cr; design codes use curves that blend Euler buckling with yielding.

Explain it another way: mathematical

20 mm solid steel rod, 1.5 m, pinned: I = π × 20⁴/64 ≈ 7,854 mm⁴, P_cr = π² × 200,000 × 7,854/1,500² ≈ 6,890 N ≈ 6.89 kN. Squash load = 250 × π × 10² ≈ 78.5 kN. Slenderness KL/r = 1,500/5 = 300, far above 89, so it buckles at under a tenth of the squash load.

Explain it another way: applied

Truss bridges and cranes use heavier sections for compression members than for tension members of the same force. Drone and lander legs use tubes (high I per mass) with bracing that cuts the effective length. Thin-walled cans and rocket tanks also buckle locally, which is why some rocket tanks are pressurised for stiffness.

Derivation: Euler's critical load for a pinned strut
  1. Take a pinned–pinned column of length L under axial load P, bowed sideways by a small y(x). At position x the load has a lever arm y, so the bending moment is M = −P·y.

  2. Small-deflection bending: E·I·y″ = M = −P·y, so y″ + k²·y = 0 with k² = P/(EI).

  3. General solution: y = A·sin(kx) + B·cos(kx). The pin at x = 0 forces y = 0, so B = 0.

  4. The pin at x = L needs A·sin(kL) = 0. A = 0 is the straight column; a bowed shape needs sin(kL) = 0, so kL = π, 2π, …

  5. The smallest load uses kL = π: P/(EI) = π²/L², so P_cr = π²EI/L², with a half-sine buckled shape. Other end conditions give π²EI/(KL)².

Try these examples

Example 1

A 20 mm solid steel rod is 1.5 m long. Find its buckling load pinned–pinned, then fixed–free and fixed–fixed.

The worked solution is in the online lesson.

Example 2

At what slenderness does a steel column (E = 200 GPa, yield 250 MPa) switch from crushing to buckling in the Euler model?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Which end condition gives the LOWEST buckling load for the same strut?

  • Pinned at both ends
  • Fixed at both ends
  • Fixed at the base, free at the top
  • Fixed at one end, pinned at the other

2. A solid round structural steel strut (E = 200 GPa) is 14 mm in diameter and 0.9 m long, fixed at one end and pinned at the other (effective length factor K = 0.7). What is its Euler critical buckling load, in kN?

Answer: kN

3. You increase a solid round strut's diameter by 20 % and keep its length and ends. By what factor does its Euler buckling load increase? (2 decimal places)

Answer:

4. Two identical slender struts are made of a mild steel and a high-strength steel (same E, double the yield stress). Which buckles at the higher load?

  • The high-strength steel, at double the load
  • They buckle at about the same load
  • The mild steel, because it is softer
  • Neither can buckle: steel is too strong

5. What is the slenderness KL/r of a 30 mm solid round bar, 1.8 m long, fixed at both ends? (r = d/4 for a solid circle)

Answer:

Apply it

A rover's camera mast is a 1.2 m aluminium tube (E = 70 GPa), fixed at the base and free at the top, carrying a 40 N camera head. Choose an outer diameter and wall thickness so the Euler load is at least 5 times the weight (I for a tube = π(D⁴ − d⁴)/64). Then show how much lighter it can be if a guy wire turns the top into a pinned end.

Reflect

Why do you think buckling failures often surprise people more than overload failures? What does that suggest about how to test a design?

Fatigue: failure by a million small pushes

A paperclip survives one bend easily, yet snaps after twenty. Nothing pushed harder the twentieth time. So what broke it?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Most mechanical parts that break in service break by fatigue: axles, crankshafts, bike frames, aircraft skins, robot joints that flex millions of times. Each load is safe on its own, but repeated loads grow a tiny crack from a scratch, hole or sharp corner until what is left suddenly fails. Fatigue is why aircraft are inspected on a schedule and why designers fear sharp corners.

Goals

Predict

A steel shaft is cycled at a stress amplitude well below its yield stress. Then a small sharp groove is cut into it. What happens to its fatigue life?

  1. No change: the groove removes almost no material
  2. It can drop a lot, because the groove multiplies the local stress
  3. It gets longer, because the groove relieves stress
  4. Fatigue only depends on the material, not the shape

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Set a nominal stress of 150 MPa and K_t = 1: the steel-like part never fails, the aluminium-like part does. Now raise K_t to 2. Use the cycles slider to see how Miner's damage sum grows towards 1.

What the interactive shows, in words

The S–N explorer plots stress amplitude (50–600 MPa) against cycles to failure (10³ to 10⁹) on log–log axes. A solid steel-like line falls from 450 MPa at 10³ cycles to 250 MPa at 10⁶ and then stays flat (the endurance limit). A dashed aluminium-like line falls from 280 MPa at 10³ to 120 MPa at 10⁷ and keeps falling. A slider sets the nominal stress amplitude (60–400 MPa) and buttons set the stress-concentration factor (1, 1.5, 2 or 3); a dotted line marks the resulting peak stress. A second slider sets the number of cycles (100,000 to 5,000,000), and the readout gives the predicted life of each part and the Miner's rule damage sum. At 150 MPa with K_t = 2, the steel-like part lasts about 117,000 cycles.

Understand

Cracks grow one cycle at a time

Under repeated loading, tiny slips at the most stressed spot start a microscopic crack, usually at the surface, a scratch, a hole or a sharp corner. Each cycle opens and closes it and it grows a little. The part looks fine until the remaining cross-section is too small and it breaks suddenly. Fatigue fractures often show smooth 'beach marks' where the crack grew, and a rough zone where it finally let go.

S–N curves on log axes

Testing many samples at different stress amplitudes S gives the number of cycles to failure N. Plotted on log–log axes, the data scatter around a roughly straight line in the middle region: a small drop in stress buys a big increase in life. Many steels flatten out at an endurance limit (very roughly half the tensile strength for smooth samples): below it, failure is not expected. Aluminium alloys have no true endurance limit and keep weakening.

Stress concentrations

Holes, keyways, threads and sharp internal corners make the local stress higher than the nominal value: σ_peak = K_t × σ_nominal. A round hole in a wide plate in tension has K_t ≈ 3. Because S–N curves are steep, K_t matters far more for fatigue than for a single static load. Generous fillet radii, polished surfaces and moving holes away from high-stress regions are fatigue design.

Miner's rule for mixed loads

Real parts see a mix of stress levels. Miner's rule says each block of nᵢ cycles at a level whose life is Nᵢ uses up a fraction nᵢ/Nᵢ of the part's life, and failure is predicted when D = Σ nᵢ/Nᵢ = 1. It ignores the order of the loads and fatigue scatter is large, so designers aim for D well below 1.

Explain it another way: intuitive

Fatigue is like a rope fraying one strand at a time. Each pull is fine, but each one breaks a strand, and eventually the last strands go at once.

Explain it another way: technical

High-cycle fatigue is usually modelled with a Basquin relation, S = A·N^b (b ≈ −0.05 to −0.12), which is a straight line on log–log axes, plus corrections for mean stress (Goodman), surface finish, size and reliability. Linear damage accumulation (Palmgren–Miner) sums cycle fractions; rainflow counting turns an irregular load history into blocks.

Explain it another way: mathematical

Illustrative steel-like line through (10³, 450 MPa) and (10⁶, 250 MPa): log N = 3 + 3·log(450/S)/log(450/250). At 300 MPa, log N ≈ 5.07, N ≈ 117,000 cycles. Miner example: 20,000 cycles at a level with N = 50,000 and 300,000 cycles at a level with N = 1,000,000 give D = 0.4 + 0.3 = 0.7.

Explain it another way: applied

Aircraft are designed 'safe-life' or 'damage-tolerant': assume a crack exists, predict its growth, and inspect before it can become critical. Robot joints and wind-turbine blades are tested for millions of cycles. Car makers shot-peen springs and polish crankshaft fillets to delay crack initiation.

Try these examples

Example 1

A steel-like part (illustrative curve through 10³ cycles at 450 MPa and 10⁶ at 250 MPa, endurance limit 250 MPa) sees 150 MPa nominal. A hole with K_t = 2 is drilled in the most stressed spot. Estimate its life before and after.

The worked solution is in the online lesson.

Example 2

A bracket sees 20,000 cycles at a level where it would last 50,000, and 300,000 cycles at a level where it would last 1,000,000. Use Miner's rule.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Can a part fail by fatigue if every load cycle keeps the stress below the yield stress?

  • No: below yield nothing is damaged
  • Yes: repeated stress below yield can grow a crack until the part breaks
  • Only if the part is made of aluminium
  • Only if the load is applied quickly

2. A simplified S–N curve for a part is a straight line on log–log axes through (10³ cycles, 350 MPa) and (10⁶ cycles, 160 MPa). At a stress amplitude of 200 MPa, what is log₁₀ of the predicted number of cycles to failure? (2 decimal places)

Answer:

3. A bracket sees three stress levels. At level A it would last 40,000 cycles and sees 6,000; at level B it would last 600,000 and sees 80,000; at level C it would last 6,000,000 and sees 400,000. What is the Miner's rule damage sum D? (3 decimal places)

Answer:

4. A plate with a round hole (K_t = 3) carries a nominal stress amplitude of 60 MPa. What is the peak stress amplitude at the edge of the hole, in MPa?

Answer: MPa

5. A robot leg bracket keeps cracking at a sharp inside corner after a few weeks of walking. Which change is most likely to help?

  • Make the corner even sharper so it looks neater
  • Add a generous fillet radius and smooth the surface at the corner
  • Paint it to hide the cracks
  • Use a stronger material with the same sharp corner and change nothing else

Apply it

Pick a part that flexes repeatedly in a machine you know (a door hinge, a bike pedal crank, a robot gripper finger). Estimate how many cycles it sees in a year, sketch where the stress concentrations are, and propose two changes that would extend its fatigue life. Explain each with K_t or the S–N curve.

Reflect

Fatigue failures are sudden even though the crack grew slowly. How would you design an inspection plan for a part you can't make fatigue-proof?