Advanced Computational Physics Lab Bank

Interactive Physics Assignments & Labs

Graduate and undergraduate computational physics problem sets matching premier university curricula: Newton's Laws & Rotation, Potential Theory, System of Particles, Central Force (8), Two-Body Scattering (2), Continuum Mechanics (6), Electrodynamics, and Quantum Mechanics. Experiment interactively with real-time parameter sliders.

Lab 01 • Classical Mechanics

Projectile Motion with Quadratic Air Drag

Model aerodynamic deceleration using coupled ODEs

Model the trajectory of a spherical projectile under the influence of gravity and non-linear aerodynamic air resistance.

Governing Equations & Physical Formulation

$$\frac{dx}{dt} = v_x, \quad \frac{dv_x}{dt} = -\frac{c}{m} v_x \sqrt{v_x^2 + v_y^2}$$\n$$\frac{dy}{dt} = v_y, \quad \frac{dv_y}{dt} = -g -\frac{c}{m} v_y \sqrt{v_x^2 + v_y^2}$$

Default Baseline: Mass $m = 0.145\text{ kg}$, initial speed $v_0 = 45\text{ m/s}$, launch angle $\theta = 45^\circ$, drag constant $c = 0.0015\text{ kg/m}$, $g = 9.81\text{ m/s}^2$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Launch Speed (v_0) 45 m/s
Air Drag Constant (c) 0.0015 kg/m
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 02 • Electrodynamics

Electric Field & Equipotential Contours of an Electric Quadrupole

2D electrostatic field line integration and potential mesh computation

Calculate and visualize the 2D electrostatic potential field $\Phi(x, y)$ and field vector gradient $\vec{E} = -\nabla \Phi$ for an arrangement of four point charges in a planar quadrupole configuration.

Governing Equations & Physical Formulation

$$\Phi(\vec{r}) = \frac{1}{4\pi \varepsilon_0} \sum_{i=1}^{N} \frac{q_i}{|\vec{r} - \vec{r}_i|}, \quad \vec{E} = -\nabla \Phi = -\left( \frac{\partial \Phi}{\partial x} \hat{i} + \frac{\partial \Phi}{\partial y} \hat{j} \right)$$

Default Baseline: Charges $q = \pm 1\text{ nC}$ placed at $(1, 1), (-1, 1), (-1, -1), (1, -1)$. Mesh resolution $200 \times 200$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Charge Separation (d) 1 m
Charge Magnitude (q) 1 nC
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 03 • Quantum Mechanics

Finite Square Well: Bound State Energies via Transcendental Bisection

Numerical root finding for symmetric and antisymmetric quantum wavefunctions

Determine the bound-state energy eigenvalues for a particle of mass $m$ trapped inside a finite 1D square potential well of width $2a$ and depth $V_0$.

Governing Equations & Physical Formulation

$$\xi \tan \xi = \sqrt{\xi_0^2 - \xi^2} \quad \text{(Even Parity)}, \quad -\xi \cot \xi = \sqrt{\xi_0^2 - \xi^2} \quad \text{(Odd Parity)}$$\n$$\text{where } \xi = \frac{a}{\hbar}\sqrt{2m(E + V_0)}, \quad \xi_0 = \frac{a}{\hbar}\sqrt{2m V_0}$$

Default Baseline: Well half-width $a = 1.0\text{ nm}$, Well depth $V_0 = 10.0\text{ eV}$, electron mass $m_e$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Well Depth (V₀) 25 eV
Well Half-Width (a) 1.2 nm
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 04 • Thermodynamics

2D Ising Model Monte Carlo via Metropolis Algorithm

Spontaneous symmetry breaking, magnetization, and phase transition simulation

Simulate the magnetic phase transition in a 2D ferromagnetic square lattice using the Metropolis Monte Carlo algorithm.

Governing Equations & Physical Formulation

