In [1]:
%matplotlib inline

from pylab import gca, figure, suptitle, subplot
from pacal import *


Using compiled interpolation routine
Using compiled sparse grid routine

In [2]:
def make_impulse_distr(n):
    d = MixDistr([1.0/2**(i+1) for i in range(n)], [UniformDistr(4**i-0.5, 4**i+0.5) for i in range(n)])
    return d

In [3]:
for N in range(3, 8) + [10]:
    figure(figsize = (18,5))
    suptitle("N={}".format(N))
    imp_rv = make_impulse_distr(N)
    subplot(131)
    imp_rv.plot()
    gca().set_xscale('log')
    gca().set_ylim(top = 0.55)
    quot_rv = imp_rv / imp_rv
    subplot(132)
    quot_rv.plot()
    gca().set_xscale('log')
    gca().set_ylim(top = 2**(N-3) * 1.05)
    subplot(133)
    quot_rv.plot()
    gca().set_xscale('log')
    gca().set_yscale('log')


Warning: arguments treated as independent
Warning: arguments treated as independent
Warning: arguments treated as independent
Warning: arguments treated as independent
Warning: arguments treated as independent
Warning: arguments treated as independent

In [3]: