Computer assignment
from parselib import *
# Generate an RV-stub for a Chi-squared continuous random variable
# [X] is Chi2-distributed with [dof] degrees of freedom
dof = 5
sigma = 2.7
rv = stats.chi2(dof, 0, sigma)
# Specify the x-values of interest
bins = 100
t = linspace(0, 3*dof, bins)
# New figure
figure()
grid(True)
# Draw the PDF at the specified x-values
X_pdf = rv.pdf(t)
title('PDF of a Chi2 distribution')
xlabel('Value, X')
ylabel('Probability, P(X)')
plot(t, X_pdf)