% LMex030302_4th.m
% Exmaple 3.3.2 p 150-151 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Example of Matlab's symbolic summation
% Suppose a fair coin it tossed until a head comes up for the first time.
% What are the chances of that happeing on an odd numbered toss?
% Written 1/12/11 for EEOS601 by Eugene.Gallagher@umb.edu
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
syms s
symsum(.5^s,1,inf)
% symsum(p^(2*s+1),0,inf) % Typo in book, can't be evaluated without
% constraining p to values between 0 and 1
symsum(.5^(2*s+1),0,inf)
.5*symsum(.25^s,0,inf)