# Sampling simulation steps logarithmically

The common case of for instance a Monte Carlo simulation is, if we want to run our simulation for $N$ steps, we define a delta $\Delta,$ such that $N/\Delta = n$ tells us the frequency with which we measure/evaluate quantities of interest during the MC run. For instance, say $N=1000,$ and we want to measure the average of an observable $f,$ after each $n=100$ steps (so here $\Delta=10$). The average is obtained by dividing $f$ by the number of times $f$ has been measured. This is linearly sampling the time or MC steps and the simulation looks schematically like (writing in python style):

interval = N/delta
f = 0
countmeasurement = 0
for mcstep in range(1,N):
interval -= 1
.
.
.
if interval == 0:
f += computef()
.
.
interval = N/delta
countmeasurement += 1
#save or print
print "steps ", mcstep, "average f ", f/countmeasurement


Question:

With this scheme, if later we plot $f$ as a function of MC-steps, on a log-log scaled plot, we will not have sampled the same amount of datapoints for each time scale as we sampled the total steps only linearly. How do we alter our sampling scheme, thus redefining interval, such that we gather the same number of datapoints for $f$ for each part (time-scale) of the log-log plot? Is it common to sample the MC-steps logarithmically in Monte Carlo simulations?

• Values that are uniform on a log scale have a constant ratio between them. So you could e.g. sample after 1 step, 2 steps, 4 steps, 8 steps, and so on. You could also choose a different ratio, e.g. 1, 3, 9, ... – user3883 Dec 22 '17 at 2:19

If you want your sampling over the (a,b) interval to appear uniform when viewed on a log-log scale, linearly interpolate the logarithms: samples = 10.^linspace(log10(a),log10(b)). This is basically what samples=logspace(a,b) does anyway.