$$\mathcal{H} = -J \sum_{\langle i, j \rangle} s_i s_j, \quad \Delta E = 2 J s_i \sum_{\text{neighbors}} s_j$$\n$$P(\text{flip}) = \min\left(1, e^{-\Delta E / k_B T}\right)$$

Default Baseline: Lattice size $L = 32 \times 32$, Coupling $J = 1.0$, $T_c \approx 2.269$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Temperature (T) 2.27 J/k_B
Lattice Size (L×L) 24 spins
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 05 • 4. Central Force (8)

Central Force: Inverse-Square Orbits & Relativistic Perihelion Precession

Solve orbital differential equations in central gravitational fields and model relativistic perturbations

Formulate the equations of motion for a celestial body orbiting under Newton's inverse-square gravitational force. Compute orbital eccentricity, verify Kepler's 2nd Law (areal velocity conservation), and introduce a perturbative potential V_{pert}(r) = -\alpha / r^2 to model relativistic perihelion precession.

Governing Equations & Physical Formulation

$$\frac{d^2 u}{d\theta^2} + u = \frac{GM m^2}{L^2} + \frac{\alpha m}{L^2} u^2 \quad \left(u = \frac{1}{r}\right)$$ $$\vec{F}(\vec{r}) = -\frac{GMm}{r^3} \vec{r} - \frac{\alpha}{r^4}\hat{r}, \quad \frac{dA}{dt} = \frac{1}{2} r^2 \dot{\theta} = \frac{L}{2m} = \text{constant}$$ $$r(\theta) = \frac{p}{1 + e \cos(\theta - \theta_0)}, \quad e = \sqrt{1 + \frac{2 E L^2}{m (GMm)^2}}, \quad \Delta\theta_{\text{prec}} \approx \frac{2\pi \alpha m^2}{L^2}$$

Default Baseline: Gravitational parameter $GM = 1.0$, Mass $m = 1.0$, Semi-major axis $a = 1.5$, Eccentricity $e = 0.60$, Relativistic perturbation $\alpha = 0.015$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Eccentricity (e) 0.6
Semi-Major Axis (a) 1.5 AU
Perturbation Strength (α) 0.015
Simulation Orbits 4 rev
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 06 • 4. Central Force (8)

Gauss's Law for Gravitation: Spherical Shell, Solid Sphere & Flat Sheet

Compute integral gravitational potentials $\Phi(r)$, field intensities $g(r)$, and interior tunneling dynamics

Apply the integral form of Gauss's Law for Gravitation $\oint \vec{g} \cdot d\vec{A} = -4\pi G M_{\text{enc}}$ to compute and visualize gravitational potential $\Phi(r)$ and field intensity $g(r)$ for a uniform spherical shell, a homogeneous solid planet, and an infinite flat mass sheet. Simulate the interior diametrical tunnel harmonic motion.

Governing Equations & Physical Formulation

$$\oint_S \vec{g} \cdot d\vec{A} = -4\pi G M_{\text{enc}} \iff \nabla \cdot \vec{g} = -4\pi G \rho, \quad \vec{g} = -\nabla \Phi$$ $$\text{Solid Sphere: } g(r) = \begin{cases} -\frac{GM}{R^3} r & r \le R \\ -\frac{GM}{r^2} & r > R \end{cases}, \quad \Phi(r) = \begin{cases} -\frac{GM}{2R^3}(3R^2 - r^2) & r \le R \\ -\frac{GM}{r} & r > R \end{cases}$$ $$\text{Spherical Shell: } g(r) = \begin{cases} 0 & r < R \\ -\frac{GM}{r^2} & r \ge R \end{cases}, \quad \text{Flat Sheet: } g(z) = -2\pi G \sigma \, \text{sgn}(z), \quad \Phi(z) = 2\pi G \sigma |z|$$

Default Baseline: Radius $R = 5.0\text{ units}$, Total Mass $M = 10.0\text{ units}$, Surface Density $\sigma = 2.0\text{ units}$, Gravitational constant $G = 1.0$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Body Radius (R) 5 units
Total Mass (M) 10 units
Sheet Surface Density (σ) 2 units
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 07 • 5. Scattering (2)

