> # MATH 2 ALTERNATING SERIES 11 November 1996 # # We look at a couple of examples of alternating series. # # The first series is 1 - 1/2 + 1/3 - 1/4 + ... # > a := k -> (-1)**(k-1) / k; (k - 1) (-1) a := k -> ----------- k -------------------------------------------------------------------------------- > # We set Sn to be the partial sums: > Sn := n -> sum(evalf(a(k)), k=1..n); n ----- \ Sn := n -> ) evalf(a(k)) / ----- k = 1 -------------------------------------------------------------------------------- > # Calculate some of the partial sums for even n: > Sn(4); Sn(8); .5833333333 .6345238095 -------------------------------------------------------------------------------- > # ... and for some of the odd n: > Sn(5); Sn(7); .7833333333 .7595238095 -------------------------------------------------------------------------------- > # Plot the partial sums: > P := [[n,Sn(n)] $n=2..100]: plot(P,style=point); -------------------------------------------------------------------------------- > # Find Sn for some large values of n: > Sn(101); Sn(infinity); .6980731694 .6931471806 -------------------------------------------------------------------------------- > # This limit can actually be written in simple form # (see section 10.10): > evalf(ln(2)); .6931471806 -------------------------------------------------------------------------------- > # Maple actually has a formula for the partial sums, # using something called the Psi function: > Sn(n); n n + 1. n + 1. .6931471806 - 1. (-1.) (------ - 1. ------ + .5000000000 n n - 1. (Psi(.5000000000 n) - 1. Psi(.5000000000 n - .5000000000)) (n + 1.))/ (n + 1.) -------------------------------------------------------------------------------- > # Our second example is # 1 - x + (x**2)/2! - (x**3)/3! + ... # > a2 := k -> (-1)**(k-1) * x**(k-1) / (k-1)!; (k - 1) (k - 1) (-1) x a2 := k -> -------------------- (k - 1)! -------------------------------------------------------------------------------- > # We set a2(1)=1, since 0! is defined to be 1: > a2(1) := 1; a2(1) := 1 -------------------------------------------------------------------------------- > # Let b(k) = (x**(k-1))/(k-1)! # We get b(k) -> 0 as k -> infinity. # Also, b(k+1) < b(k) provided k > x. # So this series is convergent for any x. # # Partial sums: > Tn := n -> a2(1) + sum(a2(k), k=2..n); / n \ |----- | | \ | Tn := n -> a2(1) + | ) a2(k)| | / | |----- | \k = 2 / -------------------------------------------------------------------------------- > # Eg, take x=1.5 and evaluate some of the partial sums: > x := 1.5; x := 1.5 -------------------------------------------------------------------------------- > Tn(4); Tn(9); Tn(16); .0625000000 .2232221331 .2231301601 -------------------------------------------------------------------------------- > Tn(101); Tn(infinity); .2231301601 .2231301601 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- # We plot the partial sums. # Two points: # (1) We define Q explicitly as a sequence --- # Maple didn't like it when we used a format similar # to the definition of P. # (2) We start the partial sums at n=2 because Tn(1) requires # taking a sum from k=2 to k=1 (ie, an empty sum), and # the definition of this can be confusing to Maple. > Q:=[seq([n,Tn(n)], n=2..20)]: plot(Q,style=point); -------------------------------------------------------------------------------- > evalf(exp(-1.5)); .2231301601 -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- >