<< Chapter < Page | Chapter >> Page > |
Often it is desirable to have a table of the generating minterm vectors. Use of the function minterm in a simple “for loop” yields the following m-function.
The function mintable(n) Generates a table of minterm vectors for n generating sets.
>>M3 = mintable(3)
M3 = 0 0 0 0 1 1 1 10 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1
As an application of mintable, consider the problem of determining the probability of k of n events. If is any finite class of events, the event that exactly k of these events occur on a trial can be characterized simply in terms of the minterm expansion. The event that exactly k occur is given by
In the matrix
M = mintable(n)
these are the minterms corresponding to columns
with exactly
k ones. The event
that
k or more occur is given by
If we have the minterm probabilities, it is easy to pick out the appropriate minterms and combine the probabilities. The following example in the case of three variables illustratesthe procedure.
In the software survey problem, the minterm probabilities are
where event has word processor, event has spread sheet, event has a data base program. It is desired to get the probability an individual selected has k of these, .
SOLUTION
We form a mintable for three variables. We count the number of “successes” corresponding to each minterm by using the MATLAB function sum, which gives the sum of each column. In thiscase, it would be easy to determine each distinct value and add the probabilities on the minterms which yield this value. For more complicated cases, we have an m-function called csort (for sort and consolidate) to perform this operation.
>>pm = 0.01*[0 5 10 5 20 10 40 10];>>M = mintable(3)
M =0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 10 1 0 1 0 1 0 1>>T = sum(M) % Column sums give number
T = 0 1 1 2 1 2 2 3 % of successes on each>>[k,pk] = csort(T,pm); % minterm, determines% distinct values in T and>>disp([k;pk]') % consolidates probabilities0 0
1.0000 0.35002.0000 0.5500
3.0000 0.1000
For three variables, it is easy enough to identify the various combinations “by eye”and make the combinations. For a larger number of variables, however, this may become tedious. The approach is much more useful in the case of Independent Events , because of the ease of determining the minterm probabilities.
Minvec procedures
Use of the tilde to indicate the complement of an event is often awkward. It is customary to indicate the complement ofan event E by E c . In MATLAB, we cannot indicate the superscript, so we indicate the complement by instead of . To facilitate writing combinations, we have a family of minvec procedures (minvec3, minvec4, ..., minvec10) to expedite expressing Boolean combinations of sets. These generate and name the minterm vector for each generating set and its complement.
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?