Navigation :
Chapter 4 Discussion VI
The alternating series is
[1, -1/2, +1/3, -1/4, +1/5, -1/6, ...]
-
Define altTerm n to be the nth term in the sequence.
-
Define altSeq m to be the first first m terms in the
sequence.
-
Write a function to find the first k terms of the alternating
series.
-
Write waltSum, which takes in a list of numbers, multiplies each
term by the corresponding term in the alternating series, and then
adds up the sums.
Example:
waltSum [5,10,20] == 1*5 + (-1/2)*10 + (1/3)*15
-
The goalt x function adds up the terms in the alternating series
until it comes on a term that is less than x in absolute value.
Example:
goalt 0.21 == 0.5833...
Remember: fromIntegral when you need to divide something by an
Int.