## Posted By

aturlapaty on 08/11/14

# Simulation of Poisson Process

/ Published in: Python

A simple simulation of Poisson process: emission of particles from radio-active matter

`"""Created on Sun Aug 10 15:24:18 2014 @author: Anish Spyder Editor """# Importing libraries import osos.system('cls')import numpy as npimport matplotlib.pyplot as plt#import math#import time #clf()Nlim = 100N = 145nvec = np.linspace(0.0, N-1, num=N)y1 = .2*sin(2.0*pi*nvec/N)y2 = .2*cos(2.0*pi*nvec/N) plt.plot(y1, y2, linewidth=2.0);text(0, 0,'Radioactive Matter', fontsize = 12) plt.xlim([-2,2])plt.ylim([-2,2]) #nvec = np.linspace(0.0, N-1, num=N)#y1 = sin(2.0*pi*nvec/N)#y2 = cos(2.0*pi*nvec/N)#text(-1, 0,'Atom', fontsize = 12)plt.plot(y1,y2)a = 1 b = 2l = 2 # for loop for recursive plotting of poisson process for x in range(1, Nlim):    s = np.random.poisson(l, 1)    rloc = np.random.uniform(a,b,s)    ph_loc= np.random.uniform(-pi,pi,s)    x_loc = rloc*cos(ph_loc)    y_loc = rloc*sin(ph_loc)    line1, = plt.plot(x_loc,y_loc,'or')    ax = gca()    draw()                         # redraw the canvas    pause(.7)    ax.lines.remove(line1)  # removes the most recent line`