Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 3.9 please! equation asked to be used: Exercise 5.7: Consider the integral I= 5 sin? V100x dx. a) Write a program that uses the

python 3.9 please! image text in transcribed
image text in transcribed
equation asked to be used:
image text in transcribed
Exercise 5.7: Consider the integral I= 5 "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- (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 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 I = 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. 1- (18+ (6) + Erla +243) [{f(a) + f(b) + $(a + kh)+ f(a+kh) =hi . (5.31) keven 2...N-2 1...N-1 But N/2-1 N-1-1 [ f(a+kh) = f(a+2kh:) = f(a+khi-1), (5.32) ke1 ke1 keven 2...N-2 and hence N-1-1 k=1 1 = {M-1[{$(a) + }f(b) + f(a + kh, -1)) + f(a+kh). (5.33) 1...N-1 But the term hi-1...) in this equation is precisely the trapezoidal rule esti- mate 1-1 of the integral on the previous iteration of the process, so 1 = I =1+h E f(a + kh). (5.34) + equation for P5.7a k odd 1...N-1 In effect, our old estimate gives us half of the terms in our trapezoidal rule sum and we only have to calculate the other half. In this way we avoid ever recal- culating any term that has already been calculated, meaning that each term in our sums is calculated only once, regardless of how many levels of the calcu- lation it's used in. This means it takes only about as much work to calculate Ii 157

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions