Free lesson · Integral calculus
Definite integrals: adding many small contributions
Open interactive lessonPractice calculationsExplore labs
Start with the idea
- An integral accumulates a quantity continuously.
- Start with a finite sum of rate times interval width, then imagine refining the intervals.
- Signed area is one useful picture, but the physical meaning comes from the units.
Symbols, units & horizon
- ∫: integral or continuous accumulation
- a,b: start and end of the integration interval
- x: variable of integration
- dx: infinitesimal input width in the integral notation
- n: number of equal subintervals
- Δx: their finite width
- xᵢ*: chosen sample point in subinterval i
- Σ: sum all interval contributions
- lim n→∞: limit as the equal partition is refined
When and why to use this
Use a definite integral when a quantity is naturally expressed as contributions over time, distance or another continuous variable. The accumulation lab compares rectangles with an exact total.
- If water flows at q(t) litres per minute, q(t) times a short duration approximates the litres added in that interval.
- Adding over intervals approximates the total volume.
- The integral is the limiting total when the function is integrable and the partition is refined.
- A region below the horizontal axis contributes negatively to the signed integral.
- Total geometric area instead integrates the absolute value.
- Reversing the integration bounds reverses the sign.
Definite integrals: adding many small contributions
- For on , divide the interval into equal pieces: , with right endpoints .
- The right-endpoint sum is . Substitute to obtain .
- Take the limit: . Left endpoints give , whose limit is also 1. The finite sums approximate the area; their common limit gives the integral.
With four right-end rectangles the heights are .5,1,1.5,2 and width .25. Total=1.25. With four left rectangles the total is .75. The exact integral is 1.
Architecture pseudocode
def riemann(function,a,b,n,side="right"):
if not isinstance(n,int) or n<1: raise ValueError("Positive integer n required")
if side not in ("left","right","midpoint"): raise ValueError("Unknown sample convention")
offset={"left":0,"right":1,"midpoint":.5}[side]
dx=(b-a)/n
return sum(function(a+(i+offset)*dx)*dx for i in range(n))
print(riemann(lambda x:2*x,0,1,4),riemann(lambda x:2*x,0,1,4,"left"))An analogy to remember
Adding the water collected in many short time intervals reconstructs how much passed through a pipe. A finer measuring schedule better tracks a changing flow.
How this becomes a building block
An integral can be the entire quantity of interest, such as total flow. Within finance it can accumulate a funding rate, a deterministic execution-cost rate or discounted continuous income. Specify whether the integrand is currency/time, probability density or something else before interpreting its integral.
Further reading: OpenStax Calculus, Volume 1 — definitions and standard theorems ↗
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
def riemann(function,a,b,n,side="right"):
if not isinstance(n,int) or n<1: raise ValueError("Positive integer n required")
if side not in ("left","right","midpoint"): raise ValueError("Unknown sample convention")
offset={"left":0,"right":1,"midpoint":.5}[side]
dx=(b-a)/n
return sum(function(a+(i+offset)*dx)*dx for i in range(n))
print(riemann(lambda x:2*x,0,1,4),riemann(lambda x:2*x,0,1,4,"left"))Continue learning
Integral Calculus: Accumulation & Area — all lessons- Start with rectangles: rate × time = amount
- Definite integrals: adding many small contributions
- Core integral rules: undo a derivative, then check
- Antiderivatives and the fundamental theorem
- Integration techniques: substitution and integration by parts
- Improper integrals, densities and continuous expectations
- Numerical integration and a continuous cash-flow building block
- Substitution: reverse the chain rule without losing the bounds
- Integration by parts: transfer a derivative
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations