Question
Write a program that tries to solve the following problem by adding up the terms. This equation diverges in real life. However, it does not
Write a program that tries to solve the following problem by adding up the terms.
This equation diverges in real life. However, it does not do this on a computer. There are three possibilities, 1) The sum overflows as it progresses, 2) 1 underflows and becomes 0 (There is a smallest nonzero number representable in a variable of type real), 3) The partial sum ceases to increase because of a lack of precision.
Q: First, guess which of the above possibilities will occur and write down your guess. No points off for wrong guesses.
Q: Second, write a Fortran program that computes this sum. Use a variable for the sum of type real*4, not double precision. Use one of the conditional do loops to check if the sum is changing. This means you will have 1 to have a second variable to remember the value from the previous iteration. When the loop is done, print out the sum, the number of times the loop executed, and the last 1/i, each with labels.
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