I want to make an animation of a random walk that rescales every time the graph gets to the end point, with the condition that the plot range on x axis is only on [0,1].
In first step, the graph would go to 1 and then rescale ( the width by 1/2, the height by 1/sqrt(2)). So in the next step, one would need one more step (together 2) to get to the end (x = 1), in the third iteration one would need 4 steps to get to the end and so on...
I've managed to compute the walk, but the animation is causing me trouble. I think the scaling is also not right - but if I multiply the y-axis by 1/root(2) it is also wrong. I also do not know what is causing the screen to go red at the beginning.
randomwalk[n_] := Module[{x = 0}, NestList[# + RandomChoice[{-1, 1}] &, 0, n]]; animateRandomWalk[step_] := With[{g = randomwalk[step]}, Animate[ListLinePlot[Take[g, n], PlotRange -> {{0, 1}, Sqrt[2]*MinMax[g]}, DataRange -> {0, step/(step)}], {n, 1, step, 1}, AnimationRunning -> False]] Thank you so much for your answers!
DataRange->{0,step/(step)}? $\endgroup$