#C1.txt, Experimental Math class Spring 2015, Jan. 22, 2015 Help:=proc(): print(` Novices(), Experts(), Mentors() , DoN()`): print(` MentorsV() `): end: Novices:=proc() : {MingjiaYang, AbigailRaz, KelseyHoran,ElliotGlazer, MattKownacki, AlexConway,JohnKim, TimHartmann,CollinChesley, AlexaMao}: end: Experts:=proc(): {NathanFox,AnthonyZaleski,KafungMok, SowmyaSrinivasan, HaLuu}: end: #Mentors(): a procedure that inmputs nothing and #outputs a random assignment of two novices to each #expert #A is the set of remaining novices Mentors:=proc() local E,N,e,n,ra,A,T,newn: E:=Experts(): N:=Novices(): A:=N: for e in E while A<>{} do newn:=A[ rand(1..nops(A))() ]: T[e]:={newn}: A:=A minus {newn}: newn:=A[ rand(1..nops(A))() ]: T[e]:= T[e] union {newn}: A:=A minus {newn}: od: op(T): end: #MentorsV(): verbose version of Mentors USING the initial output MentorsV:=proc() local T,E,e: E:=Experts(): T:= table( [( NathanFox ) = {AbigailRaz, ElliotGlazer}, ( HaLuu ) = {CollinChesley, TimHartmann}, ( SowmyaSrinivasan ) = {AlexConway, AlexaMao}, ( KafungMok ) = {KelseyHoran, MattKownacki}, ( AnthonyZaleski ) = {JohnKim, MingjiaYang} ] ): for e in E do print(`Guru `, e, `will guide the pair of novices`, T[e]): od: end: #DoN(N): "Winning a dollar with prob. 1-1/2^N DoN:=proc(N) local coin, c, ST, debt,i: coin:=rand(0..1): ST:=1: debt:=0: for i from 1 to N do print(`Right now the stake of a coin toss is`, ST): print(`and your debt is`, debt): c:=coin(): if c=1 then print(`Yea, you won the `, ST, `dollars `): print(`after you pay your debt of`, debt, `you exit with`): print(ST-debt): RETURN(i): else debt:=debt+ST: print(`What a shame, you lost the stake `, ST, `dollars `): ST:=2*ST: fi; od: print(`Poor you, you now owe`, debt, `dollars `): N: end: