TactivergeLite

Lite / Textbooks / The Mathematics of Machines / Chapter 2

2. Functions as models

Version 1 · Technically checked (automated checks only) · 3 source lessons · Full interactive version

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.

Figure 2.1. Three families, three shapes (described in words)

Three small graphs on the interval 0 to 2. A straight line y = x rises steadily. A power law y = x^2 starts flat and curves upward to 4. An exponential decay y = e^(−x) starts at 1 and falls towards zero, reaching about 0.14 at x = 2.

Explanation

Built from 3 School lessons. Each part is the lesson's own explanation.

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

Open the Lite lesson: Functions as engineering models

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
  1. Power law: y = k·xⁿ. Take natural logs of both sides: ln y = ln k + n·ln x.

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

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

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

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

Common mix-ups

Open the Lite lesson: Power laws and exponentials

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

Open the Lite lesson: Sinusoids: models that repeat

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, in words

Figure 2.2 from Functions as engineering models

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.

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.

The interactive versions are in the full chapter.

Laboratory

These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.

Practice

Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.

  1. A sensor obeys V = 0.01·T + 0.5 volts (T in °C, valid 0–100 °C). What voltage does it give at 37 °C?
    Answer it in “Functions as engineering models”
  2. 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?
    Answer it in “Functions as engineering models”
  3. Drag F = 0.4·v² newtons (v in m/s). What is the drag at 15 m/s?
    Answer it in “Power laws and exponentials”
  4. V = 9·e^(−t/1.5) volts. How long until V = 4.5 V, in seconds?
    Answer it in “Power laws and exponentials”
  5. You plot ln(y) against x and get a straight line with slope −0.4. What model fits?
    Answer it in “Power laws and exponentials”
  6. What is the angular frequency ω of a 50 Hz supply, in rad/s?
    Answer it in “Sinusoids: models that repeat”
  7. A tide model is h(t) = 1.8·sin(2πt/12.4 + 0.6) metres with t in hours. What is its frequency in cycles per day?
    Answer it in “Sinusoids: models that repeat”

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)

Streaming video uses a lot of data. Everything you need is in the text.

Summary

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/τ). Field Guide
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. Field Guide
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. Field Guide
Linear interpolation
Linear interpolation estimates a value between two known points by assuming a straight line between them. 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

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

References

Further reading from the lessons

← 1. Algebraic modelling3. Trigonometry and periodic motion →