Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

sheet:

image text in transcribed

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 = forward %error = backward answer = backward %error = Double Results: forward answer = forward %error = backward answer = backward %error = Part 3: TRUNCATION ERROR - In addition to submitting your source code, enter the results below: Float Results: forward answer = forward %error = backward answer = backward %error = _ Double Results: forward answer = forward %error = backward answer = backward %error = Is there a difference between the two summations? Why do you think there would be a difference between the forward and backward summations? 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 = forward %error = backward answer = backward %error = Double Results: forward answer = forward %error = backward answer = backward %error = Part 3: TRUNCATION ERROR - In addition to submitting your source code, enter the results below: Float Results: forward answer = forward %error = backward answer = backward %error = _ Double Results: forward answer = forward %error = backward answer = backward %error = Is there a difference between the two summations? Why do you think there would be a difference between the forward and backward summations

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

Students also viewed these Databases questions

Question

Define the goals of persuasive speaking

Answered: 1 week ago