Compute the following expressions 1 12 14 18 116 132
     Compute the following expressions:  1 - 1/2 + 1/4 - 1/8 + 1/16 - ^1/32 + ... - 1/2^13 (and save it into A8.dat);  1/1^0 times 3^2 + 1/3^2 times 5^2 + 1/5^2 times 7^2 + ... with 500 terms (and save it into A9.dat).  Recall that 1/5^2 times 7^2 = 1/(25 times 49) = 1/1225   
  
  Solution
The series
 1 – 1/2 + 1/4 – 1/8 + 1/16... is infinite Geometric Series.
The sum to infinity (S) of any geometric sequence in which the common ratio r is numerically less than 1 is given by
S = a/(1-r) |r| < 1
where
 a = first number of the series
 r = common ratio
MATLAB CODE:
% define your first 5 n-elements
 n = 0 : 4
% generate your sequence
 s = (-1).^n ./ 2.^n
% find its sum
 s_to_i = sum(s)
OUTPUT:
n =     0     1     2     3     4
 s =     1.0000   -0.5000    0.2500   -0.1250    0.0625
 s_to_i = 0.6875
---------------------------------------------------

