Question: kindly send it with comments to explain the code step by step Exercise 5.7: Consider the integral 1 = [sin? V100x dx. a) Write a
Exercise 5.7: Consider the integral 1 = ["sin? V100x dx. a) Write a program that uses the adaptive trapezoidal rule method of Section 5.3 and Eq. (5.34) to calculate the value of this integral to an approximate accuracy of e = 10-6 (i.e., correct to six digits after the decimal point). Start with one single integration slice and work up from there to two, four, eight, and so forth. Have 162 5.5 | HIGHER-ORDER INTEGRATION METHODS your program print out the number of slices, its estimate of the integral, and its estimate of the error on the integral, for each value of the number of slices N, until the target accuracy is reached. (Hint: You should find the result is around 1 = 0.45.) b) Now modify your program to evaluate the same integral using the Romberg in- tegration technique described in this section. Have your program print out a triangular table of values, as on page 161, of all the Romberg estimates of the in- tegral. Calculate the error on your estimates using Eq. (5.49) and again continue the calculation until you reach an accuracy of e = 10-6. You should find that the Romberg method reaches the required accuracy considerably faster than the trapezoidal rule alone
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
