A
accumulation function
The running total of a quantity from a fixed start: for each moment x, how much has built up since the start. The distance fallen by time x is the accumulation function of the speed.
Example: For the apple's speed 9.8t, A(x) = 4.9x²: 1.225 m after 0.5 s, 4.9 m after 1 s, 19.6 m after 2 s.
ⓘ Technical definition
For f and a fixed a, A(x) = ∫ₐˣ f(t) dt. A(a) = 0, and when f is continuous A is differentiable with A′(x) = f(x).
→ First introduced in: The fundamental theorem of calculus
Activation function
A transformation applied after a network layer that introduces non-linearity, allowing the network to learn complex patterns beyond simple straight-line relationships.
ⓘ Technical definition
A non-linear function f applied element-wise to a layer's output; without it, stacked linear layers collapse to a single linear map. Common choices: ReLU, sigmoid, tanh, softmax.
antiderivative
A function whose derivative is the given one: undo the differentiation. A function has many antiderivatives, which differ only by a constant.
Example: t³ is an antiderivative of 3t², and so is t³ + 5; −cos t is an antiderivative of sin t.
ⓘ Technical definition
F is an antiderivative of f on an interval when F′(x) = f(x) for every x in it. If F and G are both antiderivatives, F − G is constant.
→ First introduced in: The fundamental theorem of calculus
Argument (input)
The value you hand to a function, written inside the brackets. In len(words), the list words is the argument — the input the tool works on.
Example: In sorted(words), words is the argument handed to sorted.
ⓘ Technical definition
A value passed to a function call, bound to the function's parameter for that call. Passed by position or by keyword; inside the body the parameter name stands in for whatever value was supplied.
→ First introduced in: Calling a function — a tool with an input and an output
C
central difference
A finite difference that looks both ways: the change in a function from one small step behind to one small step ahead, divided by the two steps. It is far more accurate than the forward difference.
Example: For x³ at 2 with h = 0.1: (2.1³ − 1.9³) ÷ 0.2 = 12.01; the derivative is 12.
ⓘ Technical definition
(f(x + h) − f(x − h)) ÷ 2h; its error is about (h²/6) f‴(x), proportional to h², because the h terms cancel.
→ First introduced in: The derivative as a rate of change
Chain rule
The rule of calculus for the derivative of a function of a function: the derivative of a composite is the product of the derivatives, the outside one taken at the inside value. Rates multiply along a chain of steps, which is also how a neural network works out how changing an early setting changes the final result.
Example: sin(x²) has derivative cos(x²) × 2x; e^(−x) has derivative −e^(−x).
ⓘ Technical definition
If y = f(g(x)), then dy/dx = f′(g(x)) g′(x), or dy/dx = (dy/du)(du/dx) with u = g(x). Backpropagation applies the chain rule through each layer's computation graph to compute parameter gradients in O(parameters) time.
→ First introduced in: Rules of differentiation: sin, cos, exp and the chain rule
Closure
A function that remembers variables from the place it was defined, even after that outer function has finished running.
ⓘ Technical definition
A nested function that captures free variables from an enclosing scope by reference (via __closure__ cells); the captured bindings outlive the enclosing call, and `nonlocal` allows rebinding them.
→ First introduced in: Closures & first-class functions
composite function
A function of a function: do one function, the inside function, then apply a second one, the outside function, to its result.
Example: sin(2x) is the sine of 2x: first double, then take the sine.
ⓘ Technical definition
(f ∘ g)(x) = f(g(x)): g is the inside function, f the outside. Its derivative is given by the chain rule, f′(g(x)) g′(x).
→ First introduced in: Rules of differentiation: sin, cos, exp and the chain rule
continuous function
A function whose value at each point is exactly what the nearby values head for: no holes and no jumps. Over an interval its graph is one unbroken curve.
Example: Every polynomial, sin x, cos x and eˣ are continuous everywhere.
ⓘ Technical definition
f is continuous at a when f(a) is defined, lim f(x) as x → a exists, and the two are equal. Sums, products, quotients (where defined) and composites of continuous functions are continuous.
→ First introduced in: Limits of functions and continuity
Coroutine
A function that can pause and resume, returned by an `async def` — the unit of work an event loop runs.
ⓘ Technical definition
An awaitable produced by calling an `async def`; it suspends at each `await`, preserving local state, and is driven to completion by the event loop (directly awaited or wrapped in a Task). Distinct from generators though built on similar machinery.
→ First introduced in: The event-loop mental model
cross-functional translation
Treating friction between different professions as a language problem: making your constraints understandable in the other side's terms, instead of assuming bad faith.
Example: "The certificate expires Friday" means nothing to a deputy head - "if we don't act by Thursday, staff can't log in on Monday" is the same fact, translated.
ⓘ Technical definition
The collaboration move of restating one discipline's constraints in another's decision currency (deadline risk, cost, user impact), plus shared artifacts both sides can point at. Reframes most cross-functional conflict as untranslated context rather than opposed interests.
→ First introduced in: Cross-Functional Friction — Translating Between Worlds
D
Decorator
A wrapper you place above a function (with @name) that adds behaviour — logging, timing, caching — without changing the function's own code.
ⓘ Technical definition
A callable taking a function (or class) and returning a replacement, applied via @ syntax: f = decorator(f). Used for cross-cutting concerns; functools.wraps preserves the wrapped callable's metadata.
→ First introduced in: Decorators from scratch
Decorator factory
A decorator you can configure with arguments — like @retry(times=3) — written as a function that returns a decorator.
ⓘ Technical definition
A function that takes configuration and returns a decorator (three levels: factory -> decorator -> wrapper). @deco(arg) calls the factory first, then applies its returned decorator to the target.
→ First introduced in: Parametrised & class-based decorators
def (define a function)
The word that starts your own function: def greet(name): defines a tool called greet that takes one input. The indented lines under it are the work it does.
Example: def word_length(word): return len(word) defines a reusable tool.
ⓘ Technical definition
The statement that binds a new function object to a name. The header def name(params): is followed by an indented body; return hands a value back. Defining does not run the body — calling name(...) does.
→ First introduced in: Writing your own tiny function
derivative
The rate at which a quantity changes at one instant: the limit of its average rates of change over shrinking intervals. On a graph it is the slope of the tangent line.
Example: The derivative of x² is 2x; a stone at 4.9t² metres has speed 9.8t m/s.
ⓘ Technical definition
f′(a) = lim (f(a + h) − f(a)) ÷ h as h → 0, when the limit exists; also written dy/dx or df/dx. As a function of a it is the derived function f′.
→ First introduced in: The derivative as a rate of change
Design by contract
Writing code around explicit promises: what a function requires of its caller (preconditions) and what it guarantees in return (postconditions).
ⓘ Technical definition
A methodology specifying preconditions, postconditions, and invariants as part of an interface's contract; violations are programming errors (often asserted), distinct from expected runtime failures handled defensively.
→ First introduced in: Defensive vs contract style
differentiable function
A function that has a derivative at a point, or at every point of an interval: its graph has a definite slope there, with no corner or jump.
Example: |x| is continuous at 0 but not differentiable there: its chords have slope 1 on the right and −1 on the left.
ⓘ Technical definition
f is differentiable at a when lim (f(a + h) − f(a)) ÷ h as h → 0 exists. Differentiable at a implies continuous at a, not conversely.
→ First introduced in: The derivative as a rate of change
discontinuity
A point where a function fails to be continuous: it has a hole there, or a jump, or no limit at all.
Example: The step that is 0 below 0 and 1 from 0 on has a jump discontinuity at 0.
ⓘ Technical definition
A point a where f(a) is undefined, lim f(x) as x → a does not exist, or the two differ. A hole whose limit exists is removable by defining f(a) as the limit.
→ First introduced in: Limits of functions and continuity
domain of a function
The inputs a function accepts: the numbers you may put in and get an output back.
Example: f(x) = 1/x has every real number except 0 as its domain.
ⓘ Technical definition
For f: D → ℝ, the set D. A formula's natural domain leaves out the inputs where it is undefined, such as a zero bottom or the square root of a negative number.
→ First introduced in: Limits of functions and continuity
F
Fixture
In pytest, a reusable piece of test setup — a sample object, a temp folder, a connection — that tests request by name and that cleans itself up.
ⓘ Technical definition
A pytest @pytest.fixture function supplying test dependencies via dependency injection (requested by parameter name). Supports scope (function/class/module/session), teardown via yield, composition, and autouse.
→ First introduced in: Fixtures & parametrisation
forward difference
A finite difference that looks only ahead: the change in a function over one small step forward, divided by the step. Its error shrinks in proportion to the step.
Example: For x³ at 2 with h = 0.1: (2.1³ − 2³) ÷ 0.1 = 12.61; the derivative is 12.
ⓘ Technical definition
(f(x + h) − f(x)) ÷ h for a fixed small h > 0; its error is about (h/2) f″(x), proportional to h.
→ First introduced in: The derivative as a rate of change
Function
A rule that takes a number (or list of numbers) as input and produces a number (or list) as output — like a recipe that always gives the same result for the same ingredient.
ⓘ Technical definition
A mapping f: X → Y. In ML, activation functions are applied element-wise to tensors: f(x)ᵢ = f(xᵢ). Composition f ∘ g means first apply g, then f.
Function (code)
A tool you hand a value and it hands one back — like len(words) or sorted(words). You call it by writing its name and putting the input in brackets: name(input). (In maths, 'function' means a rule f(x); in code it is a reusable block you call.)
Example: len(words) calls the len function on the list words.
ⓘ Technical definition
A named, reusable block of code called with name(args). Built-ins (len, sorted, sum) and user-defined functions (def) share one calling syntax; a call evaluates the body and yields the returned value.
→ First introduced in: Calling a function — a tool with an input and an output
functools.wraps
A helper used inside a decorator so the wrapped function keeps its original name, docstring, and signature instead of showing the wrapper's.
ⓘ Technical definition
A decorator (functools.wraps, built on update_wrapper) that copies __name__, __doc__, __qualname__, __wrapped__, and __dict__ from the wrapped function to the wrapper, so introspection and help() report the original.
→ First introduced in: Decorators from scratch
fundamental theorem of calculus
Adding up a rate of change gives back the total change. So the area under a curve can be found from any function whose derivative is the curve, without slicing.
Example: The area under one arch of sin t, from 0 to π, is (−cos π) − (−cos 0) = 2.
ⓘ Technical definition
If f is continuous on [a, b] and F is any antiderivative of f, then ∫ₐᵇ f(t) dt = F(b) − F(a); and the accumulation function A(x) = ∫ₐˣ f(t) dt satisfies A′(x) = f(x).
→ First introduced in: The fundamental theorem of calculus
I
inside function
In a function of a function, the one applied first; its result is fed to the outside function.
Example: In sin(2x) the inside function is 2x, with derivative 2.
ⓘ Technical definition
In f(g(x)), g is the inside function. The chain rule multiplies the outside function's derivative, taken at g(x), by the inside function's derivative g′(x).
→ First introduced in: Rules of differentiation: sin, cos, exp and the chain rule
intermediate value theorem
The promise that a continuous function which starts below zero and ends above it, or the other way round, crosses zero somewhere in between.
Example: x³ − x − 1 is −1 at 1 and 5 at 2, so it has a root between them, about 1.3247.
ⓘ Technical definition
If f is continuous on [a, b] and f(a) < 0 < f(b), there is c in (a, b) with f(c) = 0; more generally f takes every value between f(a) and f(b). Proved by bisection and the completeness of ℝ; false in ℚ and false without continuity.
→ First introduced in: Limits of functions and continuity
P
period
The length of one repeat of something that repeats: the step after which a periodic function comes back to the same values, or the time one full turn or swing takes. For a repeating decimal, it is the length of the block of digits that repeats: 1/7 = 0.142857142857… has period 6.
Example: Sine has period 2π; the Moon's period round the Earth, measured against the stars, is 27.32 days.
ⓘ Technical definition
The smallest T > 0 with f(x + T) = f(x) for all x. For a steady circular motion, the time of one revolution: T = 2π / ω.
→ First introduced in: Sine, cosine and the unit circle
periodic function
A function that repeats itself: after a fixed step, its values come round again exactly as before.
Example: sin(θ + 2π) = sin θ for every angle θ.
ⓘ Technical definition
f is periodic with period T > 0 when f(x + T) = f(x) for every x. Sine and cosine are periodic with period 2π.
→ First introduced in: Sine, cosine and the unit circle
Policy (RL)
The agent's strategy: a rule mapping each situation to an action (or a probability over actions). The thing reinforcement learning ultimately learns. '(RL)' distinguishes it from a governance policy.
ⓘ Technical definition
A function pi(a|s) from states to actions (deterministic) or action distributions (stochastic). Value-based methods derive it greedily from values; policy-gradient methods learn it directly. Not a governance/compliance policy.
→ First introduced in: From Values to Policies
Position
Where a body is: its distance from a chosen starting point, along a chosen direction, in metres. The same instant can be described from different starting points, so the choice is written down once and kept.
Example: An apple 0.2 m below the hand is also 1.5 m above the floor: the same position, from two starting points.
ⓘ Technical definition
The coordinate x(t) of a body relative to an origin and an axis (in the plane or in space, a position vector r(t)). Kinematics describes a motion as position given as a function of time.
→ First introduced in: Where, how fast, how fast faster: position, velocity and acceleration
position vector
The arrow from a fixed origin to where a point or a body is. Its components are the point's coordinates, so giving the position vector says exactly where the point is.
Example: The point (3, 4) has position vector (3, 4), an arrow 5 long from the origin.
ⓘ Technical definition
r = (x, y) or (x, y, z), the vector from the origin O to the point P. For a moving body r(t) is a function of time; its derivative r′(t) is the velocity.
→ First introduced in: The dot and cross products
Probability distribution
A list of every outcome something can have, with the chance of each; the chances add up to 1.
Example: The distribution of 2d6 gives 7 a chance of 6/36 and 2 a chance of 1/36.
ⓘ Technical definition
A function assigning each outcome of a random variable its probability (for a discrete variable, a probability mass function summing to 1).
→ First introduced in: One die, two dice: the distribution of a roll
product rule
The rule for differentiating a product of two functions: each one's derivative times the other, added.
Example: x sin x has derivative sin x + x cos x.
ⓘ Technical definition
(f g)′ = f′ g + f g′. Picture a rectangle with sides f and g: its area grows by two strips, g Δf and f Δg, plus a corner that vanishes in the limit.
→ First introduced in: Rules of differentiation: sin, cos, exp and the chain rule
Profiling
Measuring where a program actually spends its time or memory, so you optimise the real bottleneck instead of guessing.
ⓘ Technical definition
Instrumented or sampling measurement of runtime cost per function/line (cProfile, py-spy) or allocations (tracemalloc); produces a call/allocation profile to locate hot spots before optimising.
→ First introduced in: Find the hot spot first
R
ReLU
A simple function used inside neural networks: it keeps positive numbers unchanged and turns any negative number into zero. It is the most common activation function in modern networks.
ⓘ Technical definition
Rectified Linear Unit: ReLU(x) = max(0, x). Computationally cheap, sparse (many zeros), and avoids the vanishing gradient problem that affects sigmoid and tanh in deep networks.
Return value (output)
The value a function hands back to you. It does not print itself — you catch it in a variable, like how_many = len(words), to use on the next line.
Example: how_many = len(words) keeps len's return value in how_many.
ⓘ Technical definition
The object a function call evaluates to, produced by a return statement (a function with no return yields None). The caller receives it as the value of the call expression.
→ First introduced in: Calling a function — a tool with an input and an output
Reward model
A model that scores how good an answer is, learned from humans comparing pairs of answers. It turns 'people preferred A over B' into a number a system can optimize - the heart of how LLMs are aligned.
ⓘ Technical definition
A learned function assigning scalar reward to outputs, fit from pairwise human preferences (typically a Bradley-Terry likelihood). In RLHF it supplies the reward signal that a policy-gradient step (e.g. PPO) optimizes the language-model policy against.
→ First introduced in: Reward Models & Preferences
root of a function
An input at which a function's output is 0: a place where its graph meets the horizontal axis.
Example: x³ − x − 1 has a root near 1.3247, between 1 (output −1) and 2 (output 5).
ⓘ Technical definition
A number c in the domain of f with f(c) = 0, also called a zero of f. For a polynomial, a root is a value of x that makes it 0.
→ First introduced in: Limits of functions and continuity
S
Scalar
A single plain number with a size but no direction, like a temperature, a mass or −7, as opposed to a vector, which also has a direction. Multiplying a vector by a scalar stretches or shrinks it. In machine learning the temperature and the learning rate are scalars, beside the lists (vectors) and tables (matrices) of numbers.
ⓘ Technical definition
An element of ℝ, a rank-0 tensor. Scalar multiplication, written kv with the scalar beside the vector, scales every component of v by k, and its magnitude by |k|. Scalars arise as outputs of dot products, norms and loss functions.
→ First introduced in: Vectors: magnitude, direction and components
sequence
An endless list of numbers in order: a first, a second, a third, and so on, written a₁, a₂, a₃, ….
Example: 1, 1/2, 1/3, 1/4, … is the sequence aₙ = 1/n.
ⓘ Technical definition
A function from the positive integers (or ℕ) to a set of numbers, n ↦ aₙ, written (aₙ). It is increasing when aₙ ≤ aₙ₊₁ for every n, and bounded above when some number exceeds every term.
→ First introduced in: The real line: sequences, limits and completeness
Sigmoid
A function that squeezes any number into a range between 0 and 1, making it useful for outputs that represent probabilities.
ⓘ Technical definition
σ(x) = 1 / (1 + e^{−x}). Saturates at 0 and 1 for large |x|, causing near-zero gradients (vanishing gradient problem) in deep networks.
signed area
Area that counts as positive above the axis and negative below it, so the two can cancel. It is what an integral measures when the function goes negative.
Example: A lift rising at 2 m/s for 10 s and descending at 1.5 m/s for 8 s: signed area 20 − 12 = 8 m (its displacement); unsigned 32 m (the distance travelled).
ⓘ Technical definition
∫ₐᵇ f(t) dt = (area where f > 0) − (area where f < 0). The integral of |f| gives the unsigned total.
→ First introduced in: The integral as accumulation