This site is aimed at math and physics majors who may have little programming experience, but who want to learn techniques in computational physics. It contains examples pulled from a variety of fields in math, physics and astronomy. The examples are meant to supplement existing tutorials such as the excellent one put together by Spencer and Ware at BYU. It may be downloaded in pdf form from their website here.
Programming Basics
First Steps
Loops and If Statements
Reading Data Files
Example | Description | Commands |
A11 | Read in data from a text file | load(), textread() |
Download all Programing Basics Examples A00.m–A11.m here.
Plotting
2D Plots
Download all 2D Plot Examples plot01.m–plot11.m here.
Solving Ordinary Differential Equations (ODEs)
-
1D First-Order ODEs
-
1D Second-Order ODEs
-
2D Second-Order ODEs
Celestial Mechanics
-
Two-Body Problem
-
Circular, Restricted Three-Body Problem
- Code Download
- Pseudo-Potential & Lagrange Points
- Simulations & Chaos
-
N-Body Problem