Write the following in Sigma notation, then write the VPython code to calculate the sum, then run the code to get the result.

(The first one is done for you..................................)

(1) Write the sum: 1 + 2 + 3 + ... + 10

IDLE 2.6.2

>>> count = 0

>>> for j in range(1,11):

count += j

>>> print "the sum is: ", count

the sum is: 55

(Now, it's your turn....................)

(2) Write the sum: 1 + 2 + 3 + ... + 100

(3) Write the sum: 1 + 3 + 5 + ... + 99

(4) Write the sum: 1 + 2 + 4 + 16 + ... + 512

(5) Write the sum: 1 + (1/2) + (1/4) + ... + (1/1024)

Questions? send them to Dr. McCarthy ASAP. Good luck.

## No comments:

Post a Comment