Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ help Background The value of can be computed using the following formula: 0 To evaluate this integral with computers, we can use the trapezoidal

C++ help image text in transcribed
Background The value of can be computed using the following formula: 0 To evaluate this integral with computers, we can use the trapezoidal rule Your Work You will write two C++ programs that compute the value of using the following formula: For the first C++ program, the user w nput the number of intervals (N in the formula above), and your program should compute the value of and print the error (the built-in value of in C++ is M.PI) For the second C++ program, the user will instead input the maximum acceptable error, and your program should find the appropriate number of intervals to use such that the error tolerance is respected, then print the error and the number of intervals it used. To achieve this, your program should first try to evaluate the integral with a sma number of intervals, and try again with bigger numbers if the error is greater than the tolerance Note that there are several ways to write the second C++ program: for example, one could estimate the number of intervals to use with the asymptotic error formula of the trapezoidal rule. But to practice your C++ skills, you should stick to the method provided above. Also, you may want to enforce an upper limit to the number of intervals to try since the trapezoidal rule is only first-order and thus a very large number of intervals will be needed to satisfy any error tolerance less than 10- Background The value of can be computed using the following formula: 0 To evaluate this integral with computers, we can use the trapezoidal rule Your Work You will write two C++ programs that compute the value of using the following formula: For the first C++ program, the user w nput the number of intervals (N in the formula above), and your program should compute the value of and print the error (the built-in value of in C++ is M.PI) For the second C++ program, the user will instead input the maximum acceptable error, and your program should find the appropriate number of intervals to use such that the error tolerance is respected, then print the error and the number of intervals it used. To achieve this, your program should first try to evaluate the integral with a sma number of intervals, and try again with bigger numbers if the error is greater than the tolerance Note that there are several ways to write the second C++ program: for example, one could estimate the number of intervals to use with the asymptotic error formula of the trapezoidal rule. But to practice your C++ skills, you should stick to the method provided above. Also, you may want to enforce an upper limit to the number of intervals to try since the trapezoidal rule is only first-order and thus a very large number of intervals will be needed to satisfy any error tolerance less than 10

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions