PHYS 4840: Mathematical and Computational Physics 2

Code samples

NameDescription
ErrorFunction.pyThe error function by numerical integration
linalg_svd_code.pySingular value decomposition
Make_RndmData.pyGenerate pseudo-random data and write to a csv file
odesim_MoDecay.pySolve a system of simultaneous 1-D ODEs
odesim_pendulum_adapt.pySolve a system of simultaneous ODEs using adaptive step size
odesim_DrivenSHM_adapt.pySHO with periodic driving function
laplace.pyLaplace equation of a box by Jacobi method
poisson.pyPoisson equation of a region with two charges by over-relaxed Gauss-Seidel
heat.py1-D heat equation by Forwarward Time-Centered Space (FTCS) method
WaveEqn_REB.pyWave equation by Fourier transform spectral method
decay.pySimulation of first-order radioactive decay by random sampling of decay probabilities over time steps
craps.pySimuilates rolling two six-sided dice and plots a histogram of the resulting sums
decay_expo.pyFirst order decay by drawing variates for decay times from an exponential distribution
N-Body_Problem.pyFinds the trajectories of N bodies resulting from their mutual gravity, starting with their masses, initial positions, and initial velocities.  Uses fourth-order Runge-Kutta with adaptive time step.


[barransclass] [PHYS 4840]

Copyright © 26March 2023.
Revised: 19 April 2024. Maintained by Richard Barrans.
URL: http://www.barransclass.com/phys4840/pyfiles/index.html