A random walk can be generated by computing the cumulative sum of a list of random numbers.
import random
import itertools
import seaborn as sns
N=1000000
x = range(N)
series = [random.randrange(-1,2) for i in range(N)] # random integer numbers -1,0,1
walk = list(itertools.accumulate(series))
sns.lineplot(x=x, y=walk)
But why stop here? What happens if we compute the cumulative sum of the random walk itself
walk_of_walk = list(itertools.accumulate(walk))
sns.lineplot(x=x, y=walk_of_walk)
We can even go further and compute the cumulative sum of the cumulative sum of a random walk
walk_of_walk_of_walk = list(itertools.accumulate(walk_of_walk))
sns.lineplot(x=x, y=walk_of_walk_of_walk)
To my surprise the cumulative sum and the cumulative sum of the cumulative sum of a random walk looks smoother and smoother than the random walk. Is this to be expected? I couldn't find anything regarding the cumulative sums of random walks. Is there anything known about its mathematical properties? Or am I doing nonsense here?