2 DICE SIMULATOR

The objective of this program is to demonstrate several points of probability, including sample space and the laws of large numbers. Two "dice" are being rolled, the results are being added, and the actual results are plotted with the theoretical results.

:{0}=>L1
:L1=>L2
:Prompt N
:For(I, 1, N, 1)
:randInt(1,6,2)=>L1
:sum(L1)=>L2(I)
:End
:PlotsOff
:Plot1(Histogram, L2)
:2=>Xmin
:13=>Xmax
:1=>Xscl
:0=>Ymin
:.5*N=>Ymax
:10=>Yscl
:seq(X, X, 2, 12)=>L3
:N*{1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1}/36=>L4
:Plot2(Scatter, L3, L4, .)
:Text(5, 5, "N=")
:Text(5, 12, N)
:DispGraph
Clears L1.
Clears L2.
Prompts user for number of rolls.
Instructs calculator to perform N rolls.
Rolls two dice.
Sums the pair of dice.
Completes the rolling N times.
Turns all statistics plots off.
Sets up histogram.
Sets up approprite viewing window for graph.





Sets up list for outcomes of rolls, 2 through 12.
Sets up list for theoretical outcome of N rolls.
Sets up theoretical plot.
Sets up some text on the graph.

Shows the result.


The output for the program is a histogram with the theoretical outcomes for rolling a 2, 3,...12.


Discussion:
What are the actual probabilities of rolling a sum of 2, 3,...12 with a fair set of dice?
What is "fair"?
Is randInt "fair"?
What would the graph look like for "summing" one die? What will the average be?
What would the graph look like for summing three dice? What will the average be?
How will the simulator be closest to the theoretical result?

Assignments:
Program the 3 Dice simulator.