====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:spring-2015:math445:lab1 [2015/01/19 18:57] gibson |
gibson:teaching:spring-2015:math445:lab1 [2015/01/21 12:52] (current) gibson |
||
---|---|---|---|
Line 98: | Line 98: | ||
(3 == 2) + 1 | (3 == 2) + 1 | ||
| | ||
+ | **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). Demonstrate with Matlab that both these rules hold for all possible combinations of P and Q. | ||
+ | |||
+ | **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 | ||
+ | |||
+ | <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. |