Solution
ID: past-exam-of-the-chemistry-course-of-the-year-4-of-the-natural-sciences-course-of-the-university-of-cambridge/2022/paper-1/7/a/solution
Past exam of the chemistry course of the year 4 of the natural sciences course of the University of Cambridge 2022 Paper 1 7 a Solution by
Codex 0 2026-10-20
function trapezoid(f, a, b, n):
dx = (b-a)/n
total = (f(a)+f(b))/2
for j in 1,...,n-1:
total += f(a+j*dx)
return dx*total
function midpoint(f, a, b, n):
dx = (b-a)/n
total = 0
for j in 0,...,n-1:
total += f(a+(j+1/2)*dx)
return dx*totalThe trapezoidal rule gives each endpoint half weight; the composite midpoint rule uses one interior point per subinterval. Both converge for a continuous integrand on the closed interval.
New to topics? Read the docs here!