The objective of this final unit is to handle Dynamic Systems. You will learn to solve time-dependent physical equations, such as those describing radioactive decay, pendulum motion, or circuit transients, using advanced numerical algorithms.
Most laws of physics are expressed as differential equations (e.g., F = m (d2x) / (dt2)). Numerical methods allow us to find the state of a system at any time t by stepping through time in small increments (h).
Euler's Method is the simplest numerical procedure for solving ODEs. It assumes the slope of the function is constant over the interval h.
Formula: yn+1 = yn + h · f(xn, yn)
Modified Euler improves accuracy by taking the average of the slopes at the beginning and the end of the interval.
The RK4 method is the "gold standard" for solving ODEs in undergraduate physics. It provides high accuracy by calculating four different slopes (k1, k2, k3, k4) and taking their weighted average.
Monte Carlo methods use random sampling to obtain numerical results. In physics, this is used to simulate stochastic processes or calculate complex integrals.
Experimental data points often have "noise." Least Squares Fitting finds the best-fit line (or curve) that minimizes the sum of the squares of the vertical deviations between each data point and the curve.
while t < 1.0), use a small buffer like while t < 0.999 to avoid missing the final step due to precision issues.Tip: Always plot your numerical solution against the Analytical Solution (if it exists). This "Validation Step" is the only way to prove your code is working correctly.