Untitled Page 7
- Page ID
- 125281
Chapter 2. Minterm Analysis
2.1. Minterms^{*}
Introduction
A fundamental problem in elementary probability is to find the probability of a logical (Boolean) combination of a finite class of events, when the probabilities of certain other combinations are known. If we partition an event F into component events whose probabilities can be determined, then the additivity property implies the probability of F is the sum of these component probabilities. Frequently, the event F is a Boolean combination of members of a finite class– say, or . For each such finite class, there is a fundamental partition determined by the class. The members of this partition are called minterms. Any Boolean combination of members of the class can be expressed as the disjoint union of a unique subclass of the minterms. If the probability of every minterm in this subclass can be determined, then by additivity the probability of the Boolean combination is determined. We examine these ideas in more detail.
Partitions and minterms
To see how the fundamental partition arises naturally, consider first the partition of the basic space produced by a single event A.
Now if B is a second event, then
The pair has partitioned Ω into . Continuation is this way leads systematically to a partition by three events , four events , etc.
We illustrate the fundamental patterns in the case of four events . We form the minterms as intersections of members of the class, with various patterns of complementation. For a class of four events, there are 2^{4}=16 such patterns, hence 16 minterms. These are, in a systematic arrangement,
A^{c} B^{c} C^{c} D^{c} | A^{c} B C^{c} D^{c} | A B^{c} C^{c} D^{c} | A B C^{c} D^{c} |
A^{c} B^{c} C^{c} D | A^{c} B C^{c} D | A B^{c} C^{c} D | A B C^{c} D |
No element can be in more than one minterm, because each differs from the others by complementation of at least one member event. Each element ω is assigned to exactly one of the minterms by determining the answers to four questions:
Is it in A? Is it in B? Is it in C? Is it in D?
Suppose, for example, the answers are: Yes, No, No, Yes. Then ω is in the minterm AB^{c}C^{c}D. In a similar way, we can determine the membership of each ω in the basic space. Thus, the minterms form a partition. That is, the minterms represent mutually exclusive events, one of which is sure to occur on each trial. The membership of any minterm depends upon the membership of each generating set or D, and the relationships between them. For some classes, one or more of the minterms are empty (impossible events). As we see below, this causes no problems.
An examination of the development above shows that if we begin with a class of n events, there are 2^{n} minterms. To aid in systematic handling, we introduce a simple numbering system for the minterms, which we illustrate by considering again the four events , in that order. The answers to the four questions above can be represented numerically by the scheme
No ∼0 and Yes ∼1
Thus, if ω is in A^{c}B^{c}C^{c}D^{c}, the answers are tabulated as . If ω is in AB^{c}C^{c}D, then this is designated . With this scheme, the minterm arrangement above becomes
0000 ∼ 0 | 0100 ∼ 4 | 1000 ∼ 8 | 1100 ∼ 12 |
0001 ∼ 1 | 0101 ∼ 5 | 1001 ∼ 9 | 1101 ∼ 13 |
0010 ∼ 2 | 0110 ∼ 6 | 1010 ∼ 10 | 1110 ∼ 14 |
0011 ∼ 3 | 0111 ∼ 7 | 1011 ∼ 11 | 1111 ∼ 15 |
We may view these quadruples of zeros and ones as binary representations of integers, which may also be represented by their decimal equivalents, as shown in the table. Frequently, it is useful to refer to the minterms by number. If the members of the generating class are treated in a fixed order, then each minterm number arrived at in the manner above specifies a minterm uniquely. Thus, for the generating class , in that order, we may designate
We utilize this numbering scheme on special Venn diagrams called minterm maps. These are illustrated in Figure 2.1, for the cases of three, four, and five generating events. Since the actual content of any minterm depends upon the sets , and D in the generating class, it is customary to refer to these sets as variables. In the three-variable case, set A is the right half of the diagram and set C is the lower half; but set B is split, so that it is the union of the second and fourth columns. Similar splits occur in the other cases.
Remark. Other useful arrangements of minterm maps are employed in the analysis of switching circuits.
Minterm maps and the minterm expansion
The significance of the minterm partition of the basic space rests in large measure on the following fact.
Minterm expansion
Each Boolean combination of the elements in a generating class may be expressed as the disjoint union of an appropriate subclass of the minterms. This representation is known as the minterm expansion for the combination.
In deriving an expression for a given Boolean combination which holds for any class of four events, we include all possible minterms, whether empty or not. If a minterm is empty for a given class, its presence does not modify the set content or probability assignment for the Boolean combination.
The existence and uniqueness of the expansion is made plausible by simple examples utilizing minterm maps to determine graphically the minterm content of various Boolean combinations. Using the arrangement and numbering system introduced above, we let M_{i} represent the ith minterm (numbering from zero) and let p(i) represent the probability of that minterm. When we deal with a union of minterms in a minterm expansion, it is convenient to utilize the shorthand illustrated in the following.
Consider the following simple example.
Suppose . Examination of the minterm map in Figure 2.2 shows that AB consists of the union of minterms , which we designate . The combination , so that its complement . This leaves the common part . Hence, . Similarly, .
A key to establishing the expansion is to note that each minterm is either a subset of the combination or is disjoint from it. The expansion is thus the union of those minterms included in the combination. A general verification using indicator functions is sketched in the last section of this module.
Use of minterm maps
A typical problem seeks the probability of certain Boolean combinations of a class of events when the probabilities of various other combinations is given. We consider several simple examples and illustrate the use of minterm maps in formulation and solution.
Statistical data are taken for a certain student population with personal computers. An individual is selected at random. Let A= the event the person selected has word processing, B= the event he or she has a spread sheet program, and C= the event the person has a data base program. The data imply
The probability is 0.80 that the person has a word processing program: P(A)=0.8
The probability is 0.65 that the person has a spread sheet program: P(B)=0.65
The probability is 0.30 that the person has a data base program: P(C)=0.3
The probability is 0.10 that the person has all three: P(ABC)=0.1
The probability is 0.05 that the person has neither word processing nor spread sheet:
The probability is 0.65 that the person has at least two: P(AB∪AC∪BC)=0.65
The probability of word processor and data base, but no spread sheet is twice the probabilty of spread sheet and data base, but no word processor:
What is the probability that the person has exactly two of the programs?
What is the probability that the person has only the data base program?
Several questions arise:
Are these data consistent?
Are the data sufficient to answer the questions?
How may the data be utilized to anwer the questions?
SOLUTION
The data, expressed in terms of minterm probabilities, are:
P(A)=p(4,5,6,7)=0.80; hence
P(B)=p(2,3,6,7)=0.65; hence
P(C)=p(1,3,5,7)=0.30; hence
P(AB∪AC∪BC)=p(3,5,6,7)=0.65
These data are shown on the minterm map in Figure 3a. We use the patterns displayed in the minterm map to aid in an algebraic solution for the various minterm probabilities.
p(2,3)=p(0,1,2,3)–p(0,1)=0.20–0.05=0.15
p(6,7)=p(2,3,6,7)–p(2,3)=0.65–0.15=0.50
p(6)=p(6,7)–p(7)=0.50–0.10=0.40
p(4)=p(4,5,6,7)–p(5)–p(6,7)=0.80–0.10–0.50=0.20
Thus, all minterm probabilities are determined. They are displayed in Figure 3b. From these we get
A survey of 1000 students shows that 565 have PC compatible desktop computers, 515 have Macintosh desktop computers, and 151 have laptop computers. 51 have all three, 124 have both PC and laptop computers, 212 have at least two of the three, and twice as many own both PC and laptop as those who have both Macintosh desktop and laptop. A person is selected at random from this population. What is the probability he or she has at least one of these types of computer? What is the probability the person selected has only a laptop?
SOLUTION
Let A= the event of owning a PC desktop, B= the event of owning a Macintosh desktop, and C= the event of owning a laptop. We utilize a minterm map for three variables to help determine minterm patterns. For example, the event AC=M_{5}⋁M_{7} so that P(AC)=p(5)+p(7)=p(5,7).
The data, expressed in terms of minterm probabilities, are:
P(A)=p(4,5,6,7)=0.565, hence
P(B)=p(2,3,6,7)=0.515, hence
P(C)=p(1,3,5,7)=0.151, hence
P(AB∪AC∪BC)=p(3,5,6,7)=0.212
P(AC)=p(5,7)=2p(3,7)=2P(BC)
We use the patterns displayed in the minterm map to aid in an algebraic solution for the various minterm probabilities.
p(5)=p(5,7)–p(7)=0.124–0.051=0.073
p(3,7)=P(BC)=0.124/2=0.062
p(3)=0.062–0.051=0.011
p(6)=p(3,4,6,7)–p(3)–p(5,7)=0.212–0.011–0.124=0.077
p(4)=P(A)–p(6)–p(5,7)=0.565–0.077–0.1124=0.364
p(1)=p(1,3)–p(3)=0.027–0.11=0.016
p(2)=P(B)–p(3,7)–p(6)=0.515–0.062–0.077=0.376
We have determined the minterm probabilities, which are displayed on the minterm map Figure 2.4. We may now compute the probability of any Boolean combination of the generating events . Thus,
A survey of 1000 persons is made to determine their opinions on four propositions. Let A,B,C,D be the events a person selected agrees with the respective propositions. Survey results show the following probabilities for various combinations:
Determine the probabilities for each minterm and for each of the following combinations
– that is, not A and (B or C, but not both)
A∪BC^{c} – that is, A or (B and not C)
SOLUTION
At the outset, it is not clear that the data are consistent or sufficient to determine the minterm probabilities. However, an examination of the data shows that there are sixteen items (including the fact that the sum of all minterm probabilities is one). Thus, there is hope, but no assurance, that a solution exists. A step elimination procedure, as in the previous examples, shows that all minterms can in fact be calculated. The results are displayed on the minterm map in Figure 2.5. It would be desirable to be able to analyze the problem systematically. The formulation above suggests a more systematic algebraic formulation which should make possible machine aided solution.
Systematic formulation
Use of a minterm map has the advantage of visualizing the minterm expansion in direct relation to the Boolean combination. The algebraic solutions of the previous problems involved ad hoc manipulations of the data minterm probability combinations to find the probability of the desired target combination. We seek a systematic formulation of the data as a set of linear algebraic equations with the minterm probabilities as unknowns, so that standard methods of solution may be employed. Consider again the software survey of Example 2.2.
The data, expressed in terms of minterm probabilities, are:
P(A)=p(4,5,6,7)=0.80
P(B)=p(2,3,6,7)=0.65
P(C)=p(1,3,5,7)=0.30
P(ABC)=p(7)=0.10
P(AB∪AC∪BC)=p(3,5,6,7)=0.65
, so that p(5)–2p(3)=0
We also have in any case
to complete the eight items of data needed for determining all eight minterm probabilities. The first datum can be expressed as an equation in minterm probabilities:
This is an algebraic equation in with a matrix of coefficients
The others may be written out accordingly, giving eight linear algebraic equations in eight variables p(0) through p(7). Each equation has a matrix or vector of zero-one coefficients indicating which minterms are included. These may be written in matrix form as follows:
The patterns in the coefficient matrix are determined by logical operations. We obtained these with the aid of a minterm map.
The solution utilizes an algebraic procedure, which could be carried out in a variety of ways, including several standard computer packages for matrix operations.
We show in the module Minterm Vectors and MATLAB how we may use MATLAB for both aspects.
Indicator functions and the minterm expansion
Previous discussion of the indicator function shows that the indicator function for a Boolean combination of sets is a numerical valued function of the indicator functions for the individual sets.
As an indicator function, it takes on only the values zero and one.
The value of the indicator function for any Boolean combination must be constant on each minterm. For example, for each ω in the minterm AB^{c}CD^{c}, we must have , and I_{D}(ω)=0. Thus, any function of must be constant over the minterm.
Consider a Boolean combination E of the generating sets. If ω is in E∩M_{i}, then I_{E}(ω)=1 for all ω∈M_{i}, so that M_{i}⊂E. Since each ω∈M_{i} for some i,E must be the union of those minterms sharing an ω with E.
Let be the subclass of those minterms on which I_{E} has the value one. Then
(2.14)which is the minterm expansion of E.
2.2. Minterms and MATLAB Calculations^{*}
The concepts and procedures in this unit play a significant role in many aspects of the analysis of probability topics and in the use of MATLAB throughout this work.
Minterm vectors and MATLAB
The systematic formulation in the previous module Minterms shows that each Boolean combination, as a union of minterms, can be designated by a vector of zero-one coefficients. A coefficient one in the ith position (numbering from zero) indicates the inclusion of minterm M_{i} in the union. We formulate this pattern carefully below and show how MATLAB logical operations may be utilized in problem setup and solution.
Suppose E is a Boolean combination of . Then, by the minterm expansion,
where M_{i} is the ith minterm and J_{E} is the set of indices for those M_{i} included in E. For example, consider
We may designate each set by a pattern of zeros and ones . The ones indicate which minterms are present in the set. In the pattern for set E, minterm M_{i} is included in E iff e_{i}=1. This is, in effect, another arrangement of the minterm map. In this form, it is convenient to view the pattern as a minterm vector, which may be represented by a row matrix or row vector . We find it convenient to use the same symbol for the name of the event and for the minterm vector or matrix representing it. Thus, for the examples above,
It should be apparent that this formalization can be extended to sets generated by any finite class.
Minterm vectors for Boolean combinations
If E and F are combinations of n generating sets, then each is represented by a unique minterm vector of length 2^{n}. In the treatment in the module Minterms, we determine the minterm vector with the aid of a minterm map. We wish to develop a systematic way to determine these vectors.
As a first step, we suppose we have minterm vectors for E and F and want to obtain the minterm vector of Boolean combinations of these.
The minterm expansion for E∪F has all the minterms in either set. This means the jth element of the vector for E∪F is the maximum of the jth elements for the two vectors.
The minterm expansion for E∩F has only those minterms in both sets. This means the jth element of the vector for E∩F is the minimum of the jth elements for the two vectors.
The minterm expansion for E^{c} has only those minterms not in the expansion for E. This means the vector for E^{c} has zeros and ones interchanged. The jth element of E^{c} is one iff the corresponding element of E is zero.
We illustrate for the case of the two combinations E and F of three generating sets, considered above
Then
MATLAB logical operations
MATLAB logical operations on zero-one matrices provide a convenient way of handling Boolean combinations of minterm vectors represented as matrices. For two zero-one matrices of the same size
: E|F is the matrix obtained by taking the maximum element in each place. |
: E&F is the matrix obtained by taking the minimum element in each place. |
: E^{C} is the matrix obtained by interchanging one and zero in each place in E. |
Thus, if are minterm vectors for sets by the same name, then E|F is the minterm vector for E∪F, E&F is the minterm vector for E∩F, and E=1–E is the minterm vector for E^{c}.
This suggests a general approach to determining minterm vectors for Boolean combinations.
Start with minterm vectors for the generating sets.
Use MATLAB logical operations to obtain the minterm vector for any Boolean combination.
Suppose, for example, the class of generating sets is . Then the minterm vectors for , and C, respectively, are
If E=AB∪C^{c}, then the logical combination of the matrices yields .
MATLAB implementation
A key step in the procedure just outlined is to obtain the minterm vectors for the generating
elements . We have an m-function to provide
such fundamental vectors. For example to produce the second minterm vector for the family
(i.e., the minterm vector for B), the basic zero-one pattern 0 0 1 1
is replicated
twice to give
0 0 1 1 0 0 1 1
The function minterm(n,k) generates the kth minterm vector for a class of n generating sets.
>> A = minterm(3,1) A = 0 0 0 0 1 1 1 1 >> B = minterm(3,2) B = 0 0 1 1 0 0 1 1 >> C = minterm(3,3) C = 0 1 0 1 0 1 0 1
F = (A&B)|(~B&C) F = 0 1 0 0 0 1 1 1 >> G = A|(~A&C) G = 0 1 0 1 1 1 1 1 >> JF = find(F)-1 % Use of find to determine index set for F JF = 1 5 6 7 % Shows F = M(1, 5, 6, 7)
These basic minterm patterns are useful not only for Boolean combinations of events but also for many aspects of the analysis of those random variables which take on only a finite number of values.
Zero-one arrays in MATLAB
The treatment above hides the fact that a rectangular array of zeros and ones can have two quite different meanings and functions in MATLAB.
A numerical matrix (or vector) subject to the usual operations on matrices..
A logical array whose elements are combined by a. Logical operators to give new logical arrays; b. Array operations (element by element) to give numerical matrices; c. Array operations with numerical matrices to give numerical results.
Some simple examples will illustrate the principal properties.
>>> A = minterm(3,1); >> B = minterm(3,2); >> C = minterm(3,3); >> F = (A&B)|(~B&C) F = 0 1 0 0 0 1 1 1 >> G = A|(~A&C) G = 0 1 0 1 1 1 1 1 >> islogical(A) % Test for logical array ans = 0 >> islogical(F) ans = 1 >> m = max(A,B) % A matrix operation m = 0 0 1 1 1 1 1 1 >> islogical(m) ans = 0 >> m1 = A|B % A logical operation m1 = 0 0 1 1 1 1 1 1 >> islogical(m1) ans = 1 >> a = logical(A) % Converts 0-1 matrix into logical array a = 0 0 0 0 1 1 1 1 >> b = logical(B) >> m2 = a|b m2 = 0 0 1 1 1 1 1 1 >> p = dot(A,B) % Equivalently, p = A*B' p = 2 >> p1 = total(A.*b) p1 = 2 >> p3 = total(A.*B) p3 = 2 >> p4 = a*b' % Cannot use matrix operations on logical arrays ??? Error using ==> mtimes % MATLAB error signal Logical inputs must be scalar.
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 1 0 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 A_{kn} 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 B_{kn} 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 illustrates the procedure.
In the software survey problem, the minterm probabilities are
where A= event has word processor, B= event has spread sheet, C= 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 this case, 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 1 0 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 probabilities 0 0 1.0000 0.3500 2.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 of an event E by E^{c}. In MATLAB, we cannot indicate the superscript, so we indicate the complement by E^{c} instead of ∼E. To facilitate writing combinations, we have a family of minvec procedures (minvec3, minvec4, ..., minvec10) to expedite expressing Boolean combinations of n=3,4,5,⋯,10 sets. These generate and name the minterm vector for each generating set and its complement.
We wish to generate a matrix whose rows are the minterm vectors for Ω=A∪A^{c}, A, AB, ABC, C, and A^{c}C^{c}, respectively.
>> minvec3 % Call for the setup procedure Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired >> V = [A|Ac; A; A&B; A&B&C; C; Ac&Cc]; % Logical combinations (one per % row) yield logical vectors >> disp(V) 1 1 1 1 1 1 1 1 % Mixed logical and 0 0 0 0 1 1 1 1 % numerical vectors 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0
Minterm probabilities and Boolean combination
If we have the probability of every minterm generated by a finite class, we can determine the probability of any Boolean combination of the members of the class. When we know the minterm expansion or, equivalently, the minterm vector, we simply pick out the probabilities corresponding to the minterms in the expansion and add them. In the following example, we do this “by hand” then show how to do it with MATLAB .
Consider and F=A^{c}B^{c}∪AC of the example above, and suppose the respective minterm probabilities are
Use of a minterm map shows and . so that
This is easily handled in MATLAB.
Use minvec3 to set the generating minterm vectors.
Use logical matrix operations
(2.27)to obtain the (logical) minterm vectors for E and F.
If pm is the matrix of minterm probabilities, perform the algebraic dot product or scalar product of the pm matrix and the minterm vector for the combination. This can be called for by the MATLAB commands PE = E*pm' and PF = F*pm' .
The following is a transcript of the MATLAB operations.
>> minvec3 % Call for the setup procedure Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. >> E = (A&(B|Cc))|(Ac&~(B|Cc)); >> F = (Ac&Bc)|(A&C); >> pm = 0.01*[21 6 29 11 9 3 14 7]; >> PE = E*pm' % Picks out and adds the minterm probabilities PE = 0.3600 >> PF = F*pm' PF = 0.3700
We set up the matrix equations with the use of MATLAB and solve for the minterm probabilities. From these, we may solve for the desired “target” probabilities.
>> minvec3 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Data vector combinations are: >> DV = [A|Ac; A; B; C; A&B&C; Ac&Bc; (A&B)|(A&C)|(B&C); (A&Bc&C) - 2*(Ac&B&C)] DV = 1 1 1 1 1 1 1 1 % Data mixed numerical 0 0 0 0 1 1 1 1 % and logical vectors 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 -2 0 1 0 0 >> DP = [1 0.8 0.65 0.3 0.1 0.05 0.65 0]; % Corresponding data probabilities >> pm = DV\DP' % Solution for minterm probabilities pm = -0.0000 % Roundoff -3.5 x 10-17 0.0500 0.1000 0.0500 0.2000 0.1000 0.4000 0.1000 >> TV = [(A&B&Cc)|(A&Bc&C)|(Ac&B&C); Ac&Bc&C] % Target combinations TV = 0 0 0 1 0 1 1 0 % Target vectors 0 1 0 0 0 0 0 0 >> PV = TV*pm % Solution for target probabilities PV = 0.5500 % Target probabilities 0.0500
The previous procedure first obtained all minterm probabilities, then used these to determine probabilities for the target combinations. The following procedure does not require calculation of the minterm probabilities. Sometimes the data are not sufficient to calculate all minterm probabilities, yet are sufficient to allow determination of the target probabilities.
Suppose the data minterm vectors are linearly independent, and the target minterm vectors are linearly dependent upon the data vectors (i.e., the target vectors can be expressed as linear combinations of the data vectors). Now each target probability is the same linear combination of the data probabilities. To determine the linear combinations, solve the matrix equation
Then the matrix tp of target probabilities is given by tp=CT*DP^{'}. Continuing the MATLAB procedure above, we have:
>> CT = TV/DV;
>> tp = CT*DP'
tp = 0.5500 0.0500
The procedure mincalc
The procedure mincalc performs calculations as in the preceding examples. The refinements consist of determining consistency and computability of various individual minterm probabilities and target probilities. The consistency check is principally for negative minterm probabilities. The computability tests are tests for linear independence by means of calculation of ranks of various matrices. The procedure picks out the computable minterm probabilities and the computable target probabilities and calculates them.
To utilize the procedure, the problem must be formulated appropriately and precisely, as follows:
Use the MATLAB program minvecq to set minterm vectors for each of q basic events.
Data consist of Boolean combinations of the basic events and the respective probabilities of these combinations. These are organized into two matrices:
The data vector matrix DV has the data Boolean combinations– one on each row. MATLAB translates each row into the minterm vector for the corresponding Boolean combination. The first entry (on the first row) is A |Ac (for A⋁A^{c}), which is the whole space. Its minterm vector consists of a row of ones.
The data probability matrix DP is a row matrix of the data probabilities. The first entry is one, the probability of the whole space.
The objective is to determine the probability of various target Boolean combinations. These are put into the target vector matrix TV, one on each row. MATLAB produces the minterm vector for each corresponding target Boolean combination.
Computational note. In mincalc, it is necessary to turn the arrays DV and TV consisting of
zero-one patterns into zero-one matrices. This is accomplished for DV by the
operation DV = ones(size(DV)).*DV
. and similarly for TV. Both the original and the
transformed matrices have the same zero-one pattern, but MATLAB interprets them differently.
Usual case
Ṡuppose the data minterm vectors are linearly independent and the target vectors are each linearly dependent on the data minterm vectors. Then each target minterm vector is expressible as a linear combination of data minterm vectors. Thus, there is a matrix CT such that TV=CT*DV. MATLAB solves this with the command CT=TV/DV. The target probabilities are the same linear combinations of the data probabilities. These are obtained by the MATLAB operation tp=DP*CT^{'}.
Cautionary notes
The program mincalc depends upon the provision in MATLAB for solving equations when less than full data are available (based on the singular value decomposition). There are several situations which should be dealt with as special cases. It is usually a good idea to check results by hand to determine whether they are consistent with data. The checking by hand is usually much easier than obtaining the solution unaided, so that use of MATLAB is advantageous even in questionable cases.
The Zero Problem. If the total probability of a group of minterms is zero, then it follows that the probability of each minterm in the group is zero. However, if mincalc does not have enough information to calculate the separate minterm probabilities in the case they are not zero, it will not pick up in the zero case the fact that the separate minterm probabilities are zero. It simply considers these minterm probabilities not computable.
Linear dependence. In the case of linear dependence, the operation called for by the command CT = TV/DV may not be able to solve the equations. The matrix may be singular, or it may not be able to decide which of the redundant data equations to use. Should it provide a solution, the result should be checked with the aid of a minterm map.
Consistency check. Since the consistency check is for negative minterms, if there are not enough data to calculate the minterm probabilities, there is no simple check on the consistency. Sometimes the probability of a target vector included in another vector will actually exceed what should be the larger probability. Without considerable checking, it may be difficult to determine consistency.
In a few unusual cases, the command CT = TV/DV does not operate appropriately, even though the data should be adequate for the problem at hand. Apparently the approximation process does not converge.
MATLAB Solutions for examples using mincalc
% file mcalc01 Data for software survey minvec3; DV = [A|Ac; A; B; C; A&B&C; Ac&Bc; (A&B)|(A&C)|(B&C); (A&Bc&C) - 2*(Ac&B&C)]; DP = [1 0.8 0.65 0.3 0.1 0.05 0.65 0]; TV = [(A&B&Cc)|(A&Bc&C)|(Ac&B&C); Ac&Bc&C]; disp('Call for mincalc') >> mcalc01 % Call for data Call for mincalc % Prompt supplied in the data file >> mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.5500 2.0000 0.0500 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA >> disp(PMA) % Optional call for minterm probabilities 0 0 1.0000 0.0500 2.0000 0.1000 3.0000 0.0500 4.0000 0.2000 5.0000 0.1000 6.0000 0.4000 7.0000 0.1000
% file mcalc02.m Data for computer survey minvec3 DV = [A|Ac; A; B; C; A&B&C; A&C; (A&B)|(A&C)|(B&C); ... 2*(B&C) - (A&C)]; DP = 0.001*[1000 565 515 151 51 124 212 0]; TV = [A|B|C; Ac&Bc&C]; disp('Call for mincalc') >> mcalc02 Call for mincalc >> mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.9680 2.0000 0.0160 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA >> disp(PMA) 0 0.0320 1.0000 0.0160 2.0000 0.3760 3.0000 0.0110 4.0000 0.3640 5.0000 0.0730 6.0000 0.0770 7.0000 0.0510
% file mcalc03.m Data for opinion survey minvec4 DV = [A|Ac; A; B; C; D; A&(B|Cc)&Dc; A|((B&C)|Dc) ; Ac&B&Cc&D; ... A&B&C&D; A&Bc&C; Ac&Bc&Cc&D; Ac&B&C; Ac&Bc&Dc; A&Cc; A&C&Dc; A&B&Cc&Dc]; DP = 0.001*[1000 200 500 300 700 55 520 200 15 30 195 120 120 ... 140 25 20]; TV = [Ac&((B&Cc)|(Bc&C)); A|(B&Cc)]; disp('Call for mincalc') >> mincalc03 Call for mincalc >> mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.4000 2.0000 0.4800 The number of minterms is 16 The number of available minterms is 16 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA >> disp(minmap(pma)) % Display arranged as on minterm map 0.0850 0.0800 0.0200 0.0200 0.1950 0.2000 0.0500 0.0500 0.0350 0.0350 0.0100 0.0150 0.0850 0.0850 0.0200 0.0150
The procedure mincalct
A useful modification, which we call mincalct, computes the available target probabilities, without checking and computing the minterm probabilities. This procedure assumes a data file similar to that for mincalc, except that it does not need the target matrix TV, since it prompts for target Boolean combination inputs. The procedure mincalct may be used after mincalc has performed its operations to calculate probabilities for additional target combinations.
Suppose mincalc has been applied to the data for the opinion survey and that it is desired to determine . It is not necessary to recalculate all the other quantities. We may simply use the procedure mincalct and input the desired Boolean combination at the prompt.
>> mincalct Enter matrix of target Boolean combinations (A&D)|(B&Dc) Computable target probabilities 1.0000 0.2850
Repeated calls for mcalct may be used to compute other target probabilities.
2.3. Problems on Minterm Analysis^{*}
Consider the class of events. Suppose the probability that at least one of the events A or C occurs is 0.75 and the probability that at least one of the four events occurs is 0.90. Determine the probability that neither of the events A or C but at least one of the events B or D occurs.
Use the pattern and (A∪C)^{c}=A^{c}C^{c}.
Use minterm maps to show which of the following statements are true for any class :
Repeat part (1) using indicator functions (evaluated on minterms).
Repeat part (1) using the m-procedure minvec3 and MATLAB logical operations.
We use the MATLAB procedure, which displays the essential patterns.
minvec3 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. E = A|~(B&C); F = A|B|(Bc&Cc); disp([E;F]) 1 1 1 0 1 1 1 1 % Not equal 1 0 1 1 1 1 1 1 G = ~(A|B); H = (Ac&C)|(Bc&C); disp([G;H]) 1 1 0 0 0 0 0 0 % Not equal 0 1 0 1 0 1 0 0 K = (A&B)|(A&C)|(B&C); disp([A;K]) 0 0 0 0 1 1 1 1 % A not contained in K 0 0 0 1 0 1 1 1
Use (1) minterm maps, (2) indicator functions (evaluated on minterms), (3) the m-procedure minvec3 and MATLAB logical operations to show that
We use the MATLAB procedure, which displays the essential patterns.
minvec3 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. E = (A&(B|Cc))|(Ac&B&C); F = (A&((B&C)|Cc))|(Ac&B); disp([E;F]) 0 0 0 1 1 0 1 1 % E subset of F 0 0 1 1 1 0 1 1 G = A|(Ac&B&C); H = (A&B)|(B&C)|(A&C)|(A&Bc&Cc); disp([G;H]) 0 0 0 1 1 1 1 1 % G = H 0 0 0 1 1 1 1 1
Minterms for the events {A,B,C,D}, arranged as on a minterm map are
0.0168 0.0072 0.0252 0.0108 0.0392 0.0168 0.0588 0.0252 0.0672 0.0288 0.1008 0.0432 0.1568 0.0672 0.2352 0.1008
What is the probability that three or more of the events occur on a trial? Of exactly two? Of two or fewer?
We use mintable(4) and determine positions with correct number(s) of ones (number of occurrences). An alternate is to use minvec4 and express the Boolean combinations which give the correct number(s) of ones.
npr02_04 Minterm probabilities are in pm. Use mintable(4) a = mintable(4); s = sum(a); % Number of ones in each minterm position P1 = (s>=3)*pm' % Select and add minterm probabilities P1 = 0.4716 P2 = (s==2)*pm' P2 = 0.3728 P3 = (s<=2)*pm' P3 = 0.5284
Minterms for the events {A,B,C,D,E}, arranged as on a minterm map are
0.0216 0.0324 0.0216 0.0324 0.0144 0.0216 0.0144 0.0216 0.0144 0.0216 0.0144 0.0216 0.0096 0.0144 0.0096 0.0144 0.0504 0.0756 0.0504 0.0756 0.0336 0.0504 0.0336 0.0504 0.0336 0.0504 0.0336 0.0504 0.0224 0.0336 0.0224 0.0336
What is the probability that three or more of the events occur on a trial? Of exactly four? Of three or fewer? Of either two or four?
We use mintable(5) and determine positions with correct number(s) of ones (number of occurrences).
npr02_05 Minterm probabilities are in pm. Use mintable(5) a = mintable(5); s = sum(a); % Number of ones in each minterm position P1 = (s>=3)*pm' % Select and add minterm probabilities P1 = 0.5380 P2 = (s==4)*pm' P2 = 0.1712 P3 = (s<=3)*pm' P3 = 0.7952 P4 = ((s==2)|(s==4))*pm' P4 = 0.4784
Suppose
. Determine .
Then determine and , if possible.
% file npr02_06.m % Data file % Data for Exercise 6. minvec3 DV = [A|Ac; A|(Bc&C); A&C; Ac&B; Ac&Cc; B&Cc]; DP = [1 0.65 0.20 0.25 0.25 0.30]; TV = [((A&Cc)|(Ac&C))&Bc; ((A&Bc)|Ac)&Cc; Ac&(B|Cc)]; disp('Call for mincalc') npr02_06 % Call for data Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3000 % The first and third target probability 3.0000 0.3500 % is calculated. Check with minterm map. The number of minterms is 8 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Suppose and . Determine , , and , if possible.
% file npr02_07.m % Data for Exercise 7. minvec3 DV = [A|Ac; ((A&Bc)|(Ac&B))&C; A&B; Ac&Cc; A; C; A&Bc&Cc]; DP = [ 1 0.4 0.2 0.3 0.6 0.5 0.1]; TV = [(Ac&Cc)|(A&C); ((A&Bc)|Ac)&Cc; Ac&(B|Cc)]; disp('Call for mincalc') npr02_07 % Call for data Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.7000 % All target probabilities calculable 2.0000 0.4000 % even though not all minterms are available 3.0000 0.4000 The number of minterms is 8 The number of available minterms is 6 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Suppose
and .
Determine P((A∪B) C^{c}), , and , if possible.
% file npr02_08.m % Data for Exercise 8. minvec3 DV = [A|Ac; A; C; A&C; Ac&B; Ac&Bc&Cc]; DP = [ 1 0.6 0.4 0.3 0.2 0.1]; TV = [(A|B)&Cc; (A&Cc)|(Ac&C); (A&Cc)|(Ac&B)]; disp('Call for mincalc') npr02_08 % Call for data Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.5000 % All target probabilities calculable 2.0000 0.4000 % even though not all minterms are available 3.0000 0.5000 The number of minterms is 8 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Suppose .
Determine and P(AB∪AC∪BC).
Then repeat with additional data and .
% file npr02_09.m % Data for Exercise 9. minvec3 DV = [A|Ac; A; A&B; A&C; A&B&Cc]; DP = [ 1 0.5 0.3 0.3 0.1]; TV = [A&(~(B&Cc)); (A&B)|(A&C)|(B&C)]; disp('Call for mincalc') % Modification for part 2 % DV = [DV; Ac&Bc&Cc; Ac&B&C]; % DP = [DP 0.1 0.05]; npr02_09 % Call for data Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.4000 % Only the first target probability calculable The number of minterms is 8 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA DV = [DV; Ac&Bc&Cc; Ac&B&C]; % Modification of data DP = [DP 0.1 0.05]; mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.4000 % Both target probabilities calculable 2.0000 0.4500 % even though not all minterms are available The number of minterms is 8 The number of available minterms is 6 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Given: , and .
Determine .
% file npr02_10.m % Data for Exercise 10. minvec4 DV = [A|Ac; A; Ac&Bc; A&Cc; A&C&Dc]; DP = [1 0.6 0.2 0.4 0.1]; TV = [(Ac&B)|(A&(Cc|D))]; disp('Call for mincalc') npr02_10 Variables are A, B, C, D, Ac, Bc, Cc, Dc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.7000 % Checks with minterm map solution The number of minterms is 16 The number of available minterms is 0 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
A survey of a represenative group of students yields the following information:
52 percent are male
85 percent live on campus
78 percent are male or are active in intramural sports (or both)
30 percent live on campus but are not active in sports
32 percent are male, live on campus, and are active in sports
8 percent are male and live off campus
17 percent are male students inactive in sports
What is the probability that a randomly chosen student is male and lives on campus?
What is the probability of a male, on campus student who is not active in sports?
What is the probability of a female student active in sports?
% file npr02_11.m % Data for Exercise 11. % A = male; B = on campus; C = active in sports minvec3 DV = [A|Ac; A; B; A|C; B&Cc; A&B&C; A&Bc; A&Cc]; DP = [ 1 0.52 0.85 0.78 0.30 0.32 0.08 0.17]; TV = [A&B; A&B&Cc; Ac&C]; disp('Call for mincalc') npr02_11 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.4400 2.0000 0.1200 3.0000 0.2600 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
A survey of 100 persons of voting age reveals that 60 are male, 30 of whom do not identify with a political party; 50 are members of a political party; 20 nonmembers of a party voted in the last election, 10 of whom are female. How many nonmembers of a political party did not vote? Suggestion Express the numbers as a fraction, and treat as probabilities.
% file npr02_12.m % Data for Exercise 12. % A = male; B = party member; C = voted last election minvec3 DV = [A|Ac; A; A&Bc; B; Bc&C; Ac&Bc&C]; DP = [ 1 0.60 0.30 0.50 0.20 0.10]; TV = [Bc&Cc]; disp('Call for mincalc') npr02_12 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3000 The number of minterms is 8 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
During a period of unsettled weather, let A be the event of rain in Austin, B be the event of rain in Houston, and C be the event of rain in San Antonio. Suppose:
What is the probability of rain in all three cities?
What is the probability of rain in exactly two of the three cities?
What is the probability of rain in exactly one of the cities?
% file npr02_13.m % Data for Exercise 13. % A = rain in Austin; B = rain in Houston; % C = rain in San Antonio minvec3 DV = [A|Ac; A&B; A&Bc; A&C; (A&Bc)|(Ac&B); B&C; Bc&C; Ac&Bc&Cc]; DP = [ 1 0.35 0.15 0.20 0.45 0.30 0.05 0.15]; TV = [A&B&C; (A&B&Cc)|(A&Bc&C)|(Ac&B&C); (A&Bc&Cc)|(Ac&B&Cc)|(Ac&Bc&C)]; disp('Call for mincalc') npr02_13 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.2000 2.0000 0.2500 3.0000 0.4000 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
One hundred students are questioned about their course of study and plans for graduate study. Let A= the event the student is male; B= the event the student is studying engineering; C= the event the student plans at least one year of foreign language; D= the event the student is planning graduate study (including professional school). The results of the survey are:
There are 55 men students; 23 engineering students, 10 of whom are women; 75 students will take foreign language classes, including all of the women; 26 men and 19 women plan graduate study; 13 male engineering students and 8 women engineering students plan graduate study; 20 engineering students will take a foreign language and plan graduate study; 5 non engineering students plan graduate study but no foreign language courses; 11 non engineering, women students plan foreign language study and graduate study.
What is the probability of selecting a student who plans foreign language classes and graduate study?
What is the probability of selecting a women engineer who does not plan graduate study?
What is the probability of selecting a male student who either studies a foreign language but does not intend graduate study or will not study a foreign language but plans graduate study?
% file npr02_14.m % Data for Exercise 14. % A = male; B = engineering; % C = foreign language; D = graduate study minvec4 DV = [A|Ac; A; B; Ac&B; C; Ac&C; A&D; Ac&D; A&B&D; ... Ac&B&D; B&C&D; Bc&Cc&D; Ac&Bc&C&D]; DP = [1 0.55 0.23 0.10 0.75 0.45 0.26 0.19 0.13 0.08 0.20 0.05 0.11]; TV = [C&D; Ac&Dc; A&((C&Dc)|(Cc&D))]; disp('Call for mincalc') npr02_14 Variables are A, B, C, D, Ac, Bc, Cc, Dc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3900 2.0000 0.2600 % Third target probability not calculable The number of minterms is 16 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
A survey of 100 students shows that: 60 are men students; 55 students live on campus, 25 of whom are women; 40 read the student newspaper regularly, 25 of whom are women; 70 consider themselves reasonably active in student affairs—50 of these live on campus; 35 of the reasonably active students read the newspaper regularly; All women who live on campus and 5 who live off campus consider themselves to be active; 10 of the on-campus women readers consider themselves active, as do 5 of the off campus women; 5 men are active, off-campus, non readers of the newspaper.
How many active men are either not readers or off campus?
How many inactive men are not regular readers?
% file npr02_15.m % Data for Exercise 15. % A = men; B = on campus; C = readers; D = active minvec4 DV = [A|Ac; A; B; Ac&B; C; Ac&C; D; B&D; C&D; ... Ac&B&D; Ac&Bc&D; Ac&B&C&D; Ac&Bc&C&D; A&Bc&Cc&D]; DP = [1 0.6 0.55 0.25 0.40 0.25 0.70 0.50 0.35 0.25 0.05 0.10 0.05 0.05]; TV = [A&D&(Cc|Bc); A&Dc&Cc]; disp('Call for mincalc') npr02_15 Variables are A, B, C, D, Ac, Bc, Cc, Dc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3000 2.0000 0.2500 The number of minterms is 16 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
A television station runs a telephone survey to determine how many persons in its primary viewing area have watched three recent special programs, which we call a, b, and c. Of the 1000 persons surveyed, the results are:
221 have seen at least a; 209 have seen at least b; 112 have seen at least c; 197 have seen at least two of the programs; 45 have seen all three; 62 have seen at least a and c; the number having seen at least a and b is twice as large as the number who have seen at least b and c.
(a) How many have seen at least one special?
(b) How many have seen only one special program?
% file npr02_16.m % Data for Exercise 16. minvec3 DV = [A|Ac; A; B; C; (A&B)|(A&C)|(B&C); A&B&C; A&C; (A&B)-2*(B&C)]; DP = [ 1 0.221 0.209 0.112 0.197 0.045 0.062 0]; TV = [A|B|C; (A&Bc&Cc)|(Ac&B&Cc)|(Ac&Bc&C)]; npr02_16 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3000 2.0000 0.1030 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
An automobile safety inspection station found that in 1000 cars tested:
100 needed wheel alignment, brake repair, and headlight adjustment
325 needed at least two of these three items
125 needed headlight and brake work
550 needed at wheel alignment
How many needed only wheel alignment?
How many who do not need wheel alignment need one or none of the other items?
% file npr02_17.m % Data for Exercise 17. % A = alignment; B = brake work; C = headlight minvec3 DV = [A|Ac; A&B&C; (A&B)|(A&C)|(B&C); B&C; A ]; DP = [ 1 0.100 0.325 0.125 0.550]; TV = [A&Bc&Cc; Ac&(~(B&C))]; disp('Call for mincalc') npr02_17 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.2500 2.0000 0.4250 The number of minterms is 8 The number of available minterms is 3 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Suppose .
Determine P(B∪C), , and , if possible.
Repeat the problem with the additional data and .
% file npr02_18.m % Date for Exercise 18. minvec3 DV = [A|Ac; A&(B|C); Ac; Ac&Bc&Cc]; DP = [ 1 0.3 0.6 0.1]; TV = [B|C; (((A&B)|(Ac&Bc))&Cc)|(A&C); Ac&(B|Cc)]; disp('Call for mincalc') % Modification % DV = [DV; Ac&B&C; Ac&B]; % DP = [DP 0.2 0.3]; npr02_18 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.8000 2.0000 0.4000 The number of minterms is 8 The number of available minterms is 2 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA DV = [DV; Ac&B&C; Ac&B]; % Modified data DP = [DP 0.2 0.3]; mincalc % New calculation Data vectors are linearly independent Computable target probabilities 1.0000 0.8000 2.0000 0.4000 3.0000 0.4000 The number of minterms is 8 The number of available minterms is 5 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
A computer store sells computers, monitors, printers. A customer enters the store. Let A, B, C be the respective events the customer buys a computer, a monitor, a printer. Assume the following probabilities:
The probability P(AB) of buying both a computer and a monitor is 0.49.
The probability of buying both a computer and a monitor but not a printer is 0.17.
The probability P(AC) of buying both a computer and a printer is 0.45.
The probability P(BC) of buying both a monitor and a printer is 0.39
The probability of buying a computer or a printer, but not both is 0.50.
The probability of buying a computer or a monitor, but not both is 0.43.
The probability of buying a monitor or a printer, but not both is 0.43.
What is the probability P(A), P(B), or P(C) of buying each?
What is the probability of buying exactly two of the three items?
What is the probability of buying at least two?
What is the probability of buying all three?
% file npr02_19.m % Data for Exercise 19. % A = computer; B = monitor; C = printer minvec3 DV = [A|Ac; A&B; A&B&Cc; A&C; B&C; (A&Cc)|(Ac&C); ... (A&Bc)|(Ac&B); (B&Cc)|(Bc&C)]; DP = [1 0.49 0.17 0.45 0.39 0.50 0.43 0.43]; TV = [A; B; C; (A&B&Cc)|(A&Bc&C)|(Ac&B&C); (A&B)|(A&C)|(B&C); A&B&C]; disp('Call for mincalc') npr02_19 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.8000 2.0000 0.6100 3.0000 0.6000 4.0000 0.3700 5.0000 0.6900 6.0000 0.3200 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Data are P(A)=0.232, P(B)=0.228, P(ABC)=0.045, P(AC)=0.062,
P(AB∪AC∪BC)=0.197 and P(BC)=2P(AC).
Determine P(A∪B∪C) and , if possible.
Repeat, with the additional data P(C)=0.230.
% file npr02_20.m % Data for Exercise 20. minvec3 DV = [A|Ac; A; B; A&B&C; A&C; (A&B)|(A&C)|(B&C); B&C - 2*(A&C)]; DP = [ 1 0.232 0.228 0.045 0.062 0.197 0]; TV = [A|B|C; Ac&Bc&Cc]; disp('Call for mincalc') % Modification % DV = [DV; C]; % DP = [DP 0.230 ]; npr02_20 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. mincalc Data vectors are linearly independent Data probabilities are INCONSISTENT The number of minterms is 8 The number of available minterms is 6 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA disp(PMA) 2.0000 0.0480 3.0000 -0.0450 % Negative minterm probabilities indicate 4.0000 -0.0100 % inconsistency of data 5.0000 0.0170 6.0000 0.1800 7.0000 0.0450 DV = [DV; C]; DP = [DP 0.230]; mincalc Data vectors are linearly independent Data probabilities are INCONSISTENT The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Data are:
. Determine available minterm probabilities and the following,
if computable:
With only six items of data (including ), not all minterms are available. Try the additional data and . Are these consistent and linearly independent? Are all minterm probabilities available?
% file npr02_21.m % Data for Exercise 21. minvec3 DV = [A|Ac; A; A&B; A&B&C; C; Ac&Cc]; DP = [ 1 0.4 0.3 0.25 0.65 0.3 ]; TV = [(A&Cc)|(Ac&C); Ac&Bc; A|B; A&Bc]; disp('Call for mincalc') % Modification % DV = [DV; Ac&B&Cc; Ac&Bc]; % DP = [DP 0.1 0.3 ];
npr02_21 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3500 4.0000 0.1000 The number of minterms is 8 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA DV = [DV; Ac&B&Cc; Ac&Bc]; DP = [DP 0.1 0.3 ]; mincalc Data vectors are linearly independent Computable target probabilities 1.0000 0.3500 2.0000 0.3000 3.0000 0.7000 4.0000 0.1000 The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA
Repeat Exercise 21. with P(AB) changed from 0.3 to 0.5. What is the result? Explain the reason for this result.
% file npr02_22.m % Data for Exercise 22. minvec3 DV = [A|Ac; A; A&B; A&B&C; C; Ac&Cc]; DP = [ 1 0.4 0.5 0.25 0.65 0.3 ]; TV = [(A&Cc)|(Ac&C); Ac&Bc; A|B; A&Bc]; disp('Call for mincalc') % Modification % DV = [DV; Ac&B&Cc; Ac&Bc]; % DP = [DP 0.1 0.3 ];
npr02_22 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are linearly independent Data probabilities are INCONSISTENT The number of minterms is 8 The number of available minterms is 4 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA disp(PMA) 4.0000 -0.2000 5.0000 0.1000 6.0000 0.2500 7.0000 0.2500 DV = [DV; Ac&B&Cc; Ac&Bc]; DP = [DP 0.1 0.3 ]; mincalc Data vectors are linearly independent Data probabilities are INCONSISTENT The number of minterms is 8 The number of available minterms is 8 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA disp(PMA) 0 0.2000 1.0000 0.1000 2.0000 0.1000 3.0000 0.2000 4.0000 -0.2000 5.0000 0.1000 6.0000 0.2500 7.0000 0.2500
Repeat Exercise 21. with the original data probability matrix, but with AB replaced by AC in the data vector matrix. What is the result? Does mincalc work in this case? Check results on a minterm map.
% file npr02_23.m % Data for Exercise 23. minvec3 DV = [A|Ac; A; A&C; A&B&C; C; Ac&Cc]; DP = [ 1 0.4 0.3 0.25 0.65 0.3 ]; TV = [(A&Cc)|(Ac&C); Ac&Bc; A|B; A&Bc]; disp('Call for mincalc') % Modification % DV = [DV; Ac&B&Cc; Ac&Bc]; % DP = [DP 0.1 0.3 ]; npr02_23 Variables are A, B, C, Ac, Bc, Cc They may be renamed, if desired. Call for mincalc mincalc Data vectors are NOT linearly independent Warning: Rank deficient, rank = 5 tol = 5.0243e-15 Computable target probabilities 1.0000 0.4500 The number of minterms is 8 The number of available minterms is 2 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA DV = [DV; Ac&B&Cc; Ac&Bc]; DP = [DP 0.1 0.3 ]; mincalc Data vectors are NOT linearly independent Warning: Matrix is singular to working precision. Computable target probabilities 1 Inf % Note that p(4) and p(7) are given in data 2 Inf 3 Inf The number of minterms is 8 The number of available minterms is 6 Available minterm probabilities are in vector pma To view available minterm probabilities, call for PMA