**Consistent progress**

March 2018

In his book, "The Art of Doing Science and Engineering", and in the speeches the book was based on, Richard Hamming related a story about a drunken sailor who staggers left and right at random, and with n such steps will arrive, on average, at around square root of n steps away from where he started. But if there is a pretty girl in one direction, then all his steps accumulate towards that direction, adding to the progress of previous steps, and he will travel a distance proportional to n.
**Progress proportional to √n:**

**Progress proportional to n:**

[1] random_walk.m

function random_walk(x,y,t,xv,yv)

y_epsilon = unifrnd(-1,1);

x_epsilon = unifrnd(-1,1);

y = y + y_epsilon;

x = x + x_epsilon;

yv = [yv y];

xv = [xv x];

t -= 1;

if (t == 0)

u = -11.5:0.16:11.5;

v = zeros(231);

plot(xv,yv, "linewidth", 2);

hold on;

plot(u, v, "color", "black", "linewidth", 1.1); # y-axis

hold on;

plot(v, u, "color", "black", "linewidth", 1.1); # y-axis

axis([-10 10 -10 10]);

else

random_walk(x,y,t,xv,yv);

end

endfunction

[2] straight_walk.m

x = 0:0.1:10;

y = 0:0.1:10;

u = -10:0.1:10;

v = zeros(201);

plot(x,y, "linewidth", 2);

hold on;

plot(u, v, "color", "black", "linewidth", 1.1); # y-axis

hold on;

plot(v, u, "color", "black", "linewidth", 1.1); # y-axis

axis([-10 10 -10 10]);