MATH 314 Quiz 03

The Bernoulli density function is

f(xp)=px(1p)(1x)f(x | p) = p^x * (1 - p)^{(1 - x)} where x{0,1}x \in \{0, 1\} and p[0,1]p \in [0, 1].
  1. Write f(xp)f(x|p) as a Python function with pp defaulting to 0.50.5.
  2. What does f(0) evaluate to?
  3. What does f(1, p = 0.25 ) evaluate to?
  4. Let x = np.array([0, 1, 0]). What does f(x, p = 0.75) evaluate to?