Parsa Rezaei

Writing · Sole-authored, Cal Poly Pomona · 2025

A Numerical Modeling Study of Differentiation and Integration

Custom MATLAB implementations of derivative and quadrature methods, benchmarked against analytical results to show where each one actually breaks.

Numerical methods are usually taught as a menu of techniques and used as a black box afterwards. This study implements them from scratch in MATLAB and then measures where each one fails, which is the part that determines whether a given method is safe to use on a given problem.

The differentiation work covers first and second derivatives, including partial derivatives for multivariable functions, with numerical results plotted directly against the analytical derivative and the absolute error carried alongside rather than summarized away.

For integration the study implements left and right Riemann sums, the midpoint rule, the composite trapezoidal rule and Simpson's rule, then extends to double and triple integrals. Comparing them on a log-log error convergence plot is what makes the ranking legible: the methods separate by convergence order, and Simpson's advantage over trapezoid is visible as slope rather than as a claim.

Interpolation gets the same treatment, comparing Lagrange polynomials against cubic splines by mean squared error across several test functions. The interesting case is 1/(1+x²), where the Lagrange interpolant develops the classic oscillation at the interval edges while the spline stays well-behaved — a concrete demonstration of why higher-order polynomial interpolation is a trap on evenly spaced nodes.

Root finding is covered through Newton–Raphson, plotted as iterations against absolute error so the quadratic convergence is something you can see rather than something you are told.

7 figures

Figures

3D surface of f(x,y) = sin(x)·cos(y) with overlaid contours
Log-log error convergence for the integration methods
Mean squared error, Lagrange against cubic spline
Interpolation of 1/(1+x²) — where Lagrange breaks down
First derivative: numerical against analytical, with absolute error
Absolute error at n = 100 across single-integration methods
Newton–Raphson convergence: iterations against absolute error

← All writing

A Numerical Modeling Study of Differentiation and Integration — Parsa Rezaei