#hw27.txt; Due 5/4/2014; Frank Wagner Help:=proc(): print(` `): end: ################### #####Problem 1##### ################### #in progress... ################### #####Problem 2##### ################### ProbW:=proc(N,p) local a,i,a1: a[0]:=0: a[1]:=a: #If P(x) is the probability of winning #given you enter with x dollars, #P(i)=p*P(i+1)+(1-p)*P(i-1), and so #P(i+1)=(1/p)*P(i)+((p-1)/p)*P(i-1) for i from 2 to N do a[i]:=(1/p)*a[i-1]+((p-1)/p)*a[i-2]: od: a1:=solve(a[N]=1,a): [seq(subs(a=a1,a[i]),i=1..N-1)]: end: #To see the probability of doubling my huge fortune of 50 dollars, #I can put in #ProbW(100,p)[50] # #ProbW(100,1/2)[50]; returns ##1/2 # #ProbW(100,17/35)[50]; returns ##0.05427332779 (with evalf) # #ProbW(100,49/100)[50]; returns ##0.1191749199 (With evalf) # #Given that casino table games operate at about 45-49% on average, #it's clearly a bad idea to gamble (unless, of course you can find #a way to alter these odds in your favor).