Textbooks/The Mathematics of Machines/Chapter 2
2Functions as models
Version 1 · Technically checked (automated checks only) · 3 source lessons · 7 practice items
Introduction
Choosing the right family of function is half of modelling. A spring is linear, drag grows like a power of speed, a cooling cup decays exponentially and mains voltage repeats as a sinusoid. This chapter gives each family a test you can run on data, explains the domain where a model is allowed to speak, and uses residuals to judge whether the shape is right.
Explanation
This chapter is built from 3 School lessons. Each part below is the lesson's own explanation; open the lesson for its predict-and-discover activities.
2.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?
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.
Common mix-ups
- If the equation gives a number, the number is right.
✓ A model is only trustworthy inside the domain where it was tested or derived. - Small residuals mean the right model.
✓ Residuals must also look random. A patterned residual reveals the wrong shape even when its size is small.
2.2 Power laws and exponentials
Double a cyclist's speed and the air pushes back four times harder. Halve a capacitor's charge and it takes the same time to halve again. Two very different curves: how do you tell them apart?
Scaling test for a power law
For y = k·xⁿ, multiplying x by any factor s multiplies y by sⁿ, whatever x you start from. Drag (n = 2): double speed, four times the force. Cylinder volume against radius at fixed height (n = 2). A beam's deflection against length under its own weight (n = 4). The exponent n carries the physics.
Constant-ratio test for an exponential
For y = A·e^(kx), adding a fixed amount to x multiplies y by a fixed ratio. A capacitor V = V₀·e^(−t/τ) loses 63% of its remaining voltage every τ seconds and halves every τ·ln 2. The quantity τ (the time constant) has the units of time and sets the speed of the whole process.
e and the natural logarithm
e ≈ 2.718 is the base for which the exponential's slope equals its value: d/dx eˣ = eˣ. That makes e^(kt) the natural language of anything whose rate of change is proportional to its size. Its inverse is ln: ln(eˣ) = x. You will use both constantly from week 3 on.
Derivation: Why logarithms straighten both families
Power law: y = k·xⁿ. Take natural logs of both sides: ln y = ln k + n·ln x.
So plotting ln y against ln x gives a straight line with slope n and intercept ln k. A log–log plot that is straight means a power law.
Exponential: y = A·e^(kx). Take logs: ln y = ln A + k·x.
So plotting ln y against x (only the y-axis logged) gives a straight line with slope k. A semi-log plot that is straight means an exponential.
Both tricks need y > 0 (and x > 0 for the power law) because the logarithm of zero or a negative number is not defined. That is why the lab refuses log fits on data that cross zero.
Common mix-ups
- Any curve that rises steeply is exponential.
✓ Power laws also rise steeply. Exponentials have a constant ratio per equal step; power laws have a constant ratio per scale factor. - The time constant is the time to reach zero.
✓ An exponential decay never reaches zero. After one τ it is at 37%, after 5τ about 0.7%.
2.3 Sinusoids: models that repeat
The voltage in a wall socket swings from +325 V to −325 V fifty times a second. The harbour tide does the same thing twice a day. One function describes both.
Four parameters, four jobs
y = A·sin(2πft + φ) + c. Amplitude A: the peak swing (325 V). Frequency f in hertz: cycles per second. Phase φ in radians: where in the cycle it starts. Offset c: the level it swings around (zero for mains, mean sea level for tides). Period T = 1/f.
Angular frequency
Inside the sine the angle must be in radians. One cycle is 2π radians, so the angle grows at ω = 2πf radians per second. For 50 Hz, ω = 314 rad/s. You will meet ω constantly: in derivatives of sinusoids (week 3), in vibration and in control.
Why other families fail here
Power laws and exponentials are fitted on log axes, and logs need positive values. A sinusoid with zero offset is negative half the time. More fundamentally, neither family can turn round and come back: a periodic quantity needs a periodic model.
Common mix-ups
- Angles in sin(2πft) can be in degrees.
✓ The 2πf form assumes radians. In degrees you would need 360·f·t instead, and calculus formulas only work in radians. - 230 V mains means the voltage never exceeds 230 V.
✓ 230 V is the rms value; the peak is about 325 V.
Worked examples
Functions as engineering models: 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.
Solution
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.
Functions as engineering models: example 2
A fit to a spring gives F = 251x − 0.1 N. What do 251 and −0.1 mean?
Solution
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.
Power laws and exponentials: example 1
A capacitor discharges as V = 9·e^(−t/1.5) volts. When has it fallen to 4.5 V?
Solution
4.5/9 = 0.5 = e^(−t/1.5). Take logs: −t/1.5 = ln 0.5 = −0.693, so t = 1.5 × 0.693 = 1.04 s. That is the half-life: t½ = τ·ln 2.
Power laws and exponentials: example 2
Drag measurements: 10 N at 5 m/s and 40 N at 10 m/s. Power law or exponential, and what parameter?
Solution
Doubling speed multiplied the force by 4 = 2², consistent with n = 2. Then c = F/v² = 10/25 = 0.4 kg/m. Check: 0.4 × 100 = 40 N.
Sinusoids: models that repeat: example 1
v(t) = 325·sin(2π·50·t) volts. What is v at t = 2.5 ms?
Solution
Angle = 2π × 50 × 0.0025 = 0.785 rad (π/4). sin(π/4) = 0.707, so v = 325 × 0.707 = 230 V. An eighth of a cycle in, the voltage is at 71% of its peak.
Interactive figures
Interactive figure (online). Description: 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.
Laboratory
Everything runs in your browser. No kit, nothing mains-powered. Simulations are simplified educational models.
Equation Lab exploration
Equation Lab: Functions
Switch between the linear, quadratic, sine and exponential families and find which one fits each sample data set.
Open Equation Lab: Functions →Simulation OS experiment
Simulation OS: RC charge and discharge
Measure the capacitor voltage at equal time steps and show the ratio between successive readings is constant.
Open Simulation OS: RC charge and discharge →
Guided practice
Answers are checked on the server; wrong answers get a hint and another try. Signed in, solved items also count towards the source lesson.
- A sensor obeys V = 0.01·T + 0.5 volts (T in °C, valid 0–100 °C). What voltage does it give at 37 °C? (V)
- A fitted model is battery voltage V (V) against time t (h): V = −0.05t + 12.6. What are the units and meaning of −0.05?
- Volts: the voltage at t = 0
- Volts per hour: the voltage falls by 0.05 V each hour
- Hours per volt: the time to lose one volt
- Drag F = 0.4·v² newtons (v in m/s). What is the drag at 15 m/s? (N)
- V = 9·e^(−t/1.5) volts. How long until V = 4.5 V, in seconds? (s)
- You plot ln(y) against x and get a straight line with slope −0.4. What model fits?
- y = A·x^(−0.4)
- y = A·e^(−0.4x)
- y = −0.4x + A
- What is the angular frequency ω of a 50 Hz supply, in rad/s? (rad/s)
- A tide model is h(t) = 1.8·sin(2πt/12.4 + 0.6) metres with t in hours. What is its frequency in cycles per day? (cycles/day)
Engineering applications
Calibrating sensors
A temperature sensor's datasheet gives a linear model over a stated range. Outside that range the same formula still returns numbers, but they are no longer evidence of anything.
Battery and capacitor timing
A capacitor discharging through a resistor follows V = V0·e^(−t/RC). After one time constant RC it has fallen to about 37 % of its starting value, which sets how long a backup supply lasts.
Watch
Optional verified videos. Nothing loads from YouTube until you press play.
- Big Picture of Calculus (MIT OpenCourseWare)
Chapter summary
- Linear: equal steps in x give equal steps in y. Power law: doubling x multiplies y by a fixed factor. Exponential: equal steps in x multiply y by a fixed ratio.
- A model has a domain: the range of inputs where it was checked.
- Residuals (data minus model) should look like random scatter; a pattern means the wrong shape.
- A sinusoid A·sin(ωt + φ) + c has amplitude, angular frequency, phase and offset; ω = 2πf.
Glossary
- Exponential growth and decay
- A quantity decays exponentially when its rate of decrease is proportional to how much is left, giving y = y0 × e^(−t/τ).
- Logarithms and decibels
- A logarithm answers 'what power gives this number?'. Decibels use logarithms to express ratios: 10 log10 for power ratios and 20 log10 for amplitude ratios.
- Frequency and period
- Frequency is how many cycles happen per second; the period is the time for one cycle. Each is the reciprocal of the other.
- Linear interpolation
- Linear interpolation estimates a value between two known points by assuming a straight line between them.
Definitions from the Field Guide.
Project: Which model fits?
Collect or choose a small data set from a real system (a cooling drink, a bouncing ball's peak heights, a phone battery's charge). Apply the three family tests, fit the best family, plot the residuals and state the domain where you would trust the model.
Deliverables
- The data with units and source
- The family tests and their results
- A residual plot
- A one-sentence domain statement
Keep your work in your Engineering Journal; it stays private unless you choose to share it.
References
- Gilbert Strang and Edwin Herman (2016). Calculus Volume 1. OpenStax. Link ↗
- K. A. Stroud and Dexter J. Booth (2013). Engineering Mathematics, 7th edition. Palgrave Macmillan.
Further reading from the source lessons
- OpenStax Calculus Volume 1 (free, open textbook) ↗A complete first-year calculus text with worked examples and exercises, free to read online.
Publication record
- Version
- 1
- Status
- Technically checked (automated checks only)
- Technical review
- Automated checks only, last run 2026-11-29. No human, educator or mentor review is claimed.src/content/textbooks/textbooks.test.ts: schema, every lesson, diagram, practice item, video, Field Guide entry, lab and reference resolves; figure numbers recomputed; no practice answers in client payloads.
- Written by
- Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
- Licence
- All rights reserved by the founders unless a licence is approved.
- Corrections
- None recorded yet.Spotted a mistake? Use “Report a problem” on any chapter, or see the corrections page.