Hi all!
I've just published a new document into the files section, called 'Dice Roll Simulator.tns'. I think you'll appreciate it!
It does what the name says: it simulates rolls of 1, 2 or 3 dice and plots the results as an histogram. This document will also be published on my website, but probably only tomorrow or friday.
This is probably the most complex (and more time consuming) construction I ever did (even more than the Periodic Table). It's unlikely that I keep building this kind of simulators, as they're quite difficult to construct without error, but I've wanted to build this one for quite some time (I've been thinking about it ever since I finished the last one).
The simulator was optimized for use on a TI-Nspire or TI-Nspire handheld; if you want to view it on a computer, use the emulator view of the teacher edition software. On the regular edition of the software, use the Handheld view, but notice that the text messages won't be properly aligned.
The document consists of 4 problems; on problem 1 there's just a title page and instructions (it's reccommended that you read them, in order to avoid accidentaly deleting an important object). Problem 2 is a simulator of rolls of 1 die, problem 3 simulates rolls of 2 dice and problem 4 simulates rolls of 3 dice.
In each problem the first page is the graphical simulator itself, with the dice and the histogram of the results, the second page is a spreadsheet page with the data and the 3rd page is a data&statistics page with another histogram, that you can trace and where you can perform some statistical analysis.
Note that the histogram on the Graphs page was built as a geometrical construction, so it's doesn't display the numerical values, only the graphical representation.
Unfortunately, performance isn't great. Especially on the 3 dice simulator you have to wait about 2 seconds for each new roll. And if you gather a lot of data you'll notice a significant performance loss. So every now and then, delete the captured data and start a new simulation (see page 1.1 for instructions).
Those of you that just want to see it working and thinking about how to use it, can stop reading here. As for those that want to know a bit about how it works, keep reading...
As to how it works, I'll just give you the outline. The construction is really, really complex, so it's pointless to provide a complete description. however, if someone's interested, just let me know.
1. The dice (except the dots) are built using a template, which is drawn next to the origin of the axis. Each vertex is obtained by translations from a reference point, which allowed me to move a die at any point and adjust the figure. The relevant measurements are controled by text parameters, so I can change easily the dice making them bigger, smaller or rotating them. The dots on the front face are built as midpoints of the edges (and quarts of edges). Then the position of a die is selected by a point and I do translations to build the rest of it.
2. The random number generation is done in the standard way, with a formula creating random numbers and associated with the coordinate of a control point, which is animated. Actually as the results are always integer, I had to add some "noise" (a random number of the order of 10^-2). This has to do with the data capture, as a variable is only capture when it's value changes, so if two or more identical results are obtained, only the first one is drawn, resulting in dimension mismatch errors.
3. The dots are built using when statements. Whenever a dot is supposed to be drawn, it's position is given as the sum of the base point of the die plus the coordinates of the respective dot on the template (which has (0,0) as base point). To determine when is a dot drawn, the when statements go like this: the center dot is drawn whenever the score is odd; two of the corners are drawn when the score is >=2; the other two corners when the score is >=4, and the two middle dots are drawn when the score is 6.
4. The results of all these calculations are then transfered to the axis and a lot of perpendicular lines and intersection points are built.
5. The histogram is done by transfering numbers corresponding to the results to a vertical ray drawn from a base point; and the base points are obtained by successive translations of a vector, assuring they're all the same width; the max height of the bars is also given by the length of a vector, allowing rescaling of the histogram.
6. Variables score1, score2 and score3, the results of each die, are captured. They're not integers, as some noise was added, so in another column I do a shift (to ignore the first point and therefore start with all results equal to zero) and take the ipart of the data.
7. Finally, results of all dice are added, each different value counted and results put back to the graphics page.
If you want to take a peak under the hood: all auxiliary constructions are hidden. If you select "Hide/Show", you'll see the geometrical objects underneath. However, to look at the formulas, dots' coordinates, parameters, etc., there's an extra trick: they're not only hidden but also "far away"! The formulas are "below" the main screen, while dice data and coordinates are to the left of the main screen. To see them it's reccomended that you use TI-Nspire software on Normal View. You have to drag the page before selecting hide/show (remark: when the axis are visible, dragging the workarea will move the system of axis and all objects built in the coordinate system; when the axis are invisible, it will drag the non-analytical objects, like text messages, formulas, objects build in Plane Geometry view, etc.; if you have hide/show selected when dragging, it behaves as if the axis were visible).
I hope you like it!!!
Nelson