Two-Body Classical Scattering: Trajectories, Deflection & Rutherford Cross-Section

Simulate center-of-mass orbital deflection, impact parameter mapping b(theta), and Rutherford scattering

Model two-body collisions in the Center-of-Mass (CM) frame for a central repulsive potential V(r) = k / r^n. Trace classical particle trajectories for a continuous beam of impact parameters b, compute the classical deflection function Theta(b), and verify the differential scattering cross-section against Rutherford's analytical law.

Governing Equations & Physical Formulation

$$\Theta(b) = \pi - 2 b \int_{r_{\text{min}}}^\infty \frac{dr}{r^2 \sqrt{1 - \frac{b^2}{r^2} - \frac{V(r)}{E_{\text{cm}}}}}$$ $$\text{Rutherford Formula: } b(\theta) = \frac{k}{2E} \cot\left(\frac{\theta}{2}\right) \implies \frac{d\sigma}{d\Omega} = \left(\frac{k}{4E}\right)^2 \frac{1}{\sin^4(\theta/2)}$$ $$\text{CM to Lab Transformation: } \tan\theta_{\text{lab}} = \frac{\sin\theta_{\text{cm}}}{\cos\theta_{\text{cm}} + m_1/m_2}$$

Default Baseline: Center-of-Mass Energy $E = 5.0\text{ MeV}$, Repulsive Strength $k = 4.0$, Target Charge $Z = 79$, Beam Impact Parameters $b \in [0.2, 3.5]$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Center-of-Mass Energy (E) 5 MeV
Coulomb Repulsion (k) 4 units
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 08 • 6. Mechanics of Continuum (6)

Viscous Fluid Mechanics: Stokes' Law, Drag Coefficient Cd(Re) & Terminal Velocity

Simulate falling spheres in viscous media and transition from creeping laminar flow to turbulence

Investigate the motion of a spherical particle through a viscous incompressible fluid. Derive Stokes' Law from dimensional analysis, solve the vertical equation of motion under buoyant and non-linear drag forces across creeping (Re << 1) to transitional (Re ~ 10^3) flow regimes, and analyze terminal velocity relaxation.

Governing Equations & Physical Formulation

$$m_{\text{eff}} \frac{dv}{dt} = (\rho_s - \rho_f) V g - \frac{1}{2} C_d(Re) \rho_f A v^2, \quad Re = \frac{\rho_f v (2r)}{\eta}$$ $$\text{Stokes Creeping Regime } (Re < 0.1): \quad C_d = \frac{24}{Re} \implies F_{\text{drag}} = 6\pi \eta r v, \quad v_t = \frac{2 r^2 g (\rho_s - \rho_f)}{9\eta}$$ $$\text{Schiller-Naumann Transition } (Re < 1000): \quad C_d(Re) = \frac{24}{Re}\left(1 + 0.15 Re^{0.687}\right)$$

Default Baseline: Sphere radius $r = 3.0\text{ mm}$, Steel density $\rho_s = 7800\text{ kg/m}^3$, Glycerin density $\rho_f = 1260\text{ kg/m}^3$, Dynamic viscosity $\eta = 0.45\text{ Pa}\cdot\text{s}$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Sphere Radius (r) 3 mm
Dynamic Viscosity (η) 0.45 Pa·s
Sphere Density (ρ_s) 7800 kg/m³
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 09 • 6. Mechanics of Continuum (6)

Incompressible Continuum Flow: Continuity Equation & Bernoulli Venturi Dynamics

Model streamline velocity vector fields, pressure gradients, and cavitation thresholds in constricted ducts

Formulate the kinematics and dynamics of steady, incompressible, irrotational fluid flow through a converging-diverging Venturi tube. Solve the Continuity Equation A(x) v(x) = Q and Bernoulli's Theorem to map streamline velocity fields, hydrodynamic pressure drops, and identify cavitation onset.

