Search

 
Many
people, I suspect, have trouble with probability
problems, even when you think you understand the concepts.
Like rate problems ( a chicken and a half lays an egg and a half
in a day and a half...), or crossword puzzles, it seems that the
more you solve, the easier they get.
As a result of
difficulty with a specific problem a couple of weeks ago, I
decided that a generalized probability calculator would be a
handy tool to have. Being optimistic by nature, I thought,
"how hard can it be?". As usual, harder than
I thought.
The result posted
today does a good job of solving the simplest probability types,
those with only two outcomes (success/fail, true/false.
heads/tails, red/not red, etc.) and from two common types of
experiments.
 Bernoulli
trials, those which have two outcomes and are independent of
previous trials of the same experiment. 
 Hypergeometric
trials which have two outcomes but are not independent
because each experiment removes one or more samples
from the population being tested. Dealing cards
from a deck or drawing balls from bag are common
examples. 
Neither this page
nor the program will work well as a tutorial  others have done
a better job than I ever could  but it may be useful in solving
problems or verifying solutions to problems you have solved on
your own.
The rest of the
universe of probability problems did not seem to fall into
easily presented templates. I suspect such templates
exist, but I just have not solved enough problems yet to
recognize them. As an alternative, I added a page with a
generalized arithmetic expression evaluator including an upgrade
to add Fact and Combo functions to calculate
factorials and combination values.
The general
procedure learned in solving sample problems for this program is
to get the probability for a specific single instance of
the situation to be tested and then multiply that by the number
of ways other instances could occur. So, for example, to
calculate the probability of rolling a pair if 3 dice are thrown
we can proceed this way:
 The probability
of {1,1,2} is 1/6*1/6*1/6=1/216 (or 1 case out of 216
possible if you prefer to think of it that way) . 
 The
"1" could be one of 6 numbers and the
"2" could be any one of the other 5 so the
probability of {N, N, not N} is 6*5*(1/216)=30/216. 
 Now the N's
could appear in other places, specifically the
number ways to select two spots for the N's is the
number ways to pick two locations out of the three
available, denoted "3 choose 2" or 3C2 or for my
programs Combo(3,2). the answer is 3. By the
way, you could also choose the number of ways to choose a
location for the "not N", 3C1 which
is, of course, also 3. So our final probability
calculation is 3*(30/216) = 90/216=0.417. (I hope!.) 
Well, as usual,
have fun, if you find problems with my code or sample problems
please send feedback so I can fix it.
Nonprogrammers are welcome to
read on, but may want to skip to the bottom
of this page to download executable version of the
program.
Notes for programmer's
Most of the problems with implementing the program were
mathematical not programming. It took a bit to figure out
how to extend the TExParser class to include Fact
and Combo functions.
The program uses units from our DFF Library so a
onetime download of DFFLIBV05 or later will be required to
recompile the program.
Addendum November 15, 2012: Version 2 posted today
adds the ability to define, save, and reload additional probability problems in the
Advanced Problems sections.
There are 4 field types saved with each
problem:
 Problem name, 
 a one line problem description, 
 the expression which calculates the probability of a single trial,
and 
 a 4 line "Rationale" section to describe how the expression
represents the successful outcomes to be divided by total possible
outcomes to produce the probability. 
Running/Exploring the Program
Suggestions for Further Explorations

More problem templates? Nov.
15, 2012: Even better, Version 2 allows users to define, solve and
save additional problems, 

Code to intercept parsing and
evaluation errors in the expression evaluator. Current
default error reporting is OK, but not integrated into the
program. 
Created: March19,
2006 
Modified:
July 29, 2017 

