Answered You can hire a professional tutor to get the answer.
USING R Your first function should be called normprob(), and should calculate the exact value of P(aXb)=ba 1/2 exp[(x)^2/2^2]dx (normal distribution...
as well as its approximation using Simpson's rule. For the exact value, you should use the pnorm() command in R. The arguments to this function should be: mu, the mean of the distribution (i.e. μ in the formulae above); sigmasq, the variance (i.e. σ 2 in the formulae); a and b, the integration limits a and b; and n, the value of n to use in Simpson's rule. The default value of n should be 100. Your function should return a list containing components p.approx, the Simpson approximation to the probability; p.exact, the value obtained using pnorm(); n, the value of n; and p.error, the difference p.approx-p.exact. You may use the dnorm()command to calculate the normal probability density function if you wish.
Your second function should be called SimpsonTest(). Its purpose is to evaluate the error of the Simpson approximation to P(a < X ≤ b) for different values of n, and to estimate the value of α as described in the introduction above. The arguments to this second function should be: mu, sigmasq, a, b, and n.grid. These all have the same interpretation as the corresponding arguments to normprob(), except for n.grid which should be a vector of values for n. Your SimpsonTest()function should use normprob()to obtain a vector of approximation errors for each value of n in n.grid. It should then use lm() to regress the log of the absolute approximation error against the log of n.grid, and take the estimated slope of the regression as an estimate of -α. The function should return a list containing components n.grid (the value of n.grid), p.error (a vector containing the absolute values of the approximation errors) and alpha (the estimate of α).