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:51] gibson |
gibson:teaching:spring-2015:math445:lab1 [2015/01/21 12:52] (current) gibson |
||
|---|---|---|---|
| Line 49: | Line 49: | ||
| \end{eqnarray*} | \end{eqnarray*} | ||
| - | This is useful, for example, in finding the average rate of return on an investment with varying yearly return. If an investment returns 15% its first year, 5% its second, and 10% its third, the average rate of return is | + | This is useful, for example, in finding the average rate of return on an investment with varying yearly return. |
| + | |||
| + | **(a)** If an investment returns 15% its first year, 5% its second, and 10% its third, the average rate of return is | ||
| \begin{eqnarray*} | \begin{eqnarray*} | ||
| Line 56: | Line 58: | ||
| Compute the average rate of return, expressed as a percent. | Compute the average rate of return, expressed as a percent. | ||
| + | |||
| + | **(b)**Which is better, a steady 5% per year return on investment, or alternating between 0% and 10% year by year? | ||
| | | ||
| **Problem 5:** The astoundingly brilliant but short-lived mathematician [[http://en.wikipedia.org/wiki/Srinivasa_Ramanujan | Srinivasa Ramanujan]] devised the following very powerful formula for for $1/\pi$ | **Problem 5:** The astoundingly brilliant but short-lived mathematician [[http://en.wikipedia.org/wiki/Srinivasa_Ramanujan | Srinivasa Ramanujan]] devised the following very powerful formula for for $1/\pi$ | ||
| Line 94: | 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. | ||