Next: About this document ...
Up: Using DO Loops
Previous: Two Examples

Checkoff

The infinite series

does not converge. That is, if you add up enough of the terms, you can obtain an arbitrarily large number.

Write a program that asks the user for a positive integer N, and then computes and prints the sum of the series

(Hint: You'll need to remember what you previously learned about the difference between integer and real division.)

Homework Problem 6

The elliptic function may be defined for |x| < 1 by the power series

where for any number a, and any integer ,

Write a program to approximate to within an error less than . [Hint: An efficient way to evaluate the infinite sum is to initally set , and then recurrently setting K = K + T, where initially (with n = 0) you take , and . Then, upon replacing n by n+1 in the DO LOOP, you would replace T by , etc., and you would have the program switch out of the DO LOOP and print out the answer when e.g., .]

Call your program solution6.f. To submit it for grading, use the UNIX Shell window to connect to the directory that contains your program and enter the following command

handin cs101 problem-6 solution6.f


Next: About this document ...
Up: Using DO Loops
Previous: Two Examples

Hamlet Project
hamlet@cs.utah.edu