Answered step by step
Verified Expert Solution
Question
1 Approved Answer
sheet: PART 3: TRUNCATION ERROR (25pts) In numerical analysis, the term truncation error is typically related to the error introduced by not using all the
sheet:
PART 3: TRUNCATION ERROR (25pts) In numerical analysis, the term "truncation error" is typically related to the error introduced by not using all the terms in a series expansion or a limited number of iterations used in approximations to differential equation solutions. To illustrate this, I would like for you to calculate the truncation error in calculating the value of VZ using the following power series. (24 1 3 V2 (2k + 1)! 236+1(k)? 2 8 15 64 35 315 256 + 4096 693 16384 You need to create code to calculate the VZ using 20 terms using float precision 80 terms using double precision You will compare your answer to the actual value to 20 decimal places: v2 = 1.41421356237309504880 In your program declare two arrays: float fTerms[20]; double dTerms[80]; to hold the individual values for each term in the power series. Calculate and store the value of each term once using float and the other using doubles. Beware of the large numbers that result in the numerator and denominator of the terms. Design ways to deal with any overflows that occur. Once you have calculated the terms for both floats and double you need to sum up the terms for each type from largest to smallest. Then you need to determine the sum from smallest to largest for both types. In theory you would think it should not make a difference which order you sur the values, but you should see a difference in the result. Is there a difference between the two summations? Why do you think there would be a difference between the forward and backward summations? (Answer On Turn-in sheet) All your source code for this part needs to be a file called lab1part3.cc. Sample output of your program should look like: Float Results: forward answer =
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started