This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 1 + 1 3 2 + 1 5 2 + 1 7 2 + Write a script that evaluates this expression, ignoring all terms that are strictly smaller than .000001. Your script should display the number of terms summed and the sum. Use a while-loop. Think about the initialization of your variables and the order of computation carefully! In the loop body you need to calculate the value of a term only once. 4. We use the above series for approximating / 8 again but with a dierent stopping criterion. Let the sum of the rst n terms be T n . As n increases one expects the ratio T n T n +1 to approach 1. Write a script to nd the smallest n such that the ratio T n T n +1 > . 9999. Display n and T n . Hint: Now you need to keep track of a current sum and the next sum in the loop. 1...
View Full Document
- Fall '07