Governing Equations & Physical Formulation

$$\nabla \cdot \vec{v} = 0 \implies Q = A_1 v_1 = A_2 v_2 = \text{constant} \implies v(x) = \frac{Q}{\pi R(x)^2}$$ $$P(x) + \frac{1}{2}\rho v(x)^2 + \rho g z = \text{constant} \implies P(x) = P_0 - \frac{1}{2}\rho \left[ v(x)^2 - v_0^2 \right]$$ $$\text{Euler's Equation: } \rho v \frac{dv}{dx} = -\frac{dP}{dx}, \quad \text{Cavitation Condition: } P_{\text{throat}} \le P_{\text{vapor}}$$ $$\text{Manometer Differential: } \Delta h = \frac{P_1 - P_2}{\rho_m g} = \frac{Q^2}{2g}\left(\frac{1}{A_2^2} - \frac{1}{A_1^2}\right)$$

Default Baseline: Inlet pipe radius $R_0 = 0.05\text{ m}$, Throat constriction radius ratio $R_{\text{throat}}/R_0 = 0.45$, Volumetric flow rate $Q = 0.018\text{ m}^3/\text{s}$, Fluid density $\rho = 1000\text{ kg/m}^3$ (Water).

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Volumetric Flow Rate (Q) 0.018 m³/s
Throat Constriction (R_th/R0) 0.45
Inlet Pressure (P_0) 101325 Pa
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 10 • 1. Newton's Laws & Rotational Dynamics

Newton's Laws & Rotational Dynamics: Damped Physical Pendulum & Phase Portraits

Model non-linear torque, moment of inertia, viscous damping, and angular momentum phase trajectories

Formulate Newton's second law for rotational dynamics under restoring gravitational torque and viscous aerodynamic damping. Integrate the non-linear equation of motion d²θ/dt² + γ dθ/dt + (mgd/I) sinθ = 0 for large angular amplitudes using the Runge-Kutta 4th-order (RK4) method. Analyze phase-space portraits (θ vs dθ/dt), energy dissipation curves, and compare small-angle harmonic approximations with full non-linear solutions.

Governing Equations & Physical Formulation

$$\tau_{\text{net}} = I \alpha = I \frac{d^2\theta}{dt^2} = -m g d \sin\theta - b \frac{d\theta}{dt}, \quad \text{where } I = \frac{1}{3} m L^2, \quad d = \frac{L}{2}$$ $$\frac{d^2\theta}{dt^2} + \gamma \frac{d\theta}{dt} + \omega_0^2 \sin\theta = 0, \quad \omega_0 = \sqrt{\frac{3g}{2L}}, \quad \gamma = \frac{b}{I}$$ $$E(t) = \frac{1}{2} I \left(\frac{d\theta}{dt}\right)^2 + m g d (1 - \cos\theta) \implies \frac{dE}{dt} = -b \left(\frac{d\theta}{dt}\right)^2 \le 0$$ $$T_{\text{exact}} \approx 2\pi \sqrt{\frac{2L}{3g}} \left( 1 + \frac{1}{16}\theta_0^2 + \frac{11}{3072}\theta_0^4 \right)$$

Default Baseline: Rod Length $L = 1.0\text{ m}$, Mass $m = 1.5\text{ kg}$, Initial Angle $\theta_0 = 75^\circ$, Damping Factor $\gamma = 0.35\text{ s}^{-1}$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Release Angle (θ₀) 75 °
Damping Rate (γ) 0.35 s⁻¹
Rod Length (L) 1 m
Rod Mass (m) 1.5 kg
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 11 • 2. Potential Theory & Equilibrium Stability

Potential Theory: 1D Asymmetric Potential Wells, Equilibrium Stability & Anharmonic Oscillations

Determine stable/unstable equilibria, Taylor series effective spring constants, and phase portraits

Investigate one-dimensional conservative motion governed by an asymmetric double-well potential V(x) = (a/4)x⁴ - (b/2)x² + c x. Compute equilibrium points where dV/dx = 0, classify stability using the second derivative d²V/dx², derive the effective harmonic oscillation frequency ω₀ = √(V''(x₀)/m) for small displacements, and integrate the equation of motion to map closed phase-space trajectories and barrier transitions.

Governing Equations & Physical Formulation

$$F(x) = -\frac{dV}{dx} = -a x^3 + b x - c = m \frac{d^2x}{dt^2}$$ $$\text{Equilibrium Condition: } \left.\frac{dV}{dx}\right|_{x_0} = 0 \implies a x_0^3 - b x_0 + c = 0$$ $$k_{\text{eff}} = \left.\frac{d^2V}{dx^2}\right|_{x_0} = 3 a x_0^2 - b > 0 \implies \omega_0 = \sqrt{\frac{k_{\text{eff}}}{m}}, \quad T_0 = \frac{2\pi}{\omega_0}$$ $$V(x) \approx V(x_0) + \frac{1}{2} k_{\text{eff}} (x - x_0)^2 + \frac{1}{6} V'''(x_0) (x - x_0)^3 + \dots$$

Default Baseline: Quartic barrier parameter $a = 1.0$, Double-well depth parameter $b = 4.0$, Asymmetry tilt $c = 0.4$, Particle mass $m = 1.0$, Initial displacement $x_0 = 1.85$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Barrier Coefficient (b) 4
Tilt Asymmetry (c) 0.4
Release Point (x₀) 1.85 m
Particle Mass (m) 1 kg
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures

                        
Lab 12 • 3. System of Particles & Center of Mass

Two-Body Problem & Center-of-Mass Dynamics: Coupled Binary Motion & Momentum Conservation

Transform between Laboratory and Center-of-Mass frames, solve reduced mass ODEs, and verify momentum conservation

Analyze the dynamics of an isolated two-body interacting system under mutual central forces. Decompose the motion into the uniform translation of the Center of Mass (CM) and the equivalent single-body relative motion with reduced mass μ = m₁m₂/(m₁+m₂). Verify total linear momentum conservation, compute total energy partition E = E_cm + E_rel, and visualize the trajectories in both the Laboratory frame and the Center-of-Mass frame.

Governing Equations & Physical Formulation

$$\vec{R}_{\text{cm}} = \frac{m_1 \vec{r}_1 + m_2 \vec{r}_2}{m_1 + m_2}, \quad \vec{r} = \vec{r}_1 - \vec{r}_2, \quad M = m_1 + m_2, \quad \mu = \frac{m_1 m_2}{m_1 + m_2}$$ $$M \frac{d^2\vec{R}_{\text{cm}}}{dt^2} = \vec{0} \implies \vec{P}_{\text{tot}} = M \vec{V}_{\text{cm}} = \text{constant}$$ $$\mu \frac{d^2\vec{r}}{dt^2} = -\frac{G m_1 m_2}{r^3} \vec{r} \implies \frac{d^2\vec{r}}{dt^2} = -\frac{G M}{r^3} \vec{r}$$ $$\vec{r}_1(t) = \vec{R}_{\text{cm}}(t) + \frac{m_2}{M} \vec{r}(t), \quad \vec{r}_2(t) = \vec{R}_{\text{cm}}(t) - \frac{m_1}{M} \vec{r}(t)$$

Default Baseline: Primary mass $m_1 = 3.0$, Secondary mass $m_2 = 1.0$, Gravitational parameter $G = 1.0$, Initial separation $r_0 = 2.0$, Relative orbital velocity $v_0 = 1.35$.

Interactive Parameter Studio (Changes dynamically update Python Code & Math Telemetry)

Primary Mass (m₁) 3 M☉
Secondary Mass (m₂) 1 M☉
Separation (r₀) 2 AU
Relative Velocity (v₀) 1.35 v_c
TELEMETRY: Drag sliders above to view live analytical metrics...
Python Computational Solver Ready
Click "Execute Python Solver" to render scientific figures