Examples

  

Computational physics examples as IPython Notebooks.

Mechanics 7

  Lennard-Jones Potential

explicit euler method, lennard-jones potential

A simple physical model that approximates the interaction between a pair of neutral atoms or molecules.

  A Throw into the Wind with Air Drag

euler, explicit, method

A study of the trajectory of a ball that is moving through the air, subject to air drag and wind.

  Planetary Motion

newton, space, explicit euler method, gravity

Applying the explicit and implicit Euler methods and the fourth order Runge-Kutta method to calculate the trajectory of the Earth around the Sun.

  Lagrange Points

newton, 4th order runge-kutta, space, lagrange, gravity

Studying how a third mass behaves in the effective gravitational potential resulting from two opposing masses (here: Sun and Earth).

  Planetary Motion - Three Body Problem

animation, gravity, newton, embedded runge-kutta pair, angular momentum, space

Applying the fourth order Runge-Kutta method and the adaptive step size Runge-Kutta method to calculate the trajectories of three bodies.

  The Cavendish Experiment

cavendish, curve fitting, harmonic oscillator, newton, gravity

Analyzes data from the Cavendish experiment using curve fitting. The Gravitational Constant is estimated.

  Roller Coaster

interpolation, animation, gravity, newton, 4th order runge-kutta, cubic splines

The motion of a rolling object on an arbitrary track is analyzed.

Waves and Acoustics 3

  Doppler Effect

speed of sound, doppler, discrete fourier transform

Calculating the speed of a passing train by Fourier analysis of the corresponding sound file.

  Sloshing

euler, eigenvalue, poisson's equation, integration, interpolation, newton, simpson's method

Analyzing sloshing using a numerical approach based on a linear model, which reduces the problem to a Steklov eigenvalue problem.

  Simple Sound Filtering

sound filtering, beat, nyquist-shannon sampling theorem, discrete fourier transform, music

Programming with sounds and using Fourier transforms to filter sound signals.

Thermodynamics 2

  Martian Atmosphere

temperature, pressure

Computing planet Mars' atmospheric pressure profile from its temperature profile.

  One-dimensional Stationary Heat Equation

chebychev nodes, temperature

Solving the one-dimensional stationary heat equation with a Gaussian heat source by approximating the solution as a sum of Lagrange polynomials.

Electric Circuits 1

  Resistor Network

resistance, voltage

Calculating the total current propagating through a resistor network.

Optics 3

  Diffraction in a Gradient-Index Optical Fiber

fermat's principle, diffraction, snell's law, refraction

Plotting the paths of light rays travelling through a gradient-index optical fiber.

  Image Filtering using Fourier Transform

discrete fourier transform, image filtering

Using Fourier transforms for filtering and analyzing images.

  Hybrid Images

rayleigh's criterion, einstein, discrete fourier transform, image filtering

Using Fourier transforms to filter and analyzing hybrid images.

Statistical Mechanics 2

  Ising Model in 1D and 2D

specific heat, partition function, magnetism, spin

Computing the internal energy, specific heat and magnetisation in the 1D and 2D Ising model. An analytical solution to the XY model is also provided.

  Introduction to Brownian Motion and Diffusion

einstein, animation, diffusion, random walk, brown

A brief introduction to Brownian motion and its connection with diffusion. A system of Brownian particles in 2D is simulated and visualised.

Quantum Mechanics 9

  Numerical Determination of Eigenenergies for the Harmonic Oscillator

eigenenergy, harmonic oscillator, forward shooting, eigenstate

Using the method of forward shooting to determine numerically the eigenenergies of the quantum harmonic oscillator in one dimension.

  Band Structures and Newton's Method

schrödinger equation, bloch's theorem, newton's theorem

Using Newton's method to calculate the band structure for the simple Dirac comb potential in one dimension.

  The Size of a Hydrogen Atom - Monte Carlo Integration

monte carlo

Computing the size of the hydrogen atom using Monte Carlo integration.

  Eigenenergies of the Double-Well Potential

eigenenergy, forward shooting, eigenstate

Calculating the eigenenergies of the lowest states for a one-dimensional double-well potential.

  Hydrogen Molecule Ion

schrödinger equation

Employing Monte Carlo integration to determine the "shape" of the hydrogen molecule ion.

  Numerical Determination of Eigenenergies for an Asymmetric Potential

eigenenergy, forward shooting, eigenstate, schrödinger equation

Using a forward-shooting method to determine the eigenenergies and eigenfunctions of an asymmetric potential in one dimension.

  Eigenenergies Through Matrix Diagonalization

harmonic oscillator

The eigenenergies of a system are found by discretizing the Schrödinger equation and finding the eigenvalues of the resulting matrix.

  One-Dimensional Wave Propagation

animation, schrödinger equation, tunneling, scattering

A one-dimensional wave-packet is propagated forward in time for various different potentials.

  Solving the Time-Dependent Schrödinger equation

eigenenergy, eigenstate, schrödinger equation, tunneling, scattering, ehrenfest's theorem, animation

The Time-Dependent Schrödinger equation is solved by expressing the solution as a linear combination of (stationary) solutions of the Time-Independent Schrödinger equation.

Electromagnetism 2

  Electric fields and potentials from point charges

electricity, magnetism

Calculates and plots the electric fields and potentials around an arbitrary number of point charges.

  Quadrupole Mass Spectrometer

4th order runge-kutta, magnetism, electricity, voltage

Using numerical tools to describe and analyse a quadrupole mass spectrometer.

Fluid Mechanics 1

  Euler Equations for Inviscid Flow

An introduction to the compressible Euler equations and methods for solving them numerically.

Chemistry 2

  Self-avoiding random walk in 2D

polymer, random walk, hemmer

Self-avoiding random walks on the square lattice are performed using random sampling. The probability distribution of how many steps a random walker uses before it traps itself is studied. The notebook is based on an article by S. and P. C. Hemmer.

  Diffusion Limited Aggregation

witten, fractal, box counting, diffusion, sander, random walk

Describing aggregation using random walk and estimating its fractal dimension

Biophysics 3

  Tomography

attenuation, radiation, image filtering

Introduces concepts related to computer tomography (CT) and uses this to create a sinogram from a picture and computes the direct back projection.

  Half-Life Measurements

curve fitting, radiation, radioactive decay

Introduces curve fitting in Python and uses this to estimate the half-life of the Ba-137m isotope.

  The Fiber Bundle Bridge Model

polymer, hemmer, hansen, lennard-jones potential, sparse matrix, nygård, elasticity

Simulates the disentanglement of a polymer from a surface using an increasing electric field