Question: Mathematica Code R : = Module [ { u , runs } , ( * module to return a RV for the number of runs

Mathematica Code
R := Module[{u, runs},
(* module to return a RV for the number of runs earned by a team in \
one inning, cf. Glass & Lowry paper *)
u = U;
runs = Which[u <0.73,0, u <0.878,1, u <0.946,2, u <0.977,3,
u <0.991,4, u <0.997,5, u <=1,6];
Return[runs];
]
game := Module[{},
(* initialize variables *)
inning =1;
runsA =0;
runsB =0;
scoreA ={};
scoreB ={};
totalA =0;
totalB =0;
(* run for 9 or more innings, as needed *)
While[(inning <=9)||(inning >9 && totalA == totalB),
(* half inning for team A*)
runsA = R;
AppendTo[scoreA, runsA];
totalA = totalA + runsA;
(* half inning for team A*)
runsB = R;
AppendTo[scoreB, runsB];
totalB = totalB + runsB;
inning +=1;
];
inning -=1; (*
adjust inning counter to end with an accurate value *)
(* Return any info wanted about the game *)
Return[totalA];
]
Bade on this Mathematica code, write code for this problem
[How likely is it to have a game end with a combined score above 20 runs?]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!