#Maple Code for Dr. Z.'s Dynamcial Methods in Biology, Lecture 7 Help7:=proc(): print(` GR(p,i,N), GRt(p,i,N), GRm(N,p), OneStepMarkov(P,i), MarkovTrip(P,K), StSa(P,K) , StS(P), StSp(P,K), RandSM(N) `): end: with(Statistics): with(LinearAlgebra): #GR(p,i,N): Simulating a Gambler's Ruin problem. Ypu enter a casino with i dollars. At every round you win a dollar with prob. p and lose a #dollar with prob. 1-p. You exit as soon as you are broke or got the maximum allowed that is N. It returbs [0,c] or [1,c] #if you lost or won respectively, where c is the number of rounds. Try: GR(3/5,5,10); GR:=proc(p,i,N) local X,x,d,c: X:=RandomVariable(Bernoulli(p)): c:=0: x:=i: print(`I enter the casino with `, i, `dollars `): while x>0 and x0 and x