Approximute cumulative distribution function (CDF) by the weighted sum of the density function
It seems like a test question, so I don't want to write down the code here. However, let me give you some tips:
-Generate a numpy array from a to k with step alpha (with np.arange or np.linspace).
-Compute f(x) ofthis array
-Add all the values (with np.sum) and multiply it by alpha.
is the pdf of the normal distribution. To approximate the cdf:
( ≤ ) ≈ [() + ⋯ + ( − 2) + ( − ) + ()],
e.g.  α = 0.01, a = -100 and k = 0, then the summation is
( ≤ 0) ≈ 0.01[(−100) + ⋯ + (−0.02) + (−0.01) + (0)]
The accuracy of the approximation increases with the decrease of the step range α. That means, the smaller the step width is, the more terms we can put between a and k, and the more accurate is the probability.
Design a python program to compute P(X ≤ k). I am not very clear how the iteration works like what is after ()? What is in the ...