Learning Scientific Programming with Python (2nd edition)
P6.6.4: Modeling meanders
Question P6.6.4
One way to simulate the meanders in a river is as the average of a large number of a random walks [1,2]. Using a coordinate system $(x,y)$, start at point $A = (0,0)$ and aim to finish at $B = (b,0)$. Starting from an initial heading of $\phi_0$ from the $AB$ direction, at each step change this angle by a random amount drawn from a normal distribition with mean $\mu=0$ and standard deviation $\sigma$, and proceed by unit distance in this direction. Discard any walks which do not, after $n$ steps, finish within one unit of $B$ (this will be the majority!).
Write a program to find the average path meeting the above constraints for $b=10$, using $\phi_0 = 110^\circ$, $\sigma = 17^\circ$, $n=40$ and $10^6$ random walk trials. Plot the accepted walks and their average, which should resemble a meander.
- B. Hayes, American Scientist 94, 490 (2006).
- H. von Schelling, General Electric Report No. 64GL92.