MATH 314 Quiz 11

Given on 2025-10-15

There are exactly 6 things wrong in each code chuck of each of the problems below.

Please cross out the wrong characters and write an ordered, comma separated list of replacement characters after the comment #. If you don't know the correct Python syntax for the replacement characters you want, make something not unreasonable up.

You should assume the following import statements precede each code chunk in each question. The code chunks are independent across problems; no code in one code chunk informs code in another code chunk.

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as st
from scipy.optimize import minimize

Generate Poisson random variables from . Use these data to calculate a cumulative mean of . Use matplotlib to make a convergence plot of the estimated probability. Then calculate the true probability to help confirm convergence to the right thing.

P = st.poisson(3)               #
N = 501                         #
x = P.random(size = N)          #
ndx = np.arange(N + 1)          #
cm = np.cumsum(x >= 5)          #
plt.plot(x, cm)                 #
1 - st.poisson.cdf(5)           #