Consider the following integral:
∫(x^p * (ZZZ/x-1) * [Zv(xSv-1)-1/-sI0] * sz0)
Write a Python program to evaluate this integral using Simpson's 1/3 rule. Input the lower and upper limits and the first n. Put the 1/3 rule and the integrand in functions. Output from the main program. Note: you will need to include logic to account for the alternating 4's and 2's. Probably the easiest way is to include two for loops.
In the main program, first check your input to see that the input value of n is even. If not, print a warning and leave the program.
Begin with n = 2. Compute the relative error, Ea, as the difference between the present value and the previous value. (For n = 2, the previous value was zero.) Put the invocations of Simpson inside a while loop and double n each time until you get an Ea value less than 10^- in magnitude or you have made 25 attempts. Output to Excel each attempt including answer, n, and the Ea.