TactivergeLite

Lite / Engineering Complex Systems / Week 1

Functions as engineering models

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

About 35 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

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

Predict

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

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

The equation will happily give 75 N, but it was only checked up to 0.10 m. Past its elastic limit a spring yields and the straight line breaks down. A model is a function plus its domain: outside the tested range, it is a guess.

Discover

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

What the interactive shows (text version)

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

You can also open the interactive on the full site when you have a faster connection.

Watch (optional)

Watch for: Listen for the two functions the lecturer pairs up (distance and speed) and how each one tells you about the other. That pairing is the whole term.

A university lecturer's short overview of how a function and its rate of change are two views of one thing.

“Big Picture of Calculus” by MIT OpenCourseWare (opens YouTube; streaming video uses a lot of data)

The video is optional. Everything you need is in this lesson's text.

Understand

A model is a function with a job

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

Domain: where the model is allowed to speak

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

Residuals judge the shape

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

Explain it another way

Intuitive

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

Technical

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

Mathematical

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

Applied

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

Worked example 1

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

Rearrange: T = (V − 0.5) / 0.01 = 100·(V − 0.5) °C, valid for 0.5 ≤ V ≤ 1.5 V. At 1.2 V: T = 100 × 0.7 = 70 °C, inside the domain.

Worked example 2

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

251 N/m is the stiffness: each extra metre of stretch needs 251 N more (2.51 N per centimetre). −0.1 N is the force at zero stretch; it should be zero physically, so it is a small offset from noise or a zero error in the force gauge.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

V

°C

Practice 3. You fit a straight line to drag force against speed. The residuals are positive at low and high speeds and negative in the middle. What does that tell you?
Practice 4. A fitted model is battery voltage V (V) against time t (h): V = −0.05t + 12.6. What are the units and meaning of −0.05?

V

Apply it

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

Reflect

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

Write your answer on paper or in your own notes. Lite never stores what you write.

Go further

Power laws and exponentials →