TactivergeOffline

Level 4 Engineering Complex Systems · Term 4: Engineering Optimization

Making systems better and proving it: distributions, standard errors, confidence intervals and propagated uncertainty; constrained, linear and multi-objective optimisation; time–memory–accuracy and power–performance–area trade-offs; power, mass, data and Δv budgets for a conceptual Mars mission; hardware–software integration; fair benchmarking; and the technical manuscript that carries it all.

In this file: 26 lessons across weeks 28–36, with 113 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 28: Statistical reasoning

This week you will

Distributions, spread and the one weird run

Nineteen runs take about 48 ms. One takes 110 ms. Is your code slow, or is your summary lying to you?

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

Why it matters

Every optimisation claim in this term rests on numbers that wobble. Before you can say a design is better, you need to say what 'typical' and 'how much it varies' mean for your data, and notice when one strange point is steering the whole story.

Goals

Predict

One run in twenty jumps from about 48 ms to 110 ms. Which summary moves most?

  1. The median
  2. The mean
  3. Both move by the same amount
  4. Neither: one point out of twenty can't matter

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

Discover

Drag the orange run from 49 ms to 120 ms. Watch the mean line, the median line and the SD. Find the value where the run first gets flagged (|z| > 3), then compare 'Keep all' with 'Exclude and report'.

What the interactive shows, in words

The interactive shows 19 run times clustered around 48 ms with an SD near 3 ms, plus one run you move from 40 to 120 ms. Moving it to 110 ms raises the mean by about 3 ms, raises the SD several-fold, leaves the median almost unchanged, and gives a z-score far above 3, so the run is flagged. Choosing 'Exclude and report' recomputes the summaries without it and reminds you to report the exclusion.

Understand

Centre: mean or median?

The mean uses every value, so it is efficient for well-behaved data and sensitive to extremes. The median is the middle of the sorted list: robust to a few wild values, but it throws information away. For timings, which often have a long right tail (occasional slow runs from caches, interrupts or garbage collection), report both, or report the median with the interquartile range.

Spread: variance and standard deviation

Sample variance s² = Σ(xᵢ − x̄)² / (n − 1); the standard deviation s is its square root and has the data's units. Dividing by n − 1 rather than n corrects a bias: deviations are measured from x̄, which was fitted to the same data, so they come out slightly too small. With n = 5 the correction is 25%; with n = 100 it is 1%.

Shape matters

Two data sets can share a mean and SD yet look completely different: one symmetric bell, one skewed with a long tail, one with two humps (perhaps two machines mixed together). Always plot the data (dot plot or histogram) before trusting a summary. A bimodal timing histogram usually means two different code paths, not noise.

Outliers: flag, investigate, report

A z-score z = (x − x̄)/s counts standard deviations from the mean; |z| > 3 is a common flag for roughly normal data. A flag is a question, not a verdict. Was the laptop throttling? Did a backup start? If you exclude a point, say so, give the rule you set before looking, and show the result both ways. Silently deleting inconvenient data is falsification.

Explain it another way: intuitive

The mean is a see-saw's balance point: one heavy child far out tips it a long way. The median is the person in the middle of a queue: one late arrival at the back doesn't change who is in the middle.

Explain it another way: technical

Mean x̄ = Σxᵢ/n; median = middle order statistic; s = √(Σ(xᵢ − x̄)²/(n − 1)). The mean's breakdown point is 0 (one value can move it arbitrarily); the median's is 50%. Robust spread: IQR = Q3 − Q1, or the median absolute deviation.

Explain it another way: mathematical

Why n − 1: E[Σ(xᵢ − x̄)²] = (n − 1)σ², because Σ(xᵢ − x̄)² = Σ(xᵢ − μ)² − n(x̄ − μ)² and E[(x̄ − μ)²] = σ²/n. So dividing by n − 1 gives an unbiased estimate of σ².

Explain it another way: applied

Performance engineers often quote p50 (median) and p99 latency, not the mean: users feel the slow tail. Web services are tuned to cut the 99th percentile, because one slow request in a hundred is a lot of unhappy people per second.

Try these examples

Example 1

Runs (ms): 47, 49, 48, 50, 46. Find the mean and sample SD.

The worked solution is in the online lesson.

Example 2

Add a sixth run of 70 ms. What happens to the mean, the median and the z-score of 70 measured against the first five?

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. Your benchmark times have a long right tail from occasional background tasks. Which centre is least affected by those rare slow runs?

  • Mean
  • Median
  • Maximum
  • Range

2. Five timing runs (ms): 33, 28, 28, 33, 34. What is the sample standard deviation s (divide by n − 1)? (3 decimal places.)

Answer: ms

3. Past runs of a benchmark have mean 67 ms and standard deviation 4 ms. A new run takes 74.6 ms. What is its z-score? (2 decimal places; negative if it is below the mean.)

Answer:

4. A run is flagged with z = 4.2. What is the most defensible action?

  • Delete it: it is obviously wrong
  • Investigate the cause, apply a rule fixed in advance, and report results with and without it
  • Keep it but don't mention it
  • Re-run until the outlier goes away, then report only the new runs

5. Why does the sample standard deviation divide by n − 1?

  • To make the answer bigger so it looks more cautious
  • Because deviations from the sample mean are slightly too small on average, and n − 1 corrects that bias
  • Because one data point is always an outlier
  • It is a convention with no reason

Apply it

Time any small program of yours 20 times. Plot a dot plot, compute mean, median and SD, and flag anything with |z| > 3. Write two sentences on what caused the spread and which summary you would quote.

Reflect

Think of a number you have seen quoted as an average (a commute, a battery life, a download speed). Would the median tell a different story?

How sure is your average? The standard error

Ten runs give a mean of 48.3 ms. Ten more give 47.6 ms. Which mean is right, and how far would a third batch wander?

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

Why it matters

Engineers rarely care about one run; they care about the true average behaviour of a design. The standard error tells you how precisely your sample pins that down, and therefore how many runs you need before a claimed 2% improvement means anything.

Goals

Predict

You quadruple the number of runs from 10 to 40. What happens to the standard error of the mean?

  1. It quarters
  2. It halves
  3. It stays the same
  4. It doubles

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

Discover

