Help:=proc(): print(`SU(m,p)`): end: #SU(m,p): simulating an extemeley rish averse player in the Shepp Urn #Try: #SU(m,p); SU:=proc(m,p) local i,m1,p1,r: m1:=m: p1:=p: # What is (p - p1) - (m - m1)? # p - m is the value if we have to go all the way. # Well, p - p1 is the number of plus balls we've drawn. # m - m1 is the number of minus balls we've drawn. # So (p - p1) - (m - m1) measures our current winnings. # So, we stop as soon as we get at least p - m, which is what would happen if # we played all the way. for i from 1 while (p-p1)-(m-m1) E(100, 110); # memory used=4.9MB, alloc=40.3MB, time=0.07 # 33683086189085193138363517127662830063471100444206895955179886 # -------------------------------------------------------------- # 297474726318397739666969118328344655976262651151936062181333 # # > evalf(%); # 113.2300771