A derivative is a sensitivity
Worked examples
Read the claim, then run it and check the machine agrees. One at a time — nothing here is taken on trust.
import math
r, t, notional = 0.042, 5.0, 100e6
pv = lambda rate: notional * math.exp(-rate * t) # a 5y promise of $100M
base = pv(r)
h = 1e-4 # one basis point
bump = pv(r + h) - base # bump and revalue
analytic = -t * base * h # f'(r)*h, by calculus
print(f"PV = ${base:,.2f}")
print(f"bump-and-revalue = ${bump:,.2f} per +1bp")
print(f"analytic f'(r)*h = ${analytic:,.2f}")
print(f"gap = ${bump - analytic:,.2f} (1/2 f'' h^2 = ${0.5 * t**2 * base * h**2:,.2f})")
A 1bp rate move costs about $40,500 on this one promise — that single number is what a desk calls the position's DV01. Notice the bump and the analytic answer disagree by $10.13, and the second-order Taylor term ½f″h² predicts that gap to the cent. The error of a straight-line estimate isn't mysterious noise; it's the next term of the expansion, waiting to be read.
import math
x = 0.05
f = lambda u: math.exp(-u)
fprime = -math.exp(-x)
print(" h error error/h^2")
for h in (1e-1, 1e-2, 1e-3, 1e-4, 1e-5):
err = abs(f(x + h) - f(x) - fprime * h)
print(f"{h:8.0e} {err:.3e} {err / h**2:.6f}")
print(f"limit = 0.5 * f''(x) = {0.5 * math.exp(-x):.6f}")
Each factor of 10 off h knocks two zeros off the error — that's the h² law. And the ratio error/h² doesn't vanish; it converges to ½f″(x) ≈ 0.475615. First-order error is the second-order term. Once you've seen this table you can predict a bump system's accuracy without running it.
import math
x = 0.05
f = lambda u: math.exp(-u)
fprime = -math.exp(-x)
for h in (1e-6, 1e-7, 1e-8, 1e-9):
err = abs(f(x + h) - f(x) - fprime * h)
print(f"h = {h:.0e} error/h^2 = {err / h**2:.4f}")
print(f"(the law says all rows should read {0.5 * math.exp(-x):.4f})")
Down to h = 1e-6 the ratio still reads ≈ 0.4756. At 1e-7 it wobbles, at 1e-8 it's off by 50%, at 1e-9 it's garbage. Nothing is wrong with Taylor — f(x+h) and f(x) now agree in ~15 of their 16 significant digits, and the subtraction hands you the leftovers. Smaller h is not always better: real bump systems pick h in the safe middle (1bp is popular) precisely because of these two cliffs.
Check the concept
One question at a time. Unsure? Revisit the lecture, then answer.
The challenge
Pass the quiz to unlock the challenge — your code will still be waiting here.