Computational Physics, 1B, Term 2

Worked solution for WAVES example

| all.zip |

MakeWaves.cc is a worked solution for displaying superpositions of simple sinusoidal waves. You can change the line that says type = 3 to get different sorts of dispersion relation (1: non-dispersive 2: deep water 3: reasonably deep water). The program contains a variety of initial conditions to choose from.
Write code that implements the Leapfrog method. Get it going for one initial condition, such as x0 = (1.5,2), v0 = (0.4,0).

Example usage (MakeWaves writes to a file /tmp/y:
MakeWaves
gnuplot -noraise
load 'gnu10'
The optional command-line arguments are
MakeWaves [N [K [T [dt]]]]
N - number of points for surface; K - number of basis functions to use; T - duration of simulation; dt - time-step.

gnu10 makes a movie by calling the recursive gnu11.

[an error occurred while processing this directive]
[an error occurred while processing this directive]

This program uses some utility functions for creating vectors and matrices. These utilities are in the file utils.cc.

[an error occurred while processing this directive]
[an error occurred while processing this directive]


David MacKay
Last modified: Wed Nov 14 10:11:32 2007