Question: Yon should write a program which demonstrates the convergence behavior of the geometrie sequenen: The partial sum of the geometric series can be defined as

 Yon should write a program which demonstrates the convergence behavior of
the geometrie sequenen: The partial sum of the geometric series can be

Yon should write a program which demonstrates the convergence behavior of the geometrie sequenen: The partial sum of the geometric series can be defined as You should print the partial sums of the sequence, and the last term that is added to the sequence. The output of the program should be similar to the example in the following page. The sketch of the the algorithm is given below 1. Read the number r from the file named "X1nput.txt". This file contains only a number which is in between 0 and 1 2. Initialize to 0 3. As long as le9 do (a) Display i, S, and S-1 in the format given below. i. Floating poinmbers should be displayed with 16 decimal digits. ii. Every number must be right aligned. (b) increment i by I . Display the expouent of the last term that is added to the partial sum. 5. Display the last term that is added to the partial sum, note that this value must be greater than le-9. 6. Display the next power of r after the last term that is added. ote that this value must be less than le-9. You need to evaluate some powers of r. Note that the pow function can be used, but it would be both inefficient, and it will make you miss some points that I waut you to uotice. So please try to write the progran witlout using it, althoug it will not affect your grade for homework. Solving this problem without calling the pow function, is a uice exercise for applying incremental operators, and deciding where to define useful interuediate variables In the uext page, output of an example run of the problem is given This problem also lets you observe the fumdamental difference between two types of floating point numher data types: float and donble. Try solving the problem by declaring every fractional variable as float and then try it witih double. Observe which of the printed values are significantly different and which values are almost equal. Submit the version with double Important Notice: Failure to comply the follwing rules will result in a 0 for your homeworh An example input ile is uploaded to the ninova systm Your program must read the value from a lile with the name given above, which is supposed to be in the same folder with the program. Your program must not write anything to any file. The only input to the program is the value of z which mnst be read from the file. The outputs must be all printed to the screen. You may not assume any other type of input or file format or any other type of output for program to wait t user to push enter before termination. Even if you want to use them as you are developing your code, remove any such command from your Do uot use or to code before you submit your homework to the ninova system. Yon should write a program which demonstrates the convergence behavior of the geometrie sequenen: The partial sum of the geometric series can be defined as You should print the partial sums of the sequence, and the last term that is added to the sequence. The output of the program should be similar to the example in the following page. The sketch of the the algorithm is given below 1. Read the number r from the file named "X1nput.txt". This file contains only a number which is in between 0 and 1 2. Initialize to 0 3. As long as le9 do (a) Display i, S, and S-1 in the format given below. i. Floating poinmbers should be displayed with 16 decimal digits. ii. Every number must be right aligned. (b) increment i by I . Display the expouent of the last term that is added to the partial sum. 5. Display the last term that is added to the partial sum, note that this value must be greater than le-9. 6. Display the next power of r after the last term that is added. ote that this value must be less than le-9. You need to evaluate some powers of r. Note that the pow function can be used, but it would be both inefficient, and it will make you miss some points that I waut you to uotice. So please try to write the progran witlout using it, althoug it will not affect your grade for homework. Solving this problem without calling the pow function, is a uice exercise for applying incremental operators, and deciding where to define useful interuediate variables In the uext page, output of an example run of the problem is given This problem also lets you observe the fumdamental difference between two types of floating point numher data types: float and donble. Try solving the problem by declaring every fractional variable as float and then try it witih double. Observe which of the printed values are significantly different and which values are almost equal. Submit the version with double Important Notice: Failure to comply the follwing rules will result in a 0 for your homeworh An example input ile is uploaded to the ninova systm Your program must read the value from a lile with the name given above, which is supposed to be in the same folder with the program. Your program must not write anything to any file. The only input to the program is the value of z which mnst be read from the file. The outputs must be all printed to the screen. You may not assume any other type of input or file format or any other type of output for program to wait t user to push enter before termination. Even if you want to use them as you are developing your code, remove any such command from your Do uot use or to code before you submit your homework to the ninova system

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!