Equidistributed sequences on unit square in R^2

Equidistributed sequences on unit square in \(R^2\)

Randall Romero Aguilar, PhD

This demo is based on the original Matlab demo accompanying the Computational Economics and Finance 2001 textbook by Mario Miranda and Paul Fackler.

Original (Matlab) CompEcon file: demqua01.m

Running this file requires the Python version of CompEcon. This can be installed with pip by running

!pip install compecon --upgrade

Last updated: 2022-Oct-23


Initial tasks

from compecon import qnwequi
import matplotlib.pyplot as plt
methods = [['N', 'Neiderreiter Sequence'],
           ['W', 'Weyl Sequence'],
           ['R','Pseudo-Random Sequence']]
def equiplot(method):
    x, w = qnwequi(2500, [0, 0], [1, 1], method[0])
    fig, ax = plt.subplots(figsize=[5,5])
    ax.set(title=method[1],
           xlabel='$x_1$',
           ylabel='$x_2$',
           xlim=[0, 1],
           ylim=[0, 1],
           xticks=[0, 1],
           yticks=[0,1])
    ax.axis('equal')
    ax.plot(*x,'.')
    return fig
figs = [equiplot(k) for k in methods]
../../_images/01 Equidistributed sequences on unit square in R2_5_0.png ../../_images/01 Equidistributed sequences on unit square in R2_5_1.png ../../_images/01 Equidistributed sequences on unit square in R2_5_2.png