====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
gibson:teaching:spring-2015:math445:lab1 [2015/01/21 11:50] gibson |
gibson:teaching:spring-2015:math445:lab1 [2015/01/21 12:52] (current) gibson |
||
---|---|---|---|
Line 100: | Line 100: | ||
**Problem 9:** If P is a logical expression, the law of noncontradiction states that P AND (NOT P) is always false. Use Matlab to verify this for both P false and P true. | **Problem 9:** If P is a logical expression, the law of noncontradiction states that P AND (NOT P) is always false. Use Matlab to verify this for both P false and P true. | ||
- | **Problem 10:** Let P and Q be logical expressions. De Morgan's rule states that NOT (P OR Q) = (NOT P) AND (NOT Q) and also that NOT (P AND Q) = (NOT P) OR (NOT Q). Show that both these rules hold for all possible combinations of P and Q. | + | **Problem 10:** Let P and Q be logical expressions. De Morgan's rule states that NOT (P OR Q) = (NOT P) AND (NOT Q) and also that NOT (P AND Q) = (NOT P) OR (NOT Q). Demonstrate with Matlab that both these rules hold for all possible combinations of P and Q. |
- | **Problem 11:** Construct an equivalent logical expression for OR using only AND and NOT. | + | **Problem 11:** Construct an equivalent logical expression for P OR Q using only AND and NOT. Translate that into Matlab and then test for all possible values of P and Q. Write your demonstration in the following fashion, in order to make it easy to follow |
- | **Problem 12:** Construct an equivalent logical expression for AND using only OR and NOT. | + | <code matlab> |
+ | P=0; Q=0; (my expression) == (P || Q) | ||
+ | P=1; Q=0; (my expression) == (P || Q) | ||
+ | </code> | ||
+ | etc. | ||
+ | |||
+ | **Problem 12:** Construct an equivalent logical expression for P AND Q using only OR and NOT. Translate that into Matlab and then test for all possible values of P and Q. Folow the same kind of pattern as in problem 11. |