What is Integration?
Integration is differentiation run backwards. If differentiation breaks a journey down into speeds, integration adds the speeds back up into a journey.
Back to the car.
Differentiation took distance and gave you velocity.
Integration goes the other way: give it the velocity at every moment, and it adds it all up to recover the total distance traveled.
That's why we say integration is the reverse of differentiation — you're looking for the function that would have your current one as its derivative.
On a graph, the integral is the area under the curve.
Imagine the velocity curve. The area trapped beneath it — between two points in time — is exactly the distance covered in that stretch. Add up all those thin slivers of area and you get the total.
One quirk: the mystery constant (+C).
Going backwards has a catch. The derivative of any flat constant is zero — a hill 5 units higher has the exact same slopes. So when you integrate, you can't tell how high up you started. That unknown starting height is written as + C.
If you pin down a start and an end (a definite integral between two limits), the mystery cancels out and you get one exact number: the area between those limits.
In Python, integration is also one function. For the total area under a curve (a definite integral), use np.trapz(y, t) — it adds up all the thin slivers of area. Hit Run to see the area it measures. ↓
import numpy as npimport matplotlib.pyplot as pltt = np.linspace(0, 10, 100) # time pointsvelocity = t # speeding up over timedistance = np.trapz(velocity, t) # area under the curve = total distanceprint("total distance =", round(distance, 1)) # ≈ 50plt.figure(figsize=(6, 4))plt.plot(t, velocity, label="velocity")plt.fill_between(t, velocity, alpha=0.3) # the shaded area IS the integralplt.xlabel("t")plt.ylabel("velocity")plt.title("Integral = the shaded area under the curve")plt.legend()plt.show()Press Run — the shaded region is the integral (total distance). np.trapz measures that area. (For the running integral at every point, NMA uses scipy's cumulative_trapezoid.)