Set σ = 4 and n = 4, then n = 16, then n = 64. Watch the dots (each experiment's mean) huddle closer to the true mean of 50. Read the standard error in the readout each time and check it halves.

What the interactive shows, in words

The interactive draws 20 experiments, each the mean of n random readings around a true value of 50, and shows each mean as a dot with an interval. With σ = 4 the standard error is 2 for n = 4, 1 for n = 16 and 0.5 for n = 64: the dots cluster twice as tightly each time n is quadrupled.

Understand

Two different spreads

The standard deviation s describes individual measurements: how much one run differs from another. It does not shrink as you collect more data; it settles towards the true σ. The standard error SE = s/√n describes the mean: how much the average would differ if you repeated the whole experiment. It shrinks as n grows.

The sampling distribution

Imagine running your 10-run experiment thousands of times and plotting each mean. That histogram is the sampling distribution of the mean. Its centre is the true mean μ and its standard deviation is σ/√n. You never see it directly, but the standard error estimates its width from a single experiment.

Why it is close to normal

The central limit theorem says the mean of many independent random contributions tends towards a normal distribution, whatever the shape of each contribution (as long as its variance is finite). For moderate n (often 20–30 or more, fewer for symmetric data) the sampling distribution of the mean is close to normal. This is what justifies the normal approximation used throughout this term.

Precision costs effort

Because SE ∝ 1/√n, each halving of uncertainty needs four times the data. Decide the precision you need before collecting data. If σ ≈ 3 ms and you need to resolve a 1 ms difference, a quick calculation tells you whether 10 runs could ever be enough (they can't).

Explain it another way: intuitive

One person's height tells you little about a town's average height. Average 100 people and you're close. Average 10,000 and you're very close, but not 100 times closer: only 10 times.

Explain it another way: technical

For independent, identically distributed xᵢ with variance σ²: Var(x̄) = σ²/n, so SD(x̄) = σ/√n. Estimate with SE = s/√n. Independence matters: correlated runs (thermal drift, caching) make the true SE larger than s/√n suggests.

Explain it another way: mathematical

Var(Σxᵢ) = Σ Var(xᵢ) = nσ² for independent xᵢ. Then Var(x̄) = Var(Σxᵢ)/n² = σ²/n. Taking the square root: σ/√n.

Explain it another way: applied

Chip makers characterise a new design over many dies and many runs; quoting the clock speed or power to two decimal places is only honest when the standard error supports two decimal places.

Try these examples

Example 1

s = 3.2 ms from n = 16 runs. Find the SE. How many runs would make the SE 0.4 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. Twenty-five runs have sample SD s = 5 ms. What is the standard error of the mean, in ms?

Answer: ms

2. As you collect more and more runs, what happens to the sample SD and to the SE?

  • Both shrink towards zero
  • The SD settles near σ; the SE shrinks towards zero
  • The SD shrinks; the SE stays the same
  • Both grow

3. A sensor's readings have standard deviation σ ≈ 4 units. How many repeated readings n do you need so that the 95% confidence interval for the mean has a half-width of at most 1.5 units? Use z = 1.96 and round n up to a whole number.

Answer: readings

4. Your laptop slowly heats up during a benchmark, so later runs are systematically slower. What does this do to s/√n as an estimate of the mean's uncertainty?

  • Nothing: the formula always works
  • It makes s/√n misleading, because the runs are not independent
  • It makes the mean more precise
  • It only affects the median

5. You repeat a measurement n = 64 times. The sample standard deviation is s = 2.5 °C. Using the normal approximation (z = 1.96 for 95%), what is the half-width of the 95% confidence interval for the mean, in °C? (3 significant figures.)

Answer: °C

Apply it

Take the 20 timings from the previous lesson. Compute the SE using the first 5 runs, the first 10 and all 20. Plot SE against n on log–log axes and check the slope is about −½.

Reflect

Why might a team that only ever runs a benchmark three times keep 'discovering' improvements that later vanish?

Is the difference real? Effect sizes and correlation

Greenhouse readings rise with the heater power, and also with the sunshine. Which one is warming the plants?

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

Why it matters

Optimisation means changing a design and claiming it got better. The claim needs a size, an uncertainty, and a reason to believe your change caused it rather than something that changed at the same time.

Goals

Predict

Design B's mean is 2 ms faster than A's. The SE of each mean is 1.5 ms. Is the difference convincing?

  1. Yes, B is clearly faster
  2. Not yet: the SE of the difference is about 2.1 ms, as big as the difference itself
  3. No: 2 ms is too small to ever matter

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

Discover

Do Level 2: find the glitch and the clean mean from the noisy readings, then use the heat balance. As you go, note which quantities you measured and which you inferred from a model.

What the interactive shows, in words

In the greenhouse Build, Level 2 gives ten noisy thermometer readings, one of which is a glitch, and asks for the clean mean and predictions from the heat balance Q = UA·(T − T_out). The lesson's point: separate what you measured from what you inferred, and attach an uncertainty to each comparison.

Understand

The difference and its uncertainty

For independent conditions A and B, the difference of means d = x̄_B − x̄_A has standard error SE_d = √(SE_A² + SE_B²). A rough 95% interval is d ± 1.96·SE_d. If that interval comfortably excludes zero, the data support a real difference; if it straddles zero, you can't tell the sign yet.

Effect size: how big, not just whether

Cohen's d = (x̄_B − x̄_A)/s_pooled expresses the difference in units of run-to-run spread. d ≈ 0.2 is small, 0.8 large. With enough data even a trivially small effect becomes 'significant'; the effect size tells you whether anyone should care. Engineers usually prefer the raw difference in real units (ms, W, mm) plus its interval.

Correlation is a number, not a mechanism

Pearson's r runs from −1 to +1 and measures how well a straight line describes the relationship. r = 0.9 between heater power and temperature does not prove the heater warms the greenhouse: sunshine might raise both (the controller turns the heater down when it's sunny, which could even make r negative). Correlation also misses curved relationships entirely.

Control the confounders

A confounder affects both the thing you change and the thing you measure. Defeat it by design: change one variable at a time, randomise or interleave the order of conditions, and run both conditions under the same environment. In simulation you can hold the weather fixed exactly, which is one reason engineers simulate before field trials.

Explain it another way: intuitive

Ice-cream sales and sunburn rise together. Ice cream doesn't burn you: sunny days drive both.

Explain it another way: technical

Welch's approach: SE_d = √(s_A²/n_A + s_B²/n_B). Pearson r = cov(x, y)/(s_x·s_y). r² is the fraction of variance in y explained by a linear fit on x.

Explain it another way: mathematical

For independent X and Y, Var(X − Y) = Var(X) + Var(Y), the same rule that will appear as uncertainty propagation next week. Covariance is the expected product of deviations: cov(x, y) = Σ(xᵢ − x̄)(yᵢ − ȳ)/(n − 1).

Explain it another way: applied

Clinical trials randomise patients so that unknown confounders are spread evenly across treatment and control. A/B tests on software do the same by randomly assigning users to versions.

Try these examples

Example 1

A: mean 40.0 ms, SE 0.6. B: mean 38.2 ms, SE 0.8. Give the difference with a 95% interval.

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. SE_A = 0.3 W and SE_B = 0.4 W for two independent conditions. What is the SE of the difference of means, in W?

Answer: W

2. A team tests firmware v2 on Monday morning and v1 on Friday afternoon, when the lab is warmer. v2 uses less power. What is the main problem?

  • The sample is too large
  • Temperature is a confounder: it changed along with the firmware
  • Power can't be measured accurately
  • Nothing: the result is clear

3. Across 50 rover drives, wheel slip and battery drain have r = 0.85. What can you conclude?

  • Slip causes battery drain
  • They have a strong linear association; a cause still has to be shown
  • Battery drain causes slip
  • r = 0.85 means 85% of drain is due to slip

4. After warm-up, the baseline takes a mean of 24 ms per run and the optimised version 10 ms (same machine, same input, interleaved runs). What is the speed-up, baseline time ÷ new time? (3 significant figures.)

Answer: ×

Apply it

Find a claimed improvement in a product review or a project of your own. Write down: the difference, its uncertainty (or why it's missing), one possible confounder, and how you'd redesign the test.

Reflect

Which confounders could creep into a benchmark you run on your own computer?

Week 29: Experimental uncertainty

This week you will

What a 95% confidence interval really promises

Your interval is 47.2 to 49.0 ms. Is there a 95% chance the true mean is in there?

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

Why it matters

An interval is the most honest way to report a measured quantity: it says what you know and how well. This lesson builds the interval, then tests what '95%' means by running thousands of experiments in the browser.

Goals

Predict

You draw 20 experiments and build a 95% interval from each. How many intervals will miss the true mean?

  1. None: 95% intervals are reliable
  2. About 1, but it could easily be 0, 2 or 3
  3. Exactly 1, every time
  4. About 5

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

Discover

Keep 95% and n = 30. Press 'Draw 20 more experiments' ten times and watch the running tally approach 95%. Then set n = 3 and reset: the tally falls short. Finally switch to 99% and watch the bars lengthen.

What the interactive shows, in words

The simulator draws 20 experiments of n readings from a normal distribution with true mean 50 and builds a confidence interval from each, drawn as a horizontal bar. Bars that miss the true mean are marked 'miss'. Over many batches, about 95% of 95% intervals contain 50 when n is 30; with n = 3 coverage drops to roughly 80%, because z = 1.96 is too small when σ is estimated from so few points.

Understand

The recipe
  1. Compute x̄ and s from n independent measurements. 2. SE = s/√n. 3. Half-width h = z·SE. 4. Report x̄ ± h with the confidence level, n and the method. Example: 48.1 ± 0.9 ms (95% CI, n = 30, normal approximation).
The correct interpretation

If you repeated the whole experiment many times, about 95% of the intervals built this way would contain the true mean. Once your interval is computed, μ either is in it or isn't; you just don't know which. Saying 'there is a 95% probability μ lies between 47.2 and 49.0' is a common shortcut, but strictly it is a different (Bayesian) statement.

When the approximation breaks

The z-interval assumes independent data, a roughly normal sampling distribution and enough data to trust s. It under-covers for small n (use t), for strongly skewed data with small n (use more data, a transformation, or the bootstrap), and badly for correlated data such as drifting benchmarks. Systematic error is never captured: a mis-calibrated timer shifts every interval.

Width, level and effort

Higher confidence widens the interval (99% is about 31% wider than 95%). Quadrupling n halves it. Choose the level before you look at the data, and plan n from the half-width you need: n ≈ (z·σ/h)².

Explain it another way: intuitive

Throwing a hoop at a hidden peg: the method lands the hoop over the peg 95 times out of 100. After one throw you can't see whether this hoop caught it.

Explain it another way: technical

Normal-approximation (Wald) CI for a mean: x̄ ± z_{1−α/2}·s/√n. Exact for known σ and normal data; asymptotically correct otherwise. The t-interval replaces z with t_{n−1, 1−α/2}.

Explain it another way: mathematical

Coverage probability = P(μ ∈ [x̄ − z·s/√n, x̄ + z·s/√n]). With σ known it is exactly 1 − α. With s it is P(|T| ≤ z) where T ~ t_{n−1}, which is below 1 − α; for n = 3 and z = 1.96 it is about 81%.

Explain it another way: applied

Spacecraft navigation teams quote 'error ellipses' for a probe's predicted position: multi-dimensional confidence regions that decide whether a trajectory correction manoeuvre is needed.

Derivation: Building the interval from the sampling distribution
  1. For large n, the sample mean is approximately normal: x̄ ~ N(μ, σ²/n).

  2. Standardise: Z = (x̄ − μ)/(σ/√n) ~ N(0, 1). For a standard normal, P(−1.96 ≤ Z ≤ 1.96) = 0.95.

  3. Substitute: P(−1.96 ≤ (x̄ − μ)/(σ/√n) ≤ 1.96) = 0.95.

  4. Rearrange the inequality for μ: P(x̄ − 1.96·σ/√n ≤ μ ≤ x̄ + 1.96·σ/√n) = 0.95. The random quantity is x̄, so this is a statement about the interval, not about μ.

  5. σ is unknown, so replace it with s. For small n this extra uncertainty matters: use Student's t value (for example t = 2.26 instead of 1.96 when n = 10) or the interval will be too narrow.

  6. Result (normal approximation): x̄ ± z·s/√n, with z = 1.645 (90%), 1.96 (95%) or 2.576 (99%).

Try these examples

Example 1

n = 36 runs, x̄ = 52.4 ms, s = 4.8 ms. Give the 95% CI.

The worked solution is in the online lesson.

Example 2

How many runs would give a half-width of 0.5 ms with the same 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. You repeat a measurement n = 49 times. The sample standard deviation is s = 0.8 W. Using the normal approximation (z = 1.96 for 95%), what is the half-width of the 95% confidence interval for the mean, in W? (3 significant figures.)

Answer: W

2. Which statement correctly interprets a 95% confidence interval?

  • 95% of the data lie inside it
  • If the experiment were repeated many times, about 95% of intervals built this way would contain the true mean
  • The true mean changes 5% of the time
  • There is a 95% chance the next measurement will fall inside it

3. A sensor's readings have standard deviation σ ≈ 4 units. How many repeated readings n do you need so that the 95% confidence interval for the mean has a half-width of at most 1.5 units? Use z = 1.96 and round n up to a whole number.

Answer: readings

4. With n = 4 runs, you build x̄ ± 1.96·s/√n. What is the main risk?

  • The interval is too wide
  • The interval is too narrow: with so few runs s is unreliable, and the t value (3.18) should replace 1.96
  • There is no risk
  • The mean will be biased

5. x̄ = 20.0 °C, s = 1.0 °C, n = 25. What is the half-width of the 99% interval (z = 2.576), in °C?

Answer: °C

Apply it

For your own 20 timings, build 90%, 95% and 99% intervals. Then build the 95% interval from the first 5 runs only, with z and with t (2.78 for n = 5). Which intervals overlap?

Reflect

Why does the simulator need many batches before the tally settles near 95%? What does that tell you about judging a method from one result?

Propagating uncertainty through a calculation

Voltage ± 2%, current ± 3%. Is the power ± 5%, ± 1%, or something else?

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

Why it matters

Engineers rarely measure the quantity they care about directly. Power comes from V and I; efficiency from two powers; speed-up from two times. Propagation tells you how the uncertainty of each input flows into the answer, and which input to improve first.

Goals

Predict

P = V·I with V uncertain by 2% and I by 3% (independent). What is the uncertainty in P?

  1. 5%
  2. About 3.6%
  3. 3%
  4. 1%

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

Discover

Start with A × B. Compare the formula's uncertainty with the Monte Carlo spread. Then switch to A ÷ B, set B = 2 and push δB up past 0.3: when does the formula stop agreeing with the simulation, and which way is the histogram skewed?

What the interactive shows, in words

The calculator takes A ± δA and B ± δB and an operation. It shows the formula result, the propagated uncertainty, and a histogram of 4,000 simulated results with dashed lines at ±1 formula uncertainty. For A × B with small uncertainties the histogram's spread matches the formula. For A ÷ B with B = 2 ± 0.4, the histogram becomes skewed to the right and its spread exceeds the formula by more than 10%, showing where the linear approximation fails.

Understand

Sums and differences: absolute, in quadrature

For q = a ± b with independent uncertainties: δq = √(δa² + δb²). The bigger uncertainty dominates: √(5² + 1²) = 5.1, so shrinking the small one achieves almost nothing. Subtracting two nearly equal measurements is dangerous: the result is small but its absolute uncertainty is not, so its relative uncertainty explodes.

Products and quotients: relative, in quadrature

For q = a·b or a/b: δq/q = √((δa/a)² + (δb/b)²). Work in percentages, combine, then convert back. Energy E = V·I·t with V ± 2%, I ± 3% and t exact: δE/E = √(4 + 9)% ≈ 3.6%. A squared quantity doubles its relative uncertainty: kinetic energy ½mv² with v ± 1% is uncertain by at least 2%.

Independence is an assumption

Quadrature assumes the errors are independent. If V and I are read through the same miscalibrated ADC reference, their errors are correlated and partly add linearly. Systematic errors from one shared source should be propagated together, not as separate independent terms.

The error budget

List each input's contribution to the final variance: for a product, (δa/a)², (δb/b)², ... Rank them. Improve the largest first. Engineers call this an uncertainty budget, and it is the same idea as a power or mass budget: account for everything, then spend effort where it buys the most.

Explain it another way: intuitive

Two dice: each can be off by a bit. Their errors sometimes cancel and sometimes add, so on average the total is off by more than either but less than both together. Quadrature is the averaging rule for that.

Explain it another way: technical

General law (GUM, first order, uncorrelated inputs): u_c²(q) = Σ (∂f/∂xᵢ)²·u²(xᵢ). Correlated inputs add 2·(∂f/∂xᵢ)(∂f/∂xⱼ)·u(xᵢ, xⱼ) terms.

Explain it another way: mathematical

For q = x/y: ∂q/∂x = 1/y, ∂q/∂y = −x/y². σ_q² = σ_x²/y² + x²σ_y²/y⁴. Dividing by q² = x²/y² gives (σ_q/q)² = (σ_x/x)² + (σ_y/y)².

Explain it another way: applied

Calibration laboratories publish an uncertainty budget for every certificate: each source (reference standard, temperature, resolution, repeatability) with its contribution, combined in quadrature, then expanded by a coverage factor of about 2.

Derivation: First-order propagation from the tangent line
  1. Let q = f(x, y) with small independent errors δx, δy around the measured values.

  2. Linearise with partial derivatives (the tangent plane): Δq ≈ (∂f/∂x)·Δx + (∂f/∂y)·Δy.

  3. For independent errors the variances add: σ_q² ≈ (∂f/∂x)²·σ_x² + (∂f/∂y)²·σ_y². Cross terms vanish because E[ΔxΔy] = 0.

  4. Sum q = x + y: both partials are 1, so σ_q = √(σ_x² + σ_y²). The same for x − y: (−1)² = 1, so uncertainties never cancel.

  5. Product q = x·y: ∂q/∂x = y and ∂q/∂y = x. Divide σ_q² = y²σ_x² + x²σ_y² by q² = x²y²: (σ_q/q)² = (σ_x/x)² + (σ_y/y)².

  6. Quotient q = x/y gives the same relative rule. Power q = xⁿ gives σ_q/q = |n|·σ_x/x.

  7. The rule is first order: it fails when the function curves noticeably across ±σ (for example dividing by a quantity uncertain by more than about 10%). Then use Monte Carlo.

Try these examples

Example 1

Efficiency η = P_out/P_in with P_out = 42.0 ± 0.6 W and P_in = 50.0 ± 0.5 W. Find η and its uncertainty.

The worked solution is in the online lesson.

Example 2

A mass difference: 152.3 ± 0.4 g − 151.8 ± 0.4 g. What is the result and its relative uncertainty?

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. Two independent masses are measured: A = 346 ± 6 g and B = 40 ± 9 g (standard uncertainties). What is the standard uncertainty of A − B, in grams? (2 decimal places.)

Answer: g

2. A test rig logs voltage V = 3.3 V (± 3%) and current I = 0.5 A (± 2%) for exactly t = 3600 s, so energy E = V·I·t. Treating the two uncertainties as independent and t as exact, what is the absolute standard uncertainty of E, in joules? (3 significant figures.)

Answer: J

3. A power estimate P = V·I has V ± 0.5% and I ± 4%. To halve the uncertainty in P, what should you improve?

  • The voltmeter
  • The current measurement
  • Both equally
  • Neither: the uncertainty can't be reduced

4. Kinetic energy ½mv² with m exact and v uncertain by 1.5%. What is the relative uncertainty in the energy, in %?

Answer: %

5. Why is subtracting two nearly equal measured values risky?

  • Subtraction is less accurate than addition
  • The absolute uncertainties add in quadrature but the result is small, so the relative uncertainty becomes huge
  • The uncertainties cancel, giving false confidence
  • It isn't risky

Apply it

Pick a formula from an earlier term (Ohm's law power, a gear ratio speed, a heat-balance estimate). Assign realistic uncertainties to each input, build the uncertainty budget table, and say which measurement you would improve first.

Reflect

When would you trust the quadrature formula, and when would you reach for Monte Carlo instead?

Monte Carlo: propagate by simulation

Your model has six uncertain inputs and a square root, an exponential and an if-statement. Is there a formula for its uncertainty? You don't need one.

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

Why it matters

Real engineering models are messy: thresholds, lookup tables, simulations that take seconds. Monte Carlo treats the model as a black box: sample the inputs, run, collect outputs, and read the uncertainty straight off the histogram. It is how mission designers estimate landing ellipses and how this school's simulators can quantify their own uncertainty.

Goals

Predict

A Monte Carlo estimate of a standard deviation uses N = 1,000 samples. How many samples would halve its sampling noise?

  1. 2,000
  2. 4,000
  3. 10,000
  4. 1,000,000

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

Discover

In the Code Lab, write a function that samples V ~ N(12, 0.24²) and I ~ N(1.5, 0.06²), computes P = V·I one hundred thousand times with a fixed seed, and prints the mean and SD of P. Compare with the quadrature formula. Then replace P with a model that has a threshold (for example, a heater that switches on below 16 °C) and see the histogram the formula can't predict.

What the interactive shows, in words

In the Code Lab, the learner writes a loop that draws random V and I from normal distributions, multiplies them, and prints the mean and standard deviation of the products. For V = 12 ± 0.24 V and I = 1.5 ± 0.06 A the formula gives P = 18 W ± about 0.80 W, and the simulation agrees closely. A model with a threshold produces a lopsided, two-humped histogram that no single ± number describes well.

Understand

The algorithm
  1. Describe each uncertain input with a distribution (normal with its standard uncertainty is the default; uniform for a resolution limit). 2. Draw one value of every input. 3. Run the model. 4. Repeat N times. 5. Summarise the outputs: mean, SD, percentiles (the 2.5th and 97.5th give a 95% interval without assuming normality).
How big should N be?

The Monte Carlo estimate of a mean has standard error s_out/√N; estimates of an SD or of tail percentiles need more samples than estimates of a mean. A practical check: run with two different seeds. If the results differ in a digit you intend to report, increase N. For a 95% interval from percentiles, N ≥ 10,000 is a sensible start.

Correlated inputs

If two inputs share a cause (the same reference voltage, the same temperature), sample that shared cause once per trial and derive both from it. Sampling them independently would understate or overstate the output's uncertainty. This is far easier to get right in Monte Carlo than in a formula.

Reproducible randomness

Use a seeded pseudo-random generator and record the seed, the distributions, their parameters and N. Then anyone can regenerate your histogram exactly. Every simulator and practice generator on this site is seeded for exactly this reason: the server can recompute your result from the seed to check it.

Explain it another way: intuitive

Instead of solving how wobbly the answer is, build a thousand slightly different worlds where each input is a bit off, run them all, and look at how much the answers disagree.

Explain it another way: technical

Monte Carlo propagation (GUM Supplement 1): sample x⁽ᵏ⁾ ~ p(x), compute q⁽ᵏ⁾ = f(x⁽ᵏ⁾), estimate the distribution of q empirically. Convergence O(N^−½), independent of dimension.

Explain it another way: mathematical

By the law of large numbers the sample mean of q⁽ᵏ⁾ converges to E[q]; by the central limit theorem its error is approximately N(0, Var(q)/N). The same applies to any expectation, including P(q > threshold).

Explain it another way: applied

Mars landing teams run thousands of simulated entries with varied atmosphere density, wind and parachute performance to draw the landing ellipse, and choose a landing site whose ellipse avoids hazards.

Try these examples

Example 1

A Monte Carlo run gives SD(P) = 0.92 W with N = 1,000, and 0.89 W with a different seed. You want to report SD to two significant figures. Is N enough?

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. When is Monte Carlo clearly preferable to the quadrature formula?

  • When all inputs have tiny uncertainties and the model is a simple product
  • When the model has thresholds or strong curvature, or inputs are correlated
  • Never: formulas are always more accurate
  • Only when you have no computer

2. A Monte Carlo mean has standard error 0.08 with N = 2,500 samples. How many samples give a standard error of 0.02?

Answer: samples

3. Which detail is essential so that someone else can reproduce your Monte Carlo result exactly?

  • The colour of the histogram
  • The random seed, the input distributions and N
  • How long it took to run
  • The name of your laptop

4. A test rig logs voltage V = 9 V (± 3%) and current I = 1.5 A (± 5%) for exactly t = 120 s, so energy E = V·I·t. Treating the two uncertainties as independent and t as exact, what is the absolute standard uncertainty of E, in joules? (3 significant figures.)

Answer: J

Apply it

Monte Carlo the rover's two-hour drive energy from the planetary-rover Build (motor power 100 ± 8 W, camera 20 ± 2 W, duration 2.0 ± 0.1 h). Report the mean, SD and a 95% percentile interval with your seed and N.

Reflect

What inputs to a model you have built in this course were treated as exact but are really uncertain?

Week 30: Optimization under constraints

This week you will

Formulate first: variables, objectives, constraints and Pareto fronts

The lightest arm draws the most power; the frugal one is heaviest. Is there a 'best' arm at all?

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

Why it matters

Most optimisation failures are formulation failures: the wrong objective, a forgotten constraint, or a single number hiding a trade-off. Writing the problem down precisely is where engineering judgement goes; the search is the easy part.

Goals

Predict

Eight arm designs compete on mass and power, lower is better for both. At most how many can be 'non-dominated'?

  1. Exactly one: the best
  2. Two: the lightest and the most frugal
  3. Any number from one up to all eight
  4. None

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

Discover

With 'Mass vs power', mark the designs you think are on the front and check. Then lower the mass limit to 5 kg: which designs drop out, and does the front change? Finally slide the weight from 0 to 1 and list the designs the weighted sum picks along the way.

What the interactive shows, in words

Eight hypothetical arm designs A to H are plotted by two objectives. On mass versus power the non-dominated designs are those for which no other design is both lighter and lower-power. Lowering the mass limit greys out heavier designs and can change the front. A weight slider shows the weighted-sum choice moving between front designs as the weight changes, never onto a dominated design.

Understand

The three parts of a formulation

Decision variables: what you are free to choose (arm length, motor size, gain). Objective: one number to minimise or maximise (mass, energy, cost, error). Constraints: limits that every acceptable design must satisfy, written as inequalities or equalities (torque ≥ 2 N·m, mass ≤ 5 kg). Together: minimise f(x) subject to gᵢ(x) ≤ 0. The set of x that satisfies all constraints is the feasible region.

Hard constraints screen; objectives rank

A requirement that must be met (fits the launch envelope, survives −80 °C) is a constraint: designs that break it are out, however good they look otherwise. Things you would like more or less of are objectives. Screening first keeps a brilliant-but-illegal design from distorting your comparison.

Dominance and the Pareto front

Design A dominates B if A is no worse on every objective and strictly better on at least one. The non-dominated designs form the Pareto front: along it, improving one objective must cost another. Everything behind the front is simply worse and can be discarded without any value judgement.

Collapsing to one number

A weighted sum w·f₁ + (1 − w)·f₂ (on normalised objectives) always selects a front design, but which one depends on w, and the weights are a value judgement that should be stated and defended. Weighted sums can also miss designs in a concave part of the front; showing the whole front to decision-makers is often more honest.

Explain it another way: intuitive

Buying a bike: light, cheap, strong. A bike that is heavier, dearer and weaker than another is out. The rest is a genuine choice about what you value.

Explain it another way: technical

Multi-objective problem: minimise (f₁(x), …, f_k(x)) subject to x ∈ X. x* is Pareto-optimal if no feasible x has fᵢ(x) ≤ fᵢ(x*) for all i with strict inequality for some i. Scalarisation by weights or by ε-constraints (minimise f₁ subject to f₂ ≤ ε) traces the front.

Explain it another way: applied

Spacecraft trade studies routinely plot candidate designs on mass-versus-power or cost-versus-risk charts; the front is shown to a review board, which then chooses with mission priorities in mind.

Try these examples

Example 1

Designs (mass kg, power W): P (3, 60), Q (4, 40), R (5, 45), S (6, 30). Which are on the front?

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 arm must lift a 2 kg sample' and 'the arm should be as light as possible'. Which is a constraint and which an objective?

  • Both are objectives
  • Lifting 2 kg is a constraint; lightness is the objective
  • Lightness is a constraint; lifting is the objective
  • Both are constraints

2. Six rover-arm designs, where LOWER cost and LOWER mass are both better: A (£30, 5.5 kg); B (£40, 1.5 kg); C (£100, 6 kg); D (£20, 6 kg); E (£20, 2.5 kg); F (£30, 5.5 kg). How many designs are non-dominated (on the Pareto front)?

Answer: designs

3. Design X costs £900 and weighs 4.2 kg. Design Y costs £1,100 and weighs 4.8 kg. Lower is better for both. What can you say?

  • Y dominates X
  • X dominates Y
  • Neither dominates
  • They are on the same front

4. A report picks design E 'by weighted sum' without stating the weights. What's the problem?

  • None: weighted sums are objective
  • The choice depends entirely on the weights, which are a value judgement the reader can't check
  • Weighted sums always pick dominated designs
  • E must be wrong

Apply it

Write a one-page formulation for optimising the greenhouse heater: decision variables, objective, at least three constraints (comfort, switching, energy) with numbers, and which objective you'd trade against energy on a Pareto chart.

Reflect

Think of a decision you made recently with two competing goals. What was your front, and what weights did you implicitly use?

Linear programming: why the corners win

A workshop has 24 machining hours and 30 assembly hours. Among infinitely many weekly plans, you only need to check four. Why?

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

Why it matters

Linear programmes schedule airlines, blend fuels and allocate cloud servers. With two variables you can see the whole thing, and the picture explains the idea every large solver relies on.

Goals

Predict

You maximise 3x + 5y over a polygon-shaped feasible region. Where can the maximum be?

  1. Anywhere inside
  2. At the centre of the polygon
  3. At a corner (or along a whole edge if the objective is parallel to it)
  4. Only at the origin

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

Discover

Read the corner table and find the best corner. Move your trial plan (the square) to a point inside the region and compare its profit. Then raise the profit per chassis until the best corner jumps, and add machining hours to see how much one extra hour is worth.

What the interactive shows, in words

The explorer shows the feasible region for 2x + y ≤ M (machining) and x + 3y ≤ A (assembly) with x, y ≥ 0, as a shaded polygon. A table lists each corner and its profit c₁x + c₂y; the largest is marked best. With M = 24, A = 30, c₁ = 3 and c₂ = 5 the corners are (0, 0), (12, 0), (0, 10) and (8.4, 7.2), and the optimum is 61.20 at (8.4, 7.2). Adding one machining hour raises it to about 62.00.

Understand

Drawing the region

Turn each inequality into its boundary line (2x + y = 24 meets the axes at (12, 0) and (0, 24)), then shade the side that satisfies it (test the origin: 0 ≤ 24, so the origin's side). Non-negativity keeps you in the first quadrant. The overlap of all shaded regions is feasible.

Binding and slack constraints

At the optimum, a constraint that holds with equality is binding: that resource is fully used. One with spare capacity has slack. In the example both machining and assembly bind at (8.4, 7.2). A non-binding constraint could be loosened without changing the answer at all.

Sensitivity: what's an extra hour worth?

Raise machining from 24 to 25 hours and re-solve: the optimum rises by the shadow price of machining. In the explorer it is about £0.80 per hour. If an extra hour costs less than its shadow price, buy it. Changes to the objective coefficients can make the best corner jump to a neighbour: the plan is stable only within a range of prices.

Beyond two variables

Real problems have thousands of variables, but the theorem still holds: optima sit at vertices of a high-dimensional polytope. The simplex method walks from vertex to better neighbouring vertex; interior-point methods cut through the middle. If the variables must be whole numbers (integer programming) the corner can be fractional, and the problem becomes much harder.

Explain it another way: intuitive

Imagine a ruler laid across the region at a slant set by the profits. Push it as far as it will go while still touching the region: it will last touch a corner.

Explain it another way: technical

Standard form: maximise cᵀx subject to Ax ≤ b, x ≥ 0. Feasible set is a convex polyhedron; if bounded and non-empty, an optimal basic feasible solution (vertex) exists. Dual variables give shadow prices.

Explain it another way: mathematical

Any feasible point is a convex combination of vertices: x = Σλᵢvᵢ with λᵢ ≥ 0, Σλᵢ = 1. Then cᵀx = Σλᵢ cᵀvᵢ ≤ maxᵢ cᵀvᵢ. So the maximum over the polygon equals the maximum over its vertices.

Explain it another way: applied

Power-grid operators solve linear programmes every few minutes to decide which generators to run at what output, meeting demand at least cost while respecting line limits.

Derivation: The corner-point theorem in two dimensions
  1. Maximise z = c₁x + c₂y subject to linear inequalities. Each inequality is a half-plane; their intersection is a convex polygon (the feasible region).

  2. The level sets z = k are parallel straight lines with normal vector (c₁, c₂). Increasing k slides the line in the direction (c₁, c₂).

  3. Suppose an optimum were at an interior point. A small step in direction (c₁, c₂) stays feasible and increases z, a contradiction. So the optimum is on the boundary.

  4. On an edge, z varies linearly along the edge, so it is largest at one of the edge's two endpoints (or constant, if the edge is parallel to the level lines).

  5. Therefore some vertex is optimal. Algorithm: find every vertex (intersect pairs of constraint lines, keep the feasible ones), evaluate z at each, take the largest.

  6. Example: 2x + y ≤ 24, x + 3y ≤ 30, x, y ≥ 0. Crossing: from the first y = 24 − 2x; substitute: x + 72 − 6x = 30, x = 8.4, y = 7.2. Corners (0, 0), (12, 0), (0, 10), (8.4, 7.2). With z = 3x + 5y: 0, 36, 50, 61.2. The optimum is £61.20 at (8.4, 7.2).

Try these examples

Example 1

Maximise 4x + 3y subject to x + y ≤ 10, 2x + y ≤ 16, x, y ≥ 0.

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. Corners of a feasible region are (0, 0), (12, 0), (0, 10) and (8.4, 7.2). What is the maximum of 3x + 5y?

Answer:

2. A small factory makes x controllers and y sensor boards a day. Assembly time: 2x + 1y ≤ 18 hours. Test time: 1x + 4y ≤ 36 hours. Also x ≥ 0, y ≥ 0 (fractions allowed). Profit is 8x + 9y pounds. What is the maximum profit, in pounds? (2 decimal places.)

Answer: £

3. A small factory makes x controllers and y sensor boards a day. Assembly time: 3x + 1y ≤ 36 hours. Test time: 1x + 3y ≤ 36 hours. Also x ≥ 0, y ≥ 0 (fractions allowed). Profit is 5x + 3y pounds. What is the maximum profit, in pounds? (2 decimal places.)

Answer: £

4. At the optimum, the assembly constraint has 6 hours of slack. What happens to the optimum if you buy 4 more assembly hours?

  • It rises
  • Nothing: assembly isn't the limiting resource
  • It falls
  • The problem becomes infeasible

5. The LP optimum is 8.4 frames and 7.2 chassis, but you can only build whole items. What is true?

  • Round to (8, 7): that is guaranteed optimal
  • The best whole-number plan must be found separately; rounding may be sub-optimal or even infeasible
  • Fractional plans are always fine
  • The LP was wrong

Apply it

A rover's science day: x hours of driving (needs 60 W) and y hours of imaging (needs 25 W). Energy ≤ 300 Wh, x + y ≤ 8 h, x ≤ 4 h. Science value 2x + 3y. Draw the region, find the corners and the optimum, and say which constraint you'd relax first.

Reflect

Where in daily life do you face a linear trade-off with a hard limit? Where is your corner?

Searching a design landscape: grids, gradients and local minima

Rolling downhill finds a valley fast. But is it the deepest valley?

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

Why it matters

When a cost comes from a simulation, there is no formula to differentiate and no corners to check. You search. How you search decides whether you find a great design in minutes, a mediocre one, or nothing before the deadline.

Goals

Predict

A grid search uses 20 values per parameter. How many simulations for a design with 4 parameters?

  1. 80
  2. 400
  3. 8,000
  4. 160,000

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

Discover

Gradient descent from x₀ = 1: where does it end? Move x₀ to 5. Now try η = 4 and watch it overshoot. Switch to grid search: what is the smallest k that finds the global valley near 7.4, and how many evaluations does it cost?

What the interactive shows, in words

The explorer plots an illustrative cost against one design parameter x from 0 to 10, with a local valley near x = 2.3 (cost about 1.52), a ridge near 3.8, and the deepest valley near 7.4 (cost about 0.61). Gradient descent from x₀ = 1 ends in the shallow valley; from x₀ = 5 it reaches the deep one; with a learning rate above about 3 it overshoots. Grid search with k points evaluates the cost k times and finds the deep valley once the spacing is fine enough.

Understand

Grid search: thorough and expensive

Evaluate the cost on a regular grid and keep the best. It needs no derivatives, handles noisy or discontinuous costs, and with fine enough spacing can't miss a wide valley. But its cost is k^d evaluations, and its resolution is the grid spacing: the true optimum can sit between grid points. Use it for one to three parameters, or as a coarse first look.

Gradient descent: fast and local

Step against the slope: x ← x − η·f′(x). Near a minimum the slope shrinks, so steps shrink. Each step needs the gradient, which you can estimate with finite differences (two evaluations per parameter). It scales to many parameters, but it only ever goes downhill, so it settles in whichever valley it starts in.

The learning rate

η sets the step size. Too small and progress is painfully slow. Too large and the step jumps over the valley floor, bouncing or diverging. For f = a(x − b)², steps converge only if η < 1/a. In practice engineers try a few η values, or shrink η when the cost stops falling.

Guarding against local minima

A local minimum beats its neighbours but not the whole landscape. Defences: a coarse grid to find promising regions, then gradient descent to polish (a hybrid); several random restarts; or global methods (simulated annealing, genetic algorithms) that sometimes accept uphill moves. Always report the method and its limits: 'best found', not 'optimal'.

Explain it another way: intuitive

Lost in fog on a hillside, you feel which way the ground slopes and step downhill. You'll reach a valley, but maybe not the lowest one in the region.

Explain it another way: technical

Gradient descent x_{k+1} = x_k − η∇f(x_k). Converges linearly for smooth, strongly convex f with suitable η; only to a stationary point otherwise. Grid search cost O(k^d); finite-difference gradients cost O(d) per step.

Explain it another way: mathematical

For f(x) = a(x − b)²: x_{k+1} − b = (1 − 2aη)(x_k − b). The error shrinks each step if |1 − 2aη| < 1, i.e. 0 < η < 1/a. At η = 1/(2a) one step lands exactly on the minimum.

Explain it another way: applied

Antenna designers often start with a coarse parameter sweep in an electromagnetic simulator, then hand the best few candidates to a local optimiser to fine-tune the geometry.

Try these examples

Example 1

f(x) = 2(x − 3)², x₀ = 7, η = 0.1. Take two 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. The energy cost of a design is f(x) = 2·(x − 2)². Starting from x₀ = 4 with learning rate η = 0.25, take one gradient-descent step x₁ = x₀ − η·f′(x₀). What is x₁? (3 decimal places.)

Answer:

2. You grid-search a design with 4 parameters, trying 5 values of each. One simulation takes 0.01 s. How long does the full grid take, in seconds?

Answer: s

3. Gradient descent's cost goes up and down and then grows each step. What is the most likely cause?

  • The learning rate is too small
  • The learning rate is too large, so steps overshoot the minimum
  • There is no minimum
  • Gradient descent always does this

4. Gradient descent from three random starts gives costs 1.52, 0.61 and 1.52. What should you report?

  • The average, 1.22
  • The best found, 0.61, and that two of three starts reached a worse local minimum
  • 1.52, because it occurred most often
  • That the method failed

5. RK4 has global error roughly proportional to h^4. With step h = 0.1 s the error is 2.4 mm. Estimate the error with step h = 0.025 s, in mm. (4 significant figures.) The run will take about 4× as long.

Answer: mm

Apply it

In the greenhouse Build Level 4, treat (setpoint, Kp) as design variables and energy as the cost subject to the comfort constraint. Do a 5 × 5 grid, then refine around the best point by hand-stepping downhill. Report evaluations used and best found.

Reflect

When would you choose a slow, thorough search over a fast, local one?

Week 31: Computational and power–performance–area trade-offs

This week you will

Time, memory, accuracy: pick your trade

Halve the step size and the answer gets better. Halve it again and it gets slower. When do you stop?

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

Why it matters

A rover's flight computer has a fraction of a phone's speed and memory. Every model it runs is a deliberate compromise between how right, how fast and how small. Engineers make those compromises with numbers, not hunches.

Goals

Predict

Euler's method has error roughly proportional to the step h. To make the error 10× smaller, how much more computation?

  1. About 10×
  2. About 100×
  3. About 3×
  4. No extra cost

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

Discover

In the Code Lab, integrate dv/dt = −k·v (k = 0.5, v₀ = 10) to t = 4 s with Euler's method at h = 0.4, 0.2, 0.1, 0.05. Print the error against the exact 10·e^(−2) and the number of steps. Then repeat with values stored as integers scaled by 256 (Q8 fixed point) and compare the error floor.

What the interactive shows, in words

In the Code Lab the learner integrates exponential decay with Euler's method at four step sizes and prints the error and step count: each halving of h roughly halves the error and doubles the steps. Storing values in Q8 fixed point adds an error floor of a few thousandths that does not shrink with h.

Understand

Order of accuracy

A method of order p has global error ≈ C·h^p. Halving h divides the error by 2^p and doubles the work. Plot error against h on log–log axes: the slope is p, which is a powerful check that your code is correct. Below some h, rounding error in each step starts to accumulate and the curve turns back up.

Growth rates

An O(n) algorithm on a million items does about a million operations; O(n log n) about twenty million; O(n²) a trillion. For small n, a simple O(n²) method may be faster and far easier to verify. Choose by the sizes you actually face, measured, and by the cost of getting it wrong.

Memory as a resource

Storing results can save time (a lookup table replaces a slow sin(x)) at the cost of memory, and the table's spacing sets its accuracy. A microcontroller with 32 KB of RAM can't hold a 64 K-entry table, so you interpolate a smaller one. This is time versus memory versus accuracy in one decision.

Fixed point: precision you can count

Fixed-point stores x as an integer X = round(x·2^f) with f fractional bits. Resolution is 2^−f; rounding error is at most half of that per operation. Q8 (f = 8) resolves 1/256 ≈ 0.0039. It is fast and predictable on chips without a floating-point unit, but you must check the range (overflow) and the accumulated rounding in long loops.

Explain it another way: intuitive

Drawing a circle with straight lines: more, shorter lines look rounder but take longer to draw. A cleverer stroke (a curve) gets round faster.

Explain it another way: technical

Euler is O(h); trapezoid/Heun O(h²); classical RK4 O(h⁴). Cost per step: 1, 2 and 4 function evaluations. Fixed-point Qm.f: range ±2^(m), resolution 2^(−f), quantisation error uniformly distributed with SD 2^(−f)/√12.

Explain it another way: mathematical

If error E(h) = C·h^p, then E(h/r) = E(h)/r^p. From two runs, p ≈ log(E₁/E₂)/log(h₁/h₂). Richardson extrapolation combines them to cancel the leading error term.

Explain it another way: applied

Game physics engines often pick a fixed, cheap step and accept small energy errors, because a guaranteed frame rate matters more than perfect accuracy; spacecraft trajectory tools pick high-order methods with adaptive steps because a metre at Mars matters.

Try these examples

Example 1

Euler gives error 0.32 at h = 0.4 and 0.16 at h = 0.2. Estimate p, then predict the error at h = 0.05.

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 trapezoid rule has global error roughly proportional to h^2. With step h = 0.2 s the error is 0.8 mm. Estimate the error with step h = 0.05 s, in mm. (4 significant figures.) The run will take about 4× as long.

Answer: mm

2. A sensor value is stored in Q8 fixed point (8 fractional bits). What is the largest possible rounding error for one stored value?

Answer:

3. You sort 40 sensor readings once per second on a microcontroller. Is a simple O(n²) insertion sort acceptable?

  • No: O(n²) is always too slow
  • Yes: 40² = 1,600 comparisons is tiny, and simpler code is easier to verify
  • Only if n is exactly 40
  • Sorting is never needed

4. You grid-search a design with 4 parameters, trying 10 values of each. One simulation takes 1 s. How long does the full grid take, in seconds?

Answer: s

5. Shrinking h keeps reducing the error, until at very small h the error starts to grow. Why?

  • The method's order changes
  • Rounding error accumulates over the huge number of steps
  • Small steps are unstable for every method
  • The exact solution changes

Apply it

Produce an error-versus-cost plot (log–log) for Euler and a second-order method on the same problem. Mark the cheapest run that meets an error target of 0.01. Add a fixed-point Q8 Euler run and mark its error floor.

Reflect

Which part of a system you know is 'good enough' rather than exact, and who decided where good enough was?

Power, performance, area: the chip designer's triangle

Why would a chip designer use four slow cores instead of one fast one, when one fast core is simpler?

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

Why it matters

Every phone, satellite and data centre is limited by power and heat before it is limited by transistors. Semiconductor teams judge every design on PPA: power, performance and area. The same reasoning applies to choosing a microcontroller for a battery-powered rover.

Goals

Predict

A chip runs at 1.2 V. The designers drop the supply to 0.9 V at the same clock. Roughly what happens to dynamic power?

  1. Falls by 25%
  2. Falls to about 56%
  3. Stays the same
  4. Rises

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

Discover

Meet the brief (≥ 3 GOPS, ≤ 0.6 W, ≤ 10 mm²). Start with one core and push the clock: what stops you? Then try 2, 4 and 8 cores, lowering f and V each time. Which core count gives the lowest energy per operation, and why does 8 cores lose?

What the interactive shows, in words

The explorer uses a simplified CMOS model with sliders for supply voltage, clock frequency, core count and activity factor. It reports dynamic power, leakage, throughput, area and energy per operation, and checks a brief of at least 3 GOPS within 0.6 W and 10 mm². One core can't reach 3 GOPS because the maximum clock at 1.3 V is about 1.9 GHz. Two cores need about 1.0 V and use about 0.76 W, failing the power cap. Four cores at about 0.65 V and 0.75 GHz pass with about 0.46 W and 8.4 mm². Eight cores fail on area, and leakage dominates their power.

Understand

The three letters

Power: dynamic (switching) plus static (leakage, which flows even when nothing switches and grows with temperature and with the number of transistors). Performance: work per second, roughly cores × frequency × operations per cycle. Area: silicon used, which sets cost and yield. Improving one usually costs another.

Why parallelism saves energy

Two cores at half the clock deliver the same throughput as one core at full clock. Each can then run at a lower voltage, and power ∝ V²·f. Same work, less power, double the area. This is why phones use many slower cores and why GPUs have thousands. It only works if the task can be split: serial parts don't speed up.

Where it stops paying

Leakage scales with the amount of silicon and with V, not with f. Add many cores at very low voltage and leakage starts to dominate; area and cost grow too. Below a certain voltage the transistors become too slow and too variable. The best design is a sweet spot, and it moves with the workload and the process technology.

Dynamic voltage and frequency scaling

Chips change V and f on the fly: high when you need speed, low when idle. Because energy per operation ∝ V², 'race to idle' (run fast, then sleep) and 'run slow and low' compete; which wins depends on how much leakage the chip has while active and asleep.

Explain it another way: intuitive

Filling and emptying a bucket (the capacitor) many times a second costs water each time. Taller buckets (higher voltage) cost more per fill, and more fills per second (higher clock) cost more per second.

Explain it another way: technical

P_total = α·C·V²·f + I_leak·V. Gate delay t_d ∝ V/(V − V_t)^a with a ≈ 1.3–2 (alpha-power law), so f_max ∝ (V − V_t)^a/V. Throughput = N·f·IPC. Energy per op = (α·C·V² + I_leak·V/f)/IPC.

Explain it another way: mathematical

Same throughput with N cores at f/N and voltage V_N: P_N/P_1 = (V_N/V_1)² for the dynamic part. With V_1 = 1.0 V and V_2 = 0.7 V, dynamic power falls to 49% while area roughly doubles.

Explain it another way: applied

Smartphone processors combine large, fast cores with small, efficient cores on one chip; the operating system moves background tasks to the small cores at low voltage to save battery.

Derivation: Where α·C·V²·f comes from
  1. A logic gate's output drives a load capacitance C. Charging it from 0 to V through the supply draws charge Q = C·V at voltage V: energy C·V² leaves the supply.

  2. Half of that, ½CV², is stored in the capacitor; the other half is dissipated as heat in the pull-up transistor. Discharging dumps the stored half as heat in the pull-down. So each full 0 → 1 → 0 cycle costs C·V².

  3. If a fraction α of the chip's capacitance switches each clock cycle (the activity factor), energy per cycle is α·C·V².

  4. At f cycles per second: P_dyn = α·C·V²·f.

  5. Higher f needs faster transistors, which need higher V (gate delay falls as V rises above the threshold voltage). So pushing f up drags V up, and power grows roughly like f³ near the top of the range.

  6. Energy per operation is P/throughput = α·C·V²·f/(f·ops per cycle) = α·C·V²/(ops per cycle): it depends on V², not on f. Lower voltage is the lever for energy efficiency.

Try these examples

Example 1

A core uses 2 W at 1.0 V and 1.5 GHz. Estimate the dynamic power at 0.8 V and 1.0 GHz (if timing allows).

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 chip's dynamic power is P = α·C·V²·f. At 1 V and 1500 MHz it uses 5 W. The designers change the supply to 0.9 V and the clock to 3000 MHz (same α and C). What is the new dynamic power, in watts? (3 significant figures.)

Answer: W

2. One core at 1 V and clock f does a job using 1 W of dynamic power and 1.5 mm² of silicon. Design B uses 4 identical cores, each clocked at f/4 (same total throughput), which lets the supply drop to 0.6 V. Using P = α·C·V²·f per core, what is design B's total dynamic power, in watts? (3 significant figures.) Its area is about 6 mm².

Answer: W

3. Why can't a designer just keep raising the clock frequency of one core?

  • Software can't use more speed
  • Higher f needs higher V, so power and heat rise much faster than performance
  • Clock frequency has no effect on power
  • Transistors can only switch at one fixed speed

4. In the PPA explorer, 8 cores at 0.5 V use more total power than 4 cores at 0.65 V for the same throughput. Why?

  • Dynamic power is higher with 8 cores
  • Leakage grows with the amount of silicon, and at very low voltage it dominates
  • The explorer is wrong
  • More cores always use more power

Apply it

Find the design in the PPA explorer that meets the brief with the lowest energy per operation. Record V, f, cores, power, area and pJ/op. Then write three sentences explaining the sweet spot in terms of V², leakage and area.

Reflect

Why might a battery-powered rover's computer deliberately run slower than it could?

Energy per operation: the number that decides battery life

Chip A is twice as fast as chip B but draws three times the power. Which one empties a rover's battery first doing the same job?

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

Why it matters

Power is a rate; batteries hold energy. For a fixed amount of work, what drains the battery is joules per operation times the number of operations, plus whatever the chip burns while waiting. This one number lets you compare a microcontroller, a phone chip and a custom accelerator fairly.

Goals

Predict

Chip A: 3 W, finishes a job in 1 s. Chip B: 1 W, finishes in 2 s. Both sleep at 0 W afterwards. Which uses less energy for the job?

  1. A (it's faster)
  2. B: 2 J against A's 3 J
  3. They are equal
  4. Impossible to tell

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

Discover

In Silicon Studio, compare a ripple-carry adder with a wider or parallel design: note the gate count (a proxy for area and switched capacitance) and the longest path (which sets the maximum clock). Estimate which uses less energy per addition and which finishes a batch of additions sooner.

What the interactive shows, in words

In Silicon Studio the learner compares adder designs by gate count (a stand-in for area and switched capacitance) and longest path (which limits the clock). Fewer gates switching means less energy per addition; a shorter path means more additions per second. The lesson's worked numbers show energy per operation is power divided by operations per second.

Understand

The unit that matters

Energy per operation = power ÷ operations per second. A 0.3 W microcontroller doing 100 million operations a second spends 3 nJ per operation; a 12 W accelerator doing 2 trillion spends 6 pJ. For the same job, the accelerator uses 500 times less energy, even though it draws 40 times more power.

System energy, not chip energy

While the processor works, other parts stay awake: memory, sensors, voltage regulators, the radio. If they draw 2 W regardless, a slow chip keeps them awake longer. Total job energy = (P_chip + P_rest) × time + sleep energy. This is why 'race to idle' (finish fast, then put everything to sleep) often wins in real systems.

Memory moves cost more than maths

On modern chips, fetching a number from off-chip memory can cost hundreds of times the energy of adding it. Energy-efficient designs keep data close: small local memories, data reuse, fewer transfers. This is a hardware–software co-design question: the algorithm's data movement decides the energy.

Duty cycling

Many sensors spend 99% of their life asleep. Average power = d·P_active + (1 − d)·P_sleep. At low duty cycles the sleep current dominates: a 10 mW sleep draw can matter more than a 2 W active draw at 0.1% duty. Battery life = energy capacity ÷ average power.

Explain it another way: intuitive

A sprinter and a walker both cross a room. The sprinter burns more per second but less overall if the walk takes long enough, and the lights stay on while the walker dawdles.

Explain it another way: technical

E_op = P/(f·IPC·N). E_job = E_op·N_ops + P_static·T + E_transitions. Figures of merit: pJ/op, ops/J (TOPS/W for accelerators), energy-delay product E·T when both matter.

Explain it another way: mathematical

With leakage: E_op = α·C·V² + P_leak/(f·IPC). Lowering f to save dynamic energy raises the leakage share per operation; the minimum-energy point is where d(E_op)/dV = 0.

Explain it another way: applied

Earth-observation satellites process images on board and downlink only results, because the energy to transmit raw data can exceed the energy to compute a summary.

Try these examples

Example 1

A sensor node: 20 Wh battery, active 2% of the time at 1.2 W, asleep otherwise at 5 mW. Battery life?

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 processor draws 1.5 W while running at 48 MHz and completing 4 operations per clock cycle. What is the energy per operation, in picojoules (pJ)? (3 significant figures.)

Answer: pJ

2. A field sensor has a 5 Wh battery. It is active 1% of the time drawing 4.5 W, and asleep the rest of the time drawing 1 mW. Ignoring battery ageing and temperature, how many hours does the battery last? (3 significant figures.)

Answer: h

3. While the processor works, the rover's radio and sensors must stay on, drawing 4 W. Chip A: 2 W for 1 s. Chip B: 0.5 W for 3 s. Which uses less total energy?

  • B (lower power)
  • A: (2 + 4) × 1 = 6 J against B's (0.5 + 4) × 3 = 13.5 J
  • They are equal
  • Only the chip's energy matters

4. An accelerator delivers 4 × 10¹² operations per second at 8 W. What is its energy per operation, in pJ?

Answer: pJ

Apply it

For the planetary rover, compare two hypothetical computers for a 10⁹-operation image-processing job: 0.5 W at 200 MOPS and 3 W at 3 GOPS, with 6 W of other systems awake while computing. Which saves more of the night reserve? State your assumptions.

Reflect

Where in a device you use every day might 'race to idle' be happening without you noticing?

Week 32: Resource-efficient design and mission planning

This week you will

Power, mass and data budgets with margins

Every subsystem team swears its estimate is right. Why does the mission still keep 20% in reserve?

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

Why it matters

A conceptual Mars mission lives or dies on its budgets. Mass sets what the rocket can lift; power sets what can run at night; data sets how much science reaches Earth. Systems engineers own these spreadsheets because every subsystem draws on them.

Goals

Predict

Early in a project, the estimated mass is 380 kg against a 400 kg allocation. With 20% contingency on the estimate, is the design inside the allocation?

  1. Yes, with 20 kg to spare
  2. No: 380 × 1.2 = 456 kg, so it's 56 kg over
  3. Exactly on budget
  4. Contingency doesn't apply to mass

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

Discover

On Power, set 20% contingency and find the smallest power supply with a healthy margin. Raise the heaters to 40 W (a cold-season night): what must give? On Mass, find the largest science payload that keeps a healthy margin within 400 kg. On Data, find a link setup that keeps up with 600 Mbit per sol.

What the interactive shows, in words

The planner has tabs for power, mass, data, delta-v and light-time. In each, subsystem estimates are summed, contingency is applied, and the margin against capability is shown with a status word: healthy, below policy or over budget. For example, power loads summing to 97 W with 20% contingency need 116.4 W, so a 110 W supply is 5.5% over budget.

Understand

Anatomy of a budget

List every consumer with its current best estimate (CBE): avionics 18 W, mobility 30 W, heaters 22 W… Sum them. Add contingency to reflect immaturity: perhaps 25–30% for a new design, 10% for something already built and measured. Compare with the capability (power available, mass allocation, bits per day). Policy usually demands a further margin in reserve.

Margin, the honest way

Margin = (capability − estimate with contingency)/(estimate with contingency). It is the engineering team's insurance against surprises: an instrument that turns out heavier, a colder-than-expected winter, a degraded solar array. Margins are tracked over time; a margin that shrinks every month is a warning sign even while it is positive.

Duty cycles and averages

Power budgets use averages over the cycle that matters (a sol, an orbit) plus a check on peaks. A 60 W radio on 20% of the time averages 12 W, but the battery and wiring must still deliver 60 W while it transmits. Energy budgets (Wh per sol) decide whether the battery survives the night.

When the budget breaks

Options, roughly in order of preference: reduce demand (duty-cycle the heaters, compress data), reallocate between subsystems, improve capability (bigger array, faster link), or descope requirements. Each has a cost elsewhere: a bigger array is more mass. Budgets are coupled, which is why one person keeps them all.

Explain it another way: intuitive

Planning a camping trip: everything must fit in the rucksack (mass), the phone must last the weekend (energy), and you only get signal at the top of the hill (data). You pack a little spare of each.

Explain it another way: technical

Budget line items: CBE, contingency % (by maturity), maximum expected value (MEV = CBE × (1 + contingency)), allocation, margin = (allocation − MEV)/MEV. Tracked per design review.

Explain it another way: mathematical

Margin m = A/(E·(1 + c)) − 1. To keep m ≥ m₀ the estimate must satisfy E ≤ A/((1 + c)(1 + m₀)). With A = 400 kg, c = 20% and m₀ = 10%: E ≤ 303 kg.

Explain it another way: applied

Space agencies publish mass-growth allowance tables by design maturity, and design reviews routinely check that each budget still carries the margin the project's policy requires.

Try these examples

Example 1

Loads: 18, 30, 22, 15, 12 W. Contingency 20%. Supply 110 W. Margin?

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 lander mass budget has current best estimates of 2 kg, 11.5 kg, 20 kg, 19.5 kg. Policy adds 15% contingency to the total. The launch allocation is 77 kg. Margin = (capability − estimate with contingency) ÷ (estimate with contingency) × 100. What is the margin, in %? (1 decimal place; negative means over budget.)

Answer: %

2. A lander power budget has current best estimates of 51 W, 16 W, 14 W, 50 W. Policy adds 30% contingency to the total. The power system can supply 138 W. Margin = (capability − estimate with contingency) ÷ (estimate with contingency) × 100. What is the margin, in %? (1 decimal place; negative means over budget.)

Answer: %

3. A field sensor has a 10 Wh battery. It is active 5% of the time drawing 2 W, and asleep the rest of the time drawing 10 mW. Ignoring battery ageing and temperature, how many hours does the battery last? (3 significant figures.)

Answer: h

4. A radio draws 60 W while transmitting, 20% of the time. The average power budget shows 12 W. What else must you check?

  • Nothing: the average is what matters
  • That the battery and power system can deliver the 60 W peak
  • That the radio is off at night
  • That the average is 60 W

5. Why is contingency larger for a brand-new instrument than for one that has flown before?

  • New instruments are always heavier
  • Immature estimates tend to grow as the design is detailed; flown hardware has measured values
  • It's a rule with no basis
  • Flown hardware has no uncertainty

Apply it

Build a full power budget for the planetary rover's sol from the Build's numbers (motors, camera, heaters, radio, computer), with contingency by maturity, and state the margin against your chosen solar and battery capacity.

Reflect

Which of your own 'budgets' (time, money, energy) would benefit from an explicit margin?

The rocket equation and the Δv budget

Doubling a spacecraft's fuel doesn't double how far it can go. Why does the rocket equation punish brute force?

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

Why it matters

Mission planners don't count kilometres; they count Δv, the total change in velocity every manoeuvre needs. The rocket equation turns that Δv into propellant mass, and therefore into everything else in the mass budget.

Goals

Predict

A stage reaches Δv = 2 km/s with a mass ratio m₀/m_f = 2. What mass ratio gives 4 km/s with the same engine?

  1. 4
  2. 3
  3. 8
  4. 2.8

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

Discover

Open the Δv tab. With Isp = 320 s and 900 kg dry, find the propellant that just meets 1,400 m/s plus 20% contingency. Then double the propellant and read how little extra Δv you gain. Finally raise Isp to 450 s: how much propellant do you save?

What the interactive shows, in words

The Δv tab takes specific impulse, dry mass, propellant mass and the required Δv. With Isp 320 s, 900 kg dry and 600 kg propellant the stage delivers about 1,603 m/s. Meeting 1,400 m/s plus 20% contingency (1,680 m/s) needs about 637 kg of propellant. Doubling propellant from 600 to 1,200 kg adds only about 1,060 m/s more, and raising Isp to 450 s cuts the propellant needed substantially.

Understand

Δv is the currency

Each manoeuvre (leaving Earth orbit, correcting course, entering Mars orbit, landing) has a Δv cost set by orbital mechanics. Add them up with margin and you have the Δv budget. The rocket equation then tells you the propellant needed, which enters the mass budget, which may change the launch vehicle. Budgets are coupled.

Why mass growth hurts twice

If the dry mass grows by 10%, you need 10% more propellant to deliver the same Δv (m_p ∝ m_f), and that propellant needs tanks, which add more dry mass. This is why every gram on a lander is fought over, and why reducing structure mass is worth so much.

Better exhaust beats more fuel

Because Δv is linear in vₑ but logarithmic in mass ratio, a more efficient engine (higher Isp) is far more valuable than more propellant. Electric propulsion reaches vₑ of 20–40 km/s, but with tiny thrust: it can provide large Δv over months, not the quick burns a landing needs. Another trade-off, of thrust against efficiency.

Staging

A single stage drags its empty tanks all the way. Staging discards spent structure, so each stage's mass ratio applies to a smaller rocket. The Δvs of stages add. That is why reaching orbit, which needs roughly 9 km/s including losses, uses two or more stages.

Explain it another way: intuitive

Every bit of fuel has to carry the fuel that will be burned after it. The last kilogram of propellant is easy to push; the first has to push all the rest.

Explain it another way: technical

Δv = Isp·g₀·ln(m₀/m_f). Propellant fraction ζ = 1 − e^(−Δv/vₑ). Multi-stage: Δv_total = Σ vₑᵢ·ln(m₀ᵢ/m_fᵢ).

Explain it another way: mathematical

d(Δv)/d(m_p) = vₑ/(m_f + m_p): each extra kilogram of propellant buys less Δv than the one before. Doubling Δv squares the mass ratio; tripling cubes it.

Explain it another way: applied

Mars missions choose launch windows (about every 26 months) partly because the Δv to get there varies with the planets' positions; outside a window the propellant needed grows sharply.

Derivation: From momentum to the logarithm
  1. In free space, a rocket of mass m moving at v ejects a small mass dm_p of propellant backwards at speed vₑ relative to the rocket.

  2. Momentum is conserved: the rocket gains m·dv = vₑ·dm_p. Its mass falls by the same amount: dm = −dm_p.

  3. So dv = −vₑ·dm/m.

  4. Integrate from the start (m₀, v = 0) to burnout (m_f, v = Δv): Δv = −vₑ∫ dm/m from m₀ to m_f = vₑ·ln(m₀/m_f).

  5. Rearrange for the mass ratio: m₀/m_f = e^(Δv/vₑ). Propellant m_p = m_f·(e^(Δv/vₑ) − 1).

  6. Specific impulse Isp (seconds) is vₑ/g₀ with g₀ = 9.80665 m/s². A storable bipropellant engine might have Isp ≈ 320 s (vₑ ≈ 3.1 km/s); hydrogen–oxygen ≈ 450 s.

  7. Assumptions: no gravity or drag losses during the burn, one stage, all propellant burned. Real launches add losses and use stages to throw away empty tank mass.

Try these examples

Example 1

Isp = 320 s, dry mass 900 kg, propellant 600 kg. What Δv?

The worked solution is in the online lesson.

Example 2

The same craft must deliver 1,400 m/s with 20% Δv contingency (1,680 m/s). How much propellant?

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 stage has specific impulse Isp = 340 s (so exhaust speed vₑ = Isp × 9.80665 m/s). It starts at m₀ = 800 kg, 55.00000000000001% of which is propellant it burns completely. Using Δv = vₑ·ln(m₀/m_f), what Δv does it deliver, in m/s? (Nearest 1 m/s.)

Answer: m/s

2. A spacecraft with a dry (empty) mass of 300 kg needs Δv = 3600 m/s. Its engine's exhaust speed is vₑ = 2200 m/s. Using Δv = vₑ·ln(m₀/m_f) with m_f = dry mass, how much propellant must it carry, in kg? (Nearest 1 kg.)

Answer: kg

3. To increase Δv by 20%, which is generally more effective?

  • Carry 20% more propellant
  • Use an engine with 20% higher exhaust speed
  • They are the same
  • Neither changes Δv

4. A lander's dry mass grows 10% late in the design. What happens to the propellant needed for the same Δv?

  • Nothing
  • It grows by about 10% too, which adds tank mass, which adds more propellant
  • It falls
  • It doubles

Apply it

Draft a Δv budget for a conceptual Mars orbiter: list four manoeuvres with assumed Δv values (state they are assumptions), add 10% margin, and compute the propellant for a 1,000 kg dry spacecraft at Isp = 320 s. Then repeat at Isp = 450 s and compare.

Reflect

Why might a mission choose a slower route that needs less Δv?

Light-time and the data budget: why rovers decide for themselves

A rover spots a rock in its path. A command from Earth takes up to 22 minutes to arrive. What should it do?

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

Why it matters

No engineer can joystick a rover on Mars. The speed of light and narrow data links force autonomy, compression and careful prioritisation: what to measure, what to send home, and what the machine must decide alone.

Goals

Predict

Mars is 225 million km away. Roughly how long until a command's reply arrives back on Earth?

  1. About 1 second
  2. About 12.5 minutes
  3. About 25 minutes
  4. About 2 hours

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

Discover

Do Level 2: calculate the delay at Mars's farthest (401 million km), the round trip at 225 million km, and the drive energy. Then open the mission planner's Light-time and Data tabs to see how distance and link choices change what's possible.

What the interactive shows, in words

In the rover Build's Level 2 the learner computes the one-way delay at 401 million km (about 22.3 minutes), the round trip at 225 million km (about 25 minutes) and the energy for a two-hour drive with 100 W motors and a 20 W camera (240 Wh). The mission planner's Light-time tab converts any distance into one-way and round-trip minutes, and its Data tab compares data generated per sol with what the relay passes can send.

Understand

Distance over c

Delay = distance ÷ c, with c ≈ 299,792 km/s. Earth–Mars distance varies from about 55 million km to about 400 million km over the planets' cycle, so one-way delay ranges from about 3 to 22 minutes. Near solar conjunction the Sun sits between the planets and communication stops for days to weeks; missions plan for it in advance.

Consequences for control

Any feedback loop through Earth has a delay of at least the round trip plus human thinking time. That rules out steering, hazard avoidance or fault response from Earth. Those must be closed on board: sense, think, act within the rover. Earth sets goals (where to go, what to study) and approves plans for the next sol.

The data budget

Data per sol = link rate × pass time × passes. A direct-to-Earth link may be only kilobits per second; relaying through an orbiter is faster but limited to short passes. Generation can easily exceed downlink, so the rover must compress, prioritise and sometimes discard. Unsent data queue up in limited on-board storage: another budget with a margin.

Autonomy is a resource trade

On-board decisions cost computation and energy (and need software you can trust without supervision); Earth-in-the-loop decisions cost time and data. Engineers allocate decisions between rover and ground by asking: how fast must this be decided, how risky is a wrong answer, and how much data would Earth need to decide it?

Explain it another way: intuitive

Texting a friend whose replies always take 25 minutes: you'd never ask them to help you cross a busy road. You'd agree a plan in advance and handle surprises yourself.

Explain it another way: technical

Light-time τ = d/c. Earth-in-the-loop decision latency ≥ 2τ + t_ops. Data volume per sol D = R·t_pass·N_pass − overhead. Storage margin = (capacity − peak queue)/peak queue.

Explain it another way: mathematical

At d = 401 × 10⁶ km: τ = 4.01 × 10⁸/2.998 × 10⁵ ≈ 1,338 s ≈ 22.3 min. At 128 kbit/s for 10 min, two passes: 128 × 600 × 2 = 153,600 kbit ≈ 154 Mbit per sol.

Explain it another way: applied

Mars rovers carry autonomous navigation software that builds 3D maps from stereo cameras and chooses safe paths, so they can drive farther per sol than if every metre were planned on Earth.

Try these examples

Example 1

A rover generates 300 Mbit per sol. Its link is 128 kbit/s for 10-minute passes, 2 passes per sol. Is there margin?

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. Earth and Mars are 225 million km apart. Radio travels at c = 299,792 km/s. What is the round-trip time for a command and its reply (ignore processing time), in minutes? (2 decimal places.)

Answer: min

2. Earth and Mars are 78 million km apart. Radio travels at c = 299,792 km/s. What is the one-way signal delay, in minutes? (2 decimal places.)

Answer: min

3. A rover's relay link runs at 64 kbit/s for 12 minutes per orbiter pass, with 3 passes a day. Each compressed image is 12 Mbit. Ignoring protocol overhead, how many whole images can it send per day?

Answer: images

4. Which decision must a Mars rover make on board?

  • Which rock to study next week
  • Stopping when its hazard camera sees a drop-off ahead
  • Which team gets the next image
  • The mission's science goals

Apply it

For the rover Build's Level 4 plan, write a table of every decision in a sol (route choice, checkpoint, dust response, battery pause) and allocate each to rover or Earth, citing the delay and the data needed.

Reflect

What would change about rover design if Mars were as close as the Moon (about 1.3 light-seconds)?

Week 33: Hardware-software integration

This week you will

Registers and bit masks: where software touches silicon

One line of C turns on a motor driver. Which single bit, at which address, did it change, and what else could it break?

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

Why it matters

Every optimisation in software eventually becomes bits in a register: a clock divider, a sleep mode, a PWM duty. Integration bugs live at this boundary, where a correct algorithm meets a wrongly set bit.

Goals

Predict

A control register holds 0b1010_0011. You want to set bit 2 without changing the others. Which operation?

  1. reg = 0b0000_0100
  2. reg = reg | 0b0000_0100
  3. reg = reg & 0b0000_0100
  4. reg = reg ^ 0b1111_1011

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

Discover

In Silicon Studio, build or inspect a small register made of flip-flops with an enable. Write a value, then change a single bit using a mask built from gates. Notice that a 'register' in firmware is exactly this: storage whose outputs drive real hardware.

What the interactive shows, in words

In Silicon Studio the learner works with a register built from flip-flops and changes one bit by combining the stored value with a mask through logic gates: OR to set, AND with an inverted mask to clear, XOR to toggle. The point: a firmware register is real storage whose outputs control hardware.

Understand

Memory-mapped I/O

Microcontrollers give each peripheral (GPIO, timers, ADC, UART) a block of addresses. Writing to an address doesn't store data in RAM; it sets flip-flops whose outputs drive the hardware: a pin's direction, a timer's prescaler, an interrupt enable. Reading may return live hardware state, such as whether a conversion has finished.

The four mask operations

Set bit n: reg |= (1 << n). Clear: reg &= ~(1 << n). Toggle: reg ^= (1 << n). Test: (reg & (1 << n)) != 0. Multi-bit fields (a 3-bit prescaler at bits 4–6) are cleared with a field mask, then the new value is ORed in, shifted into place. Datasheets give each bit's meaning; the code should name them, not use magic numbers.

Read–modify–write hazards

reg |= mask is really three steps: read, OR, write. If an interrupt changes the same register between the read and the write, its change is lost. Fixes: disable interrupts briefly around the update, or use hardware 'set' and 'clear' registers that change only the bits you write as 1. Some status bits clear when read, so even reading has side effects.

Integration means checking both sides

A firmware unit test can't see a wrongly configured clock. Integration tests run real code on real (or accurately simulated) hardware and check observable behaviour: the pin toggles at the expected frequency, the ADC reads a known voltage correctly. Write down what each register should contain and check it in a debugger.

Explain it another way: intuitive

A register is a row of light switches on a wall you can't see behind. Each switch turns something on in the building. Flip the one you need without brushing the others.

Explain it another way: technical

Volatile access: registers are declared volatile so the compiler doesn't cache or reorder accesses. Bit-band or atomic set/clear registers avoid read–modify–write races on some architectures.

Explain it another way: mathematical

Field update: reg = (reg & ~(m << s)) | ((v & m) << s), where m = 2^w − 1 for a w-bit field at shift s. Example: w = 3, s = 4, v = 5: clear mask ~0x70, value 0x50.

Explain it another way: applied

Low-power modes are entered by setting a few register bits; a mistaken bit can leave a peripheral clock running and quietly double a sensor node's sleep current, ruining a battery-life budget.

Try these examples

Example 1

reg = 0x5A (0101_1010). Clear bit 3, then toggle bit 0. Result?

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 C expression clears bit 5 of reg and leaves every other bit unchanged?

  • reg = reg & (1 << 5)
  • reg &= ~(1 << 5)
  • reg |= (1 << 5)
  • reg ^= 0xFF

2. reg = 0x3C. After reg |= 0x81, what is reg in decimal?

Answer:

3. A 3-bit prescaler field sits at bits 4–6 of an 8-bit register that currently holds 0x0F. You write the value 5 into the field. What does the register hold now, in decimal?

Answer:

4. Main code does PORT |= LED_BIT while an interrupt handler sets MOTOR_BIT in the same register. Occasionally the motor bit is lost. Why?

  • The compiler is broken
  • The interrupt ran between main's read and write, so main wrote back the old value
  • Bits can't be shared
  • The LED draws too much current

Apply it

Write a short configuration routine for a hypothetical timer (enable bit 0, 3-bit prescaler at bits 4–6, interrupt enable bit 7) using named masks. Show the register value after each line in hex and binary.

Reflect

Why do datasheets matter more than code comments when debugging at this level?

Polling or interrupts? Latency, energy and shared data

Checking a button a million times a second never misses a press. Why is it usually the wrong design?

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

Why it matters

A rover's wheel encoder, a greenhouse's door sensor and a lift's safety edge all need fast responses on a limited power budget. How firmware waits for events decides whether the processor can sleep, and therefore whether the battery lasts.

Goals

Predict

A sensor event happens about once a minute. Polling every 1 ms keeps the CPU awake. Interrupts let it sleep between events. Roughly how much of the time can the interrupt design sleep?

  1. About half
  2. Almost all of it
  3. None
  4. Exactly 1 ms per minute

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

Discover

In the Robotics Workbench, set up a sensor that reacts to an event (a bump or line crossing). Compare a loop that checks the sensor on a fixed schedule with an event-driven reaction. Note the reaction delay and how often the controller has to run.

What the interactive shows, in words

In the Robotics Workbench the learner compares a controller that checks a sensor on a fixed schedule with one that reacts to the event directly. The scheduled check reacts within one period; the event-driven reaction is faster and lets the controller do nothing between events, which is what allows a real processor to sleep.

Understand

Polling

The main loop repeatedly reads a status bit. Simple, deterministic and easy to debug. Worst-case latency is the loop period (plus the work done each loop). Energy cost: the CPU wakes every period whether or not anything happened. Good when events are frequent and regular, or when you need a fixed sampling rate anyway (a control loop at 1 kHz).

Interrupts

Hardware detects the event and forces the CPU to run a short handler (an ISR). Latency is microseconds (entry cycles plus any time interrupts are disabled). Between events the CPU can sleep. The price is complexity: handlers interrupt main code at unpredictable moments, which creates races on shared data.

Protecting shared data

Rules of thumb: keep ISRs short (set a flag, copy a value, leave); declare shared variables volatile; read multi-byte values with interrupts briefly disabled or with a consistency check; use a ring buffer with one writer and one reader. Never call slow or blocking functions inside an ISR.

Hybrid designs

Many systems use an interrupt to wake from sleep, then poll briefly while active, or a timer interrupt that runs a fixed-rate control loop. The choice is a budget trade: latency target, energy per event, CPU time left for other work, and how much complexity you can verify.

Explain it another way: intuitive

Polling is checking your letterbox every five minutes. Interrupts are a doorbell: you can nap until it rings, but it might ring while you're carrying hot soup.

Explain it another way: technical

Polling latency ≤ T_poll + T_loop. Interrupt latency = hardware entry (≈ 12–20 cycles on many cores) + longest interrupts-disabled section + preceding higher-priority ISRs. CPU load for polling = T_check/T_poll.

Explain it another way: mathematical

Average power, interrupt design: P = P_sleep + E_event·rate. Polling: P = (T_check/T_poll)·P_active + (1 − T_check/T_poll)·P_sleep. With T_check = 5 µs, T_poll = 1 ms, P_active = 30 mW, P_sleep = 0.1 mW: polling ≈ 0.25 mW versus about 0.1 mW for rare events.

Explain it another way: applied

Wearable devices use interrupt pins from accelerometers to wake the main processor only when motion is detected, so they can last days or weeks on a small battery.

Try these examples

Example 1

A polling loop runs every 2 ms and takes 0.3 ms per pass. What is the worst-case delay before an event is noticed?

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 battery-powered door sensor must react within 10 ms to a door opening, which happens a few times a day. Which design?

  • Poll every 1 ms forever
  • Interrupt on the sensor pin, sleeping between events
  • Poll every 10 seconds
  • Neither can meet 10 ms

2. A field sensor has a 5 Wh battery. It is active 1% of the time drawing 4.5 W, and asleep the rest of the time drawing 1 mW. Ignoring battery ageing and temperature, how many hours does the battery last? (3 significant figures.)

Answer: h

3. Which is good practice inside an interrupt handler?

  • Print a long debug message over a slow serial port
  • Set a flag or copy a value into a buffer, then return
  • Wait for another sensor to be ready
  • Run the whole control algorithm, however long it takes

4. A poll check takes 5 µs and runs every 1 ms. What percentage of CPU time does polling use?

Answer: %

Apply it

For the elevator Build's door edge sensor, write a short design note: polling or interrupt, the worst-case latency, the energy impact, and how the shared 'door blocked' flag is protected.

Reflect

Where have you seen a system that clearly polls (checks on a schedule) when it could have waited for an event?

From source code to running hardware, and testing the join

The code compiled, the tests passed, and the robot still twitched. Where in the chain did it go wrong?

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

Why it matters

Optimising a system means changing code and measuring hardware. Knowing what happens between the two (and where timing, memory and configuration can silently change) is what makes the measurements trustworthy.

Goals

Predict

You switch the compiler from -O0 (no optimisation) to -O2. What usually happens?

  1. The program does something different
  2. It runs faster and is often smaller, but is harder to step through in a debugger
  3. Nothing changes
  4. It always gets bigger and slower

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

Discover

Write the multiplication program for the Nibble machine and step through fetch, decode and execute. Count the instructions executed for 3 × 4. Then think about what a compiler would have to produce from 'c = a * b' for this machine.

What the interactive shows, in words

In the virtual computer Build's Level 4 the learner writes a short program (LOAD, ADD, STORE, JNZ, HALT) that multiplies by repeated addition and steps through fetch, decode and execute for each instruction. Counting instructions executed links source code to the work the hardware actually does.

Understand

The chain

Compiler: C or Rust → assembly for the target. Assembler: assembly → machine-code object files. Linker: combines objects and libraries, places code and data at real addresses using a linker script (flash here, RAM there). Image: a binary or hex file. Flashing: a programmer writes it into the chip's flash. Boot: the reset vector jumps to start-up code that sets up the stack and memory, then calls main.

Optimisation levels are trade-offs

-O0: slow, large, every variable visible to the debugger. -O2: fast, usually smaller. -Os: smallest. -O3: aggressive inlining, can be larger. On a microcontroller with 64 KB of flash, size may decide. Benchmark the configuration you will ship: timings measured on a debug build can differ greatly.

What changes between builds

Library versions, compiler versions, flags, linker scripts and configuration headers can all change behaviour. Reproducible builds pin them all and record a version or commit hash in the firmware itself, so a measurement can always be traced to the exact binary that produced it.

Integration testing

Unit tests check functions in isolation on a computer. Hardware-in-the-loop tests run the real firmware on the real board while a test rig feeds sensor signals and measures outputs and timing. Test the joins: clock configuration, interrupt latency under load, behaviour at power-up, and what happens when a sensor is unplugged.

Explain it another way: intuitive

A recipe (source) becomes a set of kitchen instructions (assembly), which become a printed card filed in the right drawer (linking), which a chef follows from the first step (boot). A mistake can creep in at any stage.

Explain it another way: technical

Toolchain: preprocessor → compiler (IR, optimisation passes) → assembler → linker (sections .text, .data, .bss; memory map) → objcopy to .bin/.hex → flash via SWD/JTAG or bootloader. Map files show where every symbol lives and how much memory is used.

Explain it another way: applied

Spacecraft flight software teams keep their whole toolchain under configuration control and re-run full integration test campaigns after any compiler change, because a subtle change in generated code could alter timing.

Try these examples

Example 1

A firmware image is 58 KB at -O2 and 49 KB at -Os on a chip with 64 KB flash. The -Os build runs a control loop 12% slower. The loop has 30% timing margin. Which do you ship, and what do you record?

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 tool decides the actual memory addresses where code and data end up?

  • The compiler
  • The linker, using a linker script
  • The debugger
  • The flash programmer

2. You benchmark a filter on a -O0 debug build and report its timing. What's wrong?

  • Nothing
  • Shipped firmware is optimised, so the timing won't match what users get
  • Debug builds are always faster
  • Timing doesn't depend on the build

3. What can a hardware-in-the-loop test catch that a unit test on a laptop cannot?

  • Spelling errors in comments
  • A wrongly configured clock that makes the control loop run at the wrong rate
  • A sorting bug in pure code
  • Nothing

4. After warm-up, the baseline takes a mean of 24 ms per run and the optimised version 10 ms (same machine, same input, interleaved runs). What is the speed-up, baseline time ÷ new time? (3 significant figures.)

Answer: ×

Apply it

Write an integration test plan (five tests) for the greenhouse controller firmware: what is stimulated, what is measured, the pass criterion with a number, and which build configuration is tested.

Reflect

Which stage of the build chain did you know least about before this lesson?

Week 34: Engineering benchmarking

This week you will

Designing a benchmark you can trust

The new version is 1.6× faster. Or the first runs were cold, the laptop was heating up and the test file was smaller. Which?

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

Why it matters

The term project asks you to prove an optimisation worked. A benchmark is an experiment: it can be fair or rigged, precise or noisy. Most surprising speed-ups in the wild come from methodology, not from the code.

Goals

Predict

The checker starts with 5 repeats, no warm-up, blocked order and B on a smaller input. Will the measured speed-up be too high, too low, or about right?

  1. Too high, mainly because B's input is smaller
  2. Too low
  3. About right
  4. It can't be predicted

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

Discover

Fix the problems one at a time and watch the speed-up and its interval after each: same input, then interleaved order, then 3 warm-up runs, then 30 repeats. Which fix moved the estimate most? Which narrowed the interval most? Re-run with new seeds to see the interval jitter.

What the interactive shows, in words

The checker simulates per-run times for a baseline A (true 40 ms) and version B (true 31 ms on the same input, 24 ms on a smaller one), with cold-start penalties on the first three runs of each version, a slow upward drift over the session, and random noise. It plots runs in order and reports each mean with a 95% interval, the speed-up with its interval, and a checklist: warm-up of at least 3 runs, at least 10 repeats, interleaved order and the same input. Fixing all four gives speed-ups close to the true 1.29.

Understand

Decide before you measure

Write down the metric (median wall time per run? energy per job?), the workload (input files, sizes), the baseline (current release, built the same way), the environment (machine, power mode, other processes), the number of repeats and the decision rule ('ship if the 95% interval on speed-up is above 1.1'). Deciding afterwards invites choosing whatever looks best.

Warm-up and steady state

First runs pay for empty caches, page faults, JIT compilation and frequency ramp-up. Unless cold-start performance is what you care about (an app's launch time), discard a few warm-up runs and report steady-state. If it is what you care about, measure it deliberately with a fresh process each time.

Repeats and variance

Timing noise comes from interrupts, scheduling, thermal throttling and memory layout. Repeat enough to make the standard error small compared with the effect you care about, and report spread, not just the mean. Medians and percentiles are robust to occasional slow runs; say which you use.

Fair comparison

Same input, same build flags, same machine, same conditions. Interleave versions (A, B, A, B…) or randomise their order so slow drift affects both equally. Pin CPU frequency if you can, close other programs, and note what you couldn't control. A fair benchmark is one where the only systematic difference is the change under test.

Explain it another way: intuitive

Racing two runners is unfair if one starts cold, one runs downhill, or one runs a shorter track. A benchmark is a race; make the track the same.

Explain it another way: technical

Threats to validity: warm-up effects, order effects (drift, thermal), workload mismatch, compiler flag mismatch, measurement overhead (timer resolution), outliers from OS noise. Mitigations: warm-up discard, interleaving or randomisation, fixed workloads, pinned frequency, many repeats, robust statistics.

Explain it another way: mathematical

With linear drift δ ms per run and blocked order of n runs each, B's mean is biased by about n·δ relative to A. Interleaving reduces this to about δ/2. In the checker, δ = 0.12 ms and n = 13 gives about 1.6 ms of bias blocked, versus 0.06 ms interleaved.

Explain it another way: applied

Industry benchmark suites specify exact workloads, run rules and reporting requirements, so that results from different vendors can be compared, and publish the full disclosure of how each result was obtained.

Try these examples

Example 1

Blocked order: A runs first for 13 runs, then B for 13. The machine slows by 0.12 ms per run. Estimate the bias in B's 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. Why discard the first few runs of a steady-state benchmark?

  • They are always outliers caused by bugs
  • They include one-off costs (cold caches, page faults, JIT) that don't represent steady-state performance
  • To make the results look better
  • Because the timer isn't ready

2. Why interleave runs of A and B rather than running all A then all B?

  • It's faster
  • Slow drift (heat, background tasks) then affects both versions equally instead of biasing one
  • It reduces noise to zero
  • It doesn't matter

3. After warm-up, the baseline takes a mean of 24 ms per run and the optimised version 13.3 ms (same machine, same input, interleaved runs). What is the speed-up, baseline time ÷ new time? (3 significant figures.)

Answer: ×

4. Past runs of a benchmark have mean 72 ms and standard deviation 5 ms. A new run takes 88 ms. What is its z-score? (2 decimal places; negative if it is below the mean.)

Answer:

5. Which decision rule is best written before running the benchmark?

  • We'll decide once we see the numbers
  • Ship if the 95% interval on the median-time speed-up lies entirely above 1.10
  • Ship if it looks faster
  • Ship if any run of B beats the best run of A

Apply it

Write a one-page benchmark protocol for your term project: metric, workload, baseline, environment, warm-up, repeats, order, statistics and decision rule. Get a classmate to find one way your protocol could still be unfair.

Reflect

Which threat to fair comparison would be hardest to control on your own computer?

A speed-up is a ratio: give it an interval

1.29× faster. Plus or minus what? And is 1.0 inside the interval?

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

Why it matters

Speed-ups, efficiency gains and energy savings are ratios of two measured quantities. Last fortnight's propagation rules turn into a tool you will use in every results table of your term project.

Goals

Predict

A: 40.0 ± 0.4 ms, B: 31.0 ± 0.6 ms (standard errors). Which is the speed-up's standard uncertainty?

  1. About 0.01
  2. About 0.03
  3. About 0.10
  4. About 1.0

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

Discover

Choose A ÷ B. Set A = 40 with δA = 0.4 (1%) and B = 16 with δB = 0.3 (about 1.9%): the same relative uncertainties as the benchmark below, so the ratio's relative uncertainty is the same too. Read it off, then increase δB and watch it grow. Finally open the benchmark checker and compare its interval with your hand calculation.

What the interactive shows, in words

The uncertainty calculator in quotient mode shows A ÷ B with its propagated uncertainty and a Monte Carlo histogram. For A = 40 ± 0.4 and B = 16 ± 0.3 the ratio is 2.5 with a relative uncertainty of about 2.2%, the same relative uncertainty as a 40 ± 0.4 ms against 31 ± 0.6 ms benchmark, and the simulation agrees with the formula. Raising δB widens the histogram and eventually skews it, which is when the symmetric formula becomes unreliable.

Understand

From two means to one ratio

Speed-up S = t_A/t_B. With independent standard errors SE_A and SE_B: δS/S = √((SE_A/t_A)² + (SE_B/t_B)²). A 95% interval is S ± 1.96·δS. If the interval lies wholly above 1, B is faster at that confidence; if it includes 1, the data don't show a speed-up.

Compare against what matters

Statistical clarity is not the same as practical value. An interval of 1.02–1.04 is confidently above 1 but may not justify a risky change. Compare the interval with the threshold you set in your decision rule (say 1.10), not just with 1.

Ratios of noisy numbers misbehave

The quotient rule is first order. If B's relative uncertainty exceeds about 10%, the distribution of t_A/t_B is skewed and the symmetric interval misleads; use more repeats, or resample (bootstrap) the runs. Also beware averaging per-run speed-ups: the mean of ratios is not the ratio of means.

Report completely

A good line in a results table: 'Speed-up (median time, B vs A) 1.29 [1.24, 1.35], 95% CI by quotient propagation; n = 30 runs each after 3 warm-up, interleaved; same 4 MB input; laptop on mains, fixed performance mode.' Anyone can judge it, and anyone can try to reproduce it.

Explain it another way: intuitive

Two wobbly measurements make a wobblier ratio. The percentages of wobble combine, like the sides of a right-angled triangle.

Explain it another way: technical

Delta-method variance of a ratio: Var(A/B) ≈ (μ_A/μ_B)²·(Var A/μ_A² + Var B/μ_B² − 2Cov(A, B)/(μ_Aμ_B)). Paired, interleaved runs can make A and B positively correlated, which reduces the variance of their ratio.

Explain it another way: mathematical

Log transform: ln S = ln t_A − ln t_B, and δ(ln t) ≈ δt/t. So δ(ln S) = √((δt_A/t_A)² + (δt_B/t_B)²), and an interval on ln S exponentiates to an asymmetric interval on S, which behaves better for large uncertainties.

Explain it another way: applied

Compiler teams track performance across thousands of benchmarks every night and flag a change only when the measured slowdown exceeds the run-to-run noise they've characterised for that benchmark.

Try these examples

Example 1

A = 60.0 ± 1.2 ms, B = 50.0 ± 1.5 ms. Speed-up, uncertainty and 95% interval. Does it clear a 1.10 threshold?

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. Baseline mean = 40 ± 0.8 ms and optimised mean = 33.3 ± 1.33 ms (each ± is a standard error, independent). The speed-up S = baseline ÷ optimised. What is the standard uncertainty of S? (3 decimal places.)

Answer: ×

2. Baseline mean = 18 ± 0.18 ms and optimised mean = 6 ± 0.06 ms (each ± is a standard error, independent). The speed-up S = baseline ÷ optimised. What is the standard uncertainty of S? (3 decimal places.)

Answer: ×

3. A speed-up is reported as 1.08 with 95% interval 0.97–1.19. What should the report conclude?

  • B is 8% faster
  • The data don't show B is faster: the interval includes 1
  • B is slower
  • The benchmark is invalid

4. Why not compute the speed-up as the average of per-run ratios t_A,i / t_B,i?

  • It's the same as the ratio of means
  • The mean of ratios is biased and depends on arbitrary pairing; the ratio of means (or medians) is the standard
  • Ratios can't be averaged
  • It's always more accurate

Apply it

Take the benchmark checker's fair configuration, run five seeds, and record S ± δS for each. How many intervals contain the true 1.29? Write a results-table line in the format above for your best-documented run.

Reflect

When would you report a speed-up interval on a log scale rather than a linear one?

Which part made it better? Baselines and ablations

You changed three things and the greenhouse used 12% less energy. Which change earned the saving?

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

Why it matters

Optimisation projects usually change several things at once. Without an ablation you can't say which change mattered, so you can't explain the result, keep the useful part, or drop the useless complexity.

Goals

Predict

Full design: −12% energy. Remove change X: −11%. Remove change Y: −3%. Which change matters most?

  1. X
  2. Y
  3. Equal
  4. Can't tell from this

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

Discover

Do Level 4: compare P control with PI control at the same setpoint. Treat the integral term as one 'component'. Record energy, time outside the comfort band and the 03:00 temperature for both. That pair of runs is an ablation of integral action.

What the interactive shows, in words

In the greenhouse Build's Level 4 the learner compares proportional control with proportional-integral control at matched settings. P control at an 18 °C setpoint with Kp = 400 W/°C settles at about 14.6 °C at 03:00 and fails comfort; PI at 17 °C holds 17.0 °C with about 20.1 kWh. Comparing the two isolates the contribution of the integral term.

Understand

Fair baselines

A baseline is what you compare against. A strong one is the best simple alternative a competent engineer would use (a tuned thermostat, not a broken one), run on the same workload with the same effort spent tuning. Beating a weak baseline proves little. Say how the baseline was chosen and tuned.

Ablation: take it away and measure

Start from the full design. Remove (or replace with the simplest alternative) one component at a time, holding everything else fixed, and measure the change on the same pre-defined metrics. The drop when a component is removed is its contribution in the context of the rest of the design.

Interactions

Components can depend on each other: a better sensor filter might only help when integral action is present. Then one-at-a-time ablation underestimates or overestimates contributions. A full factorial test (all 2^k on/off combinations for k components) reveals interactions, at a cost that grows quickly with k.

Uncertainty still applies

Each ablation result is a difference with an uncertainty. A component whose removal changes the metric by less than about two standard errors of the difference hasn't been shown to matter. Report every row with its interval, including the ones that show nothing.

Explain it another way: intuitive

A cake recipe changed three ingredients and tastes better. Bake it three more times, each with one change undone, to find out which one made the difference.

Explain it another way: technical

One-factor-at-a-time ablation measures conditional contributions Δᵢ = f(full) − f(full minus i). Factorial designs estimate main effects and interactions; fractional factorials trade some interaction information for fewer runs.

Explain it another way: mathematical

Two components X, Y with on/off levels: four runs f(00), f(10), f(01), f(11). Main effect of X ≈ ½[(f(10) − f(00)) + (f(11) − f(01))]; interaction = ½[(f(11) − f(01)) − (f(10) − f(00))].

Explain it another way: applied

Machine-learning papers are routinely expected to include ablation tables showing how much each proposed component contributes, because a complex model whose gains come from one small trick is misleading.

Try these examples

Example 1

Energy (kWh): baseline 24.0; full design 21.0; full without integral 23.5; full without filtering 21.2. Interpret.

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 baseline is most convincing for a new greenhouse controller?

  • A thermostat with an absurd 10 °C gap
  • A well-tuned on/off thermostat on the same night, sensors and comfort limits
  • No heating at all
  • Last year's weather

2. Full design scores 88% accuracy. Removing the voting circuit gives 81%; removing the speed change gives 86%. How many percentage points does voting contribute in this design?

Answer: points

3. Removing X alone costs 1 point and removing Y alone costs 1 point, but removing both costs 8 points. What does this suggest?

  • X and Y are useless
  • X and Y interact: each can largely compensate for the other
  • The measurements are wrong
  • X matters more than Y

4. Baseline mean = 24 ± 0.72 ms and optimised mean = 10 ± 0.4 ms (each ± is a standard error, independent). The speed-up S = baseline ÷ optimised. What is the standard uncertainty of S? (3 decimal places.)

Answer: ×

Apply it

Plan the ablation table for your term project: list each component of your optimised design, what replaces it when ablated, the metric, and the number of repeats per row.

Reflect

Have you ever kept a change in a project without knowing whether it helped? How would you find out now?

Week 35: Technical manuscript preparation

This week you will

Anatomy of a technical manuscript

A reviewer reads your title, abstract and one figure, then decides whether to read the rest. What must those three things carry?

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

Why it matters

Your term project and the year capstone end as manuscripts. Engineering writing is a tool: it lets a reviewer check your reasoning, a colleague reproduce your results, and a decision-maker trust the claim at exactly the strength the evidence supports.

Goals

Predict

Which abstract sentence best reports a result?

  1. Our controller is much better than the baseline.
  2. Our PI controller used 20.1 kWh against 23.4 kWh for a tuned thermostat (14% less; n = 5 simulated nights) while meeting the same comfort limit.
  3. The results were very promising.
  4. We did lots of tests.

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

Discover

Do Level 5: ask one question, change one variable across at least four runs, hold the noise seed and everything else fixed. As you work, keep a lab log of every setting; that log becomes your methods section.

What the interactive shows, in words

In the greenhouse Build's Level 5 the learner asks one question, changes one variable across at least four runs with the noise seed and everything else fixed, and writes a short report with a hypothesis, method, results and limits. Recording every setting while working produces the methods section.

Understand

The sections and their jobs

Title: the specific finding or question. Abstract (150–250 words): problem, approach, key result with numbers and uncertainty, main limitation. Introduction: why it matters, what was known, your question. Methods: everything needed to reproduce. Results: what you found, with figures and tables, without interpretation. Discussion: what it means, limitations, what next. References.

Methods are a recipe

List the system and its version (Build, simulator, code commit), every parameter, the seeds, the number of runs, the metrics and how they were computed, the statistics and the decision rule. State assumptions explicitly with their expected effect. A test: could a classmate regenerate your main figure using only your methods section?

Claims at the strength of the evidence

Use verbs that match the evidence: 'reduced energy by 14% [10%, 18%] in simulation' not 'solves energy waste'. Say 'in simulation' when it was. Report results that didn't work. Separate what you measured from what you infer. Overclaiming is the fastest way to lose a reviewer's trust.

Limitations are a strength

Every study has a boundary: simplified models, limited conditions, a small number of runs, one machine. Stating them shows you understand your own result. Tie each limitation to its likely effect ('the model ignores wind, which would increase heat loss, so energy figures are likely underestimates').

Explain it another way: intuitive

A manuscript is a guided tour of your experiment: here is why, here is exactly what I did, here is what happened, here is what I think it means and where I might be wrong.

Explain it another way: technical

IMRaD structure (Introduction, Methods, Results and Discussion). Reproducibility package: code, configuration, seeds, raw data, scripts that regenerate every figure. Version identifiers for all software.

Explain it another way: applied

Engineering organisations use the same structure in test reports and design review packages; a review board reads the summary and the key figure first, then checks the method behind any number it doubts.

Try these examples

Example 1

Rewrite: 'We made the elevator much smoother.'

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 element is essential in an engineering abstract?

  • A thank-you to everyone who helped
  • The key quantitative result with its uncertainty
  • A list of every parameter
  • A joke to hook the reader

2. Which is the best test of a methods section?

  • It is long
  • Another person can reproduce your main result using only it (and your code)
  • It uses technical words
  • It mentions the software name

3. Your simulated results show 14% energy saving on five nights. Which claim is appropriate?

  • Our controller will cut every greenhouse's energy bill by 14%
  • In simulation over five nights, the controller used 14% less energy than a tuned thermostat
  • Our controller is the most efficient possible
  • Energy saving is guaranteed

4. You repeat a measurement n = 25 times. The sample standard deviation is s = 3.5 W. Using the normal approximation (z = 2.576 for 99%), what is the half-width of the 99% confidence interval for the mean, in W? (3 significant figures.)

Answer: W

Apply it

Draft the abstract (≤ 200 words) and methods section of your term project report now, before the final results, with placeholders for numbers. Swap with a classmate and try to reproduce each other's setup from the methods alone.

Reflect

What is one claim you've read recently that was stronger than its evidence?

Figures that tell the truth, including the uncertainty

Two bars, one taller. Are those error bars standard deviations, standard errors or 95% intervals? Your reader can't tell, and it changes everything.

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

Why it matters

Most readers look at the figures first. A good figure lets them judge your claim in seconds; a careless one can make a 1% noise blip look like a breakthrough.

Goals

Predict

Two means with 95% confidence intervals that overlap slightly. Is the difference definitely not real?

  1. Yes: overlapping intervals mean no difference
  2. No: intervals can overlap a little even when the difference itself is clearly non-zero
  3. Yes, always
  4. Overlap means the data are wrong

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

Discover

Treat the 20 intervals as a figure. Change n and the confidence level and ask: what would a reader conclude from one interval alone? Then write the caption you would need for this exact figure (what the bars are, n, σ, the true value).

What the interactive shows, in words

The coverage simulator draws 20 confidence intervals as bars around a true value of 50, marking misses. It shows that any single interval may miss, that bars shrink as n grows and widen with confidence level, and therefore that a figure's caption must state what the bars are, the sample size and the method.

Understand

Show the data when you can

With fewer than about 30 points per group, plot every point (a dot or strip plot) with the mean or median and its interval on top. Bar charts hide the distribution and can hide outliers, two-hump shapes and tiny samples. For many runs, histograms, box plots or violin plots show the shape.

Say what the bars are

SD shows run-to-run spread; SE shows uncertainty of the mean; a 95% CI is about twice the SE. The same data can look decisive or hopeless depending on which you draw. The caption must say which, plus n, the conditions and the statistic (mean or median).

Axes and comparisons

Bar charts should start at zero, because bar length encodes value. Point plots may zoom in, but mark the axis clearly. Put compared conditions next to each other on the same axis. For ratios such as speed-ups, a log axis treats 2× faster and 2× slower symmetrically.

No cherry-picking

Show all runs or say exactly which were excluded and why (the rule set in advance). Don't choose the seed or the run that looks best. If you show an example time series, say how it was chosen ('first run' or 'median run'). A figure regenerated from a script with a fixed seed can be checked by anyone.

Explain it another way: intuitive

A figure is a witness. It should tell the whole truth, including how unsure it is, in a way that even a hurried reader can't misread.

Explain it another way: technical

Caption checklist: what is plotted, units, n per group, centre statistic, error-bar definition (SD, SE, CI and its level), conditions, data source or script, any exclusions.

Explain it another way: applied

Many journals now require that bar charts of small samples be replaced by plots showing individual data points, after studies showed bar charts often concealed very different underlying data.

Try these examples

Example 1

Write a caption for a plot of energy per night for P, PI and thermostat controllers.

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 figure shows error bars but the caption doesn't say what they are. Why is that a problem?

  • It isn't
  • SD, SE and 95% CI differ by large factors, so readers can't judge the uncertainty
  • Error bars are decoration
  • Readers will assume SD

2. A plot shows SD bars of ±6 ms for n = 36 runs. What is the 95% CI half-width for the mean (z = 1.96), in ms?

Answer: ms

3. A bar chart of speed-up starts its y-axis at 0.95, making 1.02 look twice the height of 0.99. What's wrong?

  • Nothing: it shows detail
  • Bar length encodes value, so a truncated axis exaggerates differences
  • The axis should start at 1.0
  • Speed-ups can't be plotted

4. You repeat a measurement n = 25 times. The sample standard deviation is s = 3.5 W. Using the normal approximation (z = 2.576 for 99%), what is the half-width of the 99% confidence interval for the mean, in W? (3 significant figures.)

Answer: W

Apply it

Make the main figure for your term project from a script with a fixed seed. Write its full caption using the checklist. Ask a classmate what they conclude from the figure alone; if it differs from your conclusion, fix the figure.

Reflect

Which of your past charts would change most if you added honest uncertainty?

Reviewing and revising: answer the critic

A reviewer writes: 'The 1.6× speed-up is probably an artefact of your method.' How do you find out whether they are right?

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

Why it matters

Review is how engineering catches mistakes before they reach hardware, users or the public. Learning to give a useful review, and to take one without defensiveness, is a core professional skill.

Goals

Predict

A reviewer suspects your benchmark is unfair. What's the strongest response?

  1. Explain why you're confident
  2. Re-run with the reviewer's suggested controls, report the new numbers, and change the claim if needed
  3. Remove the benchmark from the paper
  4. Ignore it

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

Discover

The checker opens in a flawed configuration: that's the study under review. Write three reviewer comments based on the checklist. Then act as the author: fix each issue, record the speed-up and interval after each fix, and draft one line of response per comment.

What the interactive shows, in words

The benchmark checker opens with 5 repeats, no warm-up, blocked order and a smaller input for B, giving an inflated speed-up with a wide interval and four failed checks. The learner writes reviewer comments from the failed checks, then fixes each in turn and records how the speed-up and interval change, ending near the true 1.29 with a narrow interval.

Understand

A reviewer's checklist

Is the question clear? Are the metrics defined before testing? Is the baseline fair and well tuned? Are conditions matched (input, build, environment, order)? Enough repeats, and uncertainty reported? Exclusions pre-specified? Do conclusions match the evidence, including its scope? Are limitations stated? Could someone reproduce it?

Useful comments

Be specific, actionable and kind. Not 'the method is bad' but 'runs are blocked (all A then all B); drift could bias B. Please interleave or randomise the order and report whether the speed-up changes.' Separate major issues (could change the conclusion) from minor ones (clarity, typos).

The response letter

Quote each comment, then reply: what you did, what you found, where the manuscript changed. Agree where they are right. Where you disagree, give evidence or reasoning, not tone. A table of before-and-after numbers is often the clearest answer to a methodological concern.

Revising honestly

If a fix shrinks your result (1.6× becomes 1.29×), the revised claim is 1.29×, and the response says so. Keep the history: version your manuscript and results so anyone can see what changed and why. Changing results to fit the story, or quietly dropping a criticised analysis, breaches research integrity.

Explain it another way: intuitive

A reviewer is a friend who checks your parachute before you jump. Thank them, then check the straps they pointed at.

Explain it another way: technical

Threats to validity: internal (confounders, order effects), construct (does the metric measure what you claim?), external (does it generalise beyond the tested conditions?), statistical (power, multiple comparisons).

Explain it another way: applied

Formal design reviews in engineering projects work the same way: reviewers raise action items, the team closes each with evidence, and the review board checks the closures before the design moves on.

Try these examples

Example 1

Comment: 'B was tested on a smaller input.' Write the response line.

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 reviewer comment is a major issue?

  • Figure 2's font is small
  • The baseline wasn't tuned, while the new design was tuned for a week
  • There's a typo in the abstract
  • Reference 4 lacks a page number

2. Which is the best response to 'the improvement may come from drift'?

  • We disagree; our lab is very stable.
  • We interleaved runs and re-measured: the speed-up changed from 1.31 to 1.29 [1.25, 1.34]; drift had little effect. Methods updated.
  • Thank you for the comment.
  • We removed the speed-up claim.

3. Baseline mean = 24 ± 0.48 ms and optimised mean = 13.3 ± 0.27 ms (each ± is a standard error, independent). The speed-up S = baseline ÷ optimised. What is the standard uncertainty of S? (3 decimal places.)

Answer: ×

4. After revisions your effect shrinks below your decision threshold. What should the revised manuscript do?

  • Keep the original number in the abstract
  • Report the revised result and conclusion, and explain the change
  • Drop the experiment
  • Use a different seed until it passes

Apply it

Exchange draft term-project reports with a classmate. Write a review using the checklist (at least two major and two minor comments), then write a point-by-point response letter to the review you receive.

Reflect

Which comment you received was hardest to accept, and what did addressing it change?

Week 36: Systems engineering showcase

This week you will

Plan the capstone: requirements, metrics, baselines and budgets

Your capstone has a few weeks and one laptop. What will you claim at the end, and how will you know if it's true?

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

Why it matters

The year capstone asks for a quantitative, reproducible systems engineering investigation with a fair baseline and honest limitations. Everything in this term (uncertainty, optimisation, budgets, benchmarking, writing) is a tool for that plan.

Goals

Predict

Which capstone question is best scoped?

  1. Make the best robot controller ever
  2. Does adding integral action to the lift's levelling controller reduce settling error at full load by at least 50% versus P-only, within the comfort limits, in simulation?
  3. Study elevators
  4. Prove PID is always optimal

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

Discover

Use the trade-off lab as a project-selection tool: score candidate capstone ideas against criteria such as feasibility in the time available, measurability, novelty to you, and risk. Change the weights and see which ideas stay on the Pareto front.

What the interactive shows, in words

The trade-off lab scores options against weighted criteria and marks which are non-dominated. Used for project selection, it shows which capstone ideas remain sensible under different priorities, such as weighting feasibility more heavily than novelty.

Understand

From idea to question

Pick a system you can model and measure (a Build, a simulator, a small program). Write one question with: the change, the metric, the baseline, the conditions and a threshold that would count as success. Screen ideas against hard constraints (time, tools available, safety: browser-based only) before ranking the rest.

Assumptions and metrics first

List the modelling assumptions and the expected effect of each ('no wind: energy likely underestimated'). Define metrics and how they're computed before any test. Decide the uncertainty method (repeats with CI, Monte Carlo over inputs) and the number of runs from the precision you need.

Baseline and ablation plan

Choose the strongest simple baseline and tune it fairly. If your design has several parts, plan the ablation rows now. Pre-register your decision rule in your project log with a date, so you can't move the goalposts later.

Budget the project itself

Treat your time like a mission budget: estimate each task, add contingency (first projects overrun), and keep margin. Plan a minimum viable result by the midpoint, then extensions. Decide in advance what you'll cut if you fall behind. Reproducibility tasks (scripts, seeds, README) go in the budget, not at the end.

Explain it another way: intuitive

Before a long journey you pick the destination, check the map, pack the essentials, set a turnaround time and leave spare fuel. A capstone plan is the same.

Explain it another way: technical

Plan contents: question, hypothesis, system and version, assumptions, independent and controlled variables, metrics, baseline, statistics, decision rule, ablations, schedule with contingency, risks, reproducibility package.

Explain it another way: applied

Space missions pass formal milestones (concept, preliminary design, critical design) where reviewers check exactly these things: requirements, budgets with margins, verification plans and risks.

Try these examples

Example 1

Budget: 30 hours available. Estimates: setup 4, baseline 5, design 8, experiments 6, write-up 5. Contingency 20%. Margin?

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 element is missing from: 'Does PI control reduce greenhouse energy use?'

  • A system
  • A baseline, metric definition, conditions and success threshold
  • A question mark
  • Nothing

2. A lander power budget has current best estimates of 51 W, 16 W, 14 W, 50 W. Policy adds 30% contingency to the total. The power system can supply 138 W. Margin = (capability − estimate with contingency) ÷ (estimate with contingency) × 100. What is the margin, in %? (1 decimal place; negative means over budget.)

Answer: %

3. A sensor's readings have standard deviation σ ≈ 4 units. How many repeated readings n do you need so that the 95% confidence interval for the mean has a half-width of at most 1.5 units? Use z = 1.96 and round n up to a whole number.

Answer: readings

4. Why write your decision rule in your log before running experiments?

  • It's required by law
  • So the threshold can't drift to fit the results you got
  • To save time later
  • It makes the experiment faster

Apply it

Write your one-page capstone plan using the headings above: question, assumptions, metrics, baseline, uncertainty method, decision rule, ablations, time budget with margin, and what you'll cut first.

Reflect

What would make you change your capstone question halfway through, and how would you document it?

Present the evidence, defend the method, own the limits

'How do you know it wasn't just the random seed?' You have thirty seconds. What do you show?

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

Why it matters

The showcase is where your evidence meets other people's questions. A clear presentation and calm, evidence-based answers turn a good investigation into a trusted one.

Goals

Predict

An audience member asks whether your result depends on the seed. What's the best answer?

  1. It doesn't, trust me
  2. We ran 5 seeds; the effect was 14% ± 2% across them. Here is the per-seed table.
  3. Seeds don't matter in simulation
  4. We used the best seed

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

Discover

Do Level 5: ask one autonomy question, change one variable across at least four recorded runs with everything else fixed, and write a short report. Then prepare a three-slide summary: question and method, the main result figure with uncertainty, and limitations.

What the interactive shows, in words

In the rover Build's Level 5 the learner asks one autonomy question (for example how checkpoint spacing changes final error), records at least four runs changing one variable with the route, sol and everything else fixed, and writes a short report. The lesson turns that report into a three-part presentation: method, main result with uncertainty, and limitations.

Understand

Structure the talk

One question. Why it matters (one slide). Method in a diagram: system, change, baseline, metrics, runs. The main result: one figure with uncertainty and a one-sentence takeaway. Ablation or sensitivity. Limitations and what you'd do next. End with the claim stated at exactly its evidential strength.

Anticipate the questions

Typical questions: Is the baseline fair? How many runs, and does the seed matter? What did you assume, and what if it's wrong? How sensitive is the result to the main parameter? Would it hold on real hardware? Prepare a backup slide for each. 'I don't know, but here's how I'd find out' is a strong answer.

Sensitivity as a defence

Show how the result changes when key assumptions or parameters change: a ±20% change in heat-loss coefficient, a different load, a different seed set. If the conclusion survives, it's robust. If it flips, say so: that is itself a result about where the design works.

The reproducibility package

Code with a README, fixed versions, seeds and parameters in a config file, raw results, and one script that regenerates every figure and table. Test it on a fresh copy before submitting. This is the final requirement of the year capstone, and it's what lets others build on your work.

Explain it another way: intuitive

Presenting is telling the story of a careful experiment; defending is showing you looked for ways it could be wrong before anyone else did.

Explain it another way: technical

Robustness checks: seed variation, parameter sensitivity (one-at-a-time or Monte Carlo), alternative metrics, alternative baselines. Report each as a table row with its interval.

Explain it another way: applied

Engineering review boards often ask presenters to show the raw data behind a headline number; teams that can pull it up immediately earn trust quickly.

Try these examples

Example 1

Question: 'Would your controller still beat the thermostat if heat loss were 20% higher?' You ran a sensitivity sweep. Answer in two sentences.

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 is the best one-sentence takeaway for a results slide?

  • Results were good.
  • Checkpoint spacing of 5 steps cut final position error from 2.4 m to 0.6 m [0.4, 0.8] across 5 sols, with no extra energy.
  • See the graph.
  • Autonomy is important.

2. You're asked about a condition you didn't test. What's best?

  • Guess confidently
  • Say you didn't test it, give your expectation with reasoning, and say how you'd test it
  • Change the subject
  • Claim it works

3. You repeat a measurement n = 25 times. The sample standard deviation is s = 2.5 °C. Using the normal approximation (z = 1.96 for 95%), what is the half-width of the 95% confidence interval for the mean, in °C? (3 significant figures.)

Answer: °C

4. Baseline mean = 24 ± 0.72 ms and optimised mean = 10 ± 0.4 ms (each ± is a standard error, independent). The speed-up S = baseline ÷ optimised. What is the standard uncertainty of S? (3 decimal places.)

Answer: ×

Apply it

Rehearse your capstone talk for a classmate who asks the five typical questions. Afterwards, add a backup slide for any question you couldn't answer with evidence, and test your reproducibility script on a fresh copy of your project.

Reflect

Looking back across the term, which tool (intervals, propagation, Pareto fronts, budgets, fair benchmarks) changed how you judge engineering claims most?