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 . If not already installed on your machine, run pip install --upgrade version_information from the terminal

In [6]:
%load_ext version_information
In [7]:
version_information numpy, scipy
Out[7]:
SoftwareVersion
Python3.11.5 64bit [MSC v.1916 64 bit (AMD64)]
IPython8.15.0
OSWindows 10 10.0.26100 SP0
numpy1.23.2
scipy1.11.1
Sat Feb 08 13:58:14 2025 Eastern Standard Time
In [ ]: