set to {};
for {set j 0} {$j < 100} {incr j} {
set o 0;
for {set i 0} {$i < 100} {incr i} {
set o [expr $o+rand()]
};
lappend to $o
}A hundred times a hundred throws on a row, with the averages stored in a list in variable to. Now let's draw the results to scale, rounding to whole numbers in a little graph:
canvas .c
pack .c -expand y -fill both
for {set i 0} {$i < [llength $to]} {incr i} {
.c create line $i 100 $i [expr 100-[lindex $to $i]] -tag g1
}
For electronicists probably a perfect enough little distribution graph, no unlikely things like a hundred events with expectation value of 0.5 adding up to very far from 50, no clear patterns, clearly a near white noise source.Now let's analyze the distribution of the averages, by making a (sampled) distribution graph, which the values in this graph are limited to whole numbers, and the relative frequency of all occuring results plotted, to see if we get near the theoretical 'normal' or gaussian distribution.I'll make a new page on Gaussian Distribution.Also see Throwing Two Dice.What is the relevance of this subject? First it's fun to do these things in tcl, it's a whole lot of work in other environments, and not a quarter of the fun.Main line scientific applications are:
- quantum physics theory
- electronical circuit analysis
- quantized signal analysis
- in the physicists sense but less elevated: all measurement based data bein processed
- event systems, where usually the distribution of events has well defines statistical sides to it
- System analysis, where a lot of crap can be prevented by getting you statistics right.
TP Not so random coin toss: http://www.npr.org/features/feature.php?wfId=1697475The audio available on this page is worth a listen.
FW: There is such thing as a 100-sided (d100) die. [1]
[ Category Mathematics | Category Plotting ]
