Hughes and Hase Problem 3.8

NOTE: In this notebook I use the stats sub-module of scipy for all statistics functions, including generation of random numbers. There are other modules with some overlapping functionality, e.g., the regular python random module, and the scipy.random module, but I do not use them here. The stats sub-module includes tools for a large number of distributions, it includes a large and growing set of statistical functions, and there is a unified class structure. (And namespace issues are minimized.) See https://docs.scipy.org/doc/scipy/reference/stats.html.

In [1]:
import numpy as np
from scipy import stats

(i) Mean count rate

If we use the minute as our unit of time, the determination of the mean count rate is trivial: it's $R = 270\, \mbox{min$^{−1}$}$. If we choose seconds, it's only slightly less trivial: $R=270/60 = 4.5\, \mbox{s$^{−1}$}$.

(ii) Error in the mean count rate

We are sampling from a Poisson distribution, so the error given, by the standard deviation, is $\sigma = \sqrt{\bar \mu}$:

In [2]:
sigma = np.sqrt(270)
print('sigma (min^-1) =', sigma, '; sigma (s^-1) = ', sigma/60)
sigma (min^-1) = 16.431676725154983 ; sigma (s^-1) =  0.27386127875258304

(iii) Fractional error

In [3]:
print('fractional error =', sigma/270)
fractional error = 0.06085806194501846

Expected counts in 15 minutes: $N = 15\, \mbox{min} \times R$

In [4]:
n_expected = 15*270
print('expected in 15 minutes =', n_expected)
expected in 15 minutes = 4050

The probability of actually getting this number of counts is given by the probability mass function of the Poisson distribution:

In [5]:
probability = stats.poisson.pmf(n_expected,n_expected)
print('probability of getting exactly', n_expected,' counts =', probability)
probability of getting exactly 4050  counts = 0.006268644164779241

Version information

version_information is from J.R. Johansson (jrjohansson at gmail.com); see Introduction to scientific computing with Python for more information and instructions for package installation.

version_information is installed on the linux network at Bucknell

In [6]:
%load_ext version_information
In [7]:
version_information numpy, scipy
Out[7]:
SoftwareVersion
Python3.7.7 64bit [GCC 7.3.0]
IPython7.16.1
OSLinux 3.10.0 1062.9.1.el7.x86_64 x86_64 with centos 7.7.1908 Core
numpy1.18.5
scipy1.5.2
Fri Aug 07 09:55:19 2020 EDT
In [ ]: