Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write the C++ code. Follow all instructions when writing the code. Please answer question at the end as well PART 3: TRUNCATION ERROR In
Please write the C++ code. Follow all instructions when writing the code. Please answer question at the end as well
PART 3: TRUNCATION ERROR 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 V2 using the following power series. (2k + 1)! 13 15 35 315 693 2+(l)2 2 8 64 256 4096 16384 Please use your program to determine how many terms in the power series are needed to use the full precision of a float and then of a double (i.e. when the number values stop changing). You will compare your answer to the actual value of v2 given 60 decimal places: 21.414213562373095048801688724209698078569671875376948073176679 For this experiment, you can use a global double variable. double sq rt 2 1.414213562373095048801688724209698078569671875376948073176679 In your Labl directory, please call your source code lablpart3.cc. An example of the output of your program might look like Input the number of terms in the power series using FLOATS: 4 # terms. I approx # % error: # # terms-# approx % error: % Etc.. Input the number of terms in the power series using DOUBLES: 4 # terms 1 approx # % error # # terms approx # % error. # Etc.. Problem 3: TRUNCATION ERROR How many terms do you need to include in the power series expansion until the digital value remains unchanged? answer for float type: answer for double typeStep 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