This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gibson:teaching:spring-2015:math445:hw1 [2015/01/21 12:55] gibson created |
gibson:teaching:spring-2015:math445:hw1 [2015/01/29 07:52] (current) gibson |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Math 445 HW1 ====== | ====== Math 445 HW1 ====== | ||
- | |||
- | The following problems are designed to prepare you for Lab 2 on linear algebra. | ||
If you have your own computer and want to run Matlab on it, download and install Matlab from {{http://at.unh.edu/acs/services/software/ | UNH academic software}}. Otherwise you can do your homework on the computers in Kingsbury N129. Save your Matlab session to a file by turning "diary on". When you're done, edit the diary in a text editor to remove errors and add appropriate comments. Print the edited diary to turn in. Your name, the date, and "Math 445 HW 1" should appear prominently at the top. | If you have your own computer and want to run Matlab on it, download and install Matlab from {{http://at.unh.edu/acs/services/software/ | UNH academic software}}. Otherwise you can do your homework on the computers in Kingsbury N129. Save your Matlab session to a file by turning "diary on". When you're done, edit the diary in a text editor to remove errors and add appropriate comments. Print the edited diary to turn in. Your name, the date, and "Math 445 HW 1" should appear prominently at the top. | ||
Line 17: | Line 15: | ||
Create variables for the three resistors $R_1, R_2, R_3$, with values 5, 3, and 4. Then calculate $R_T$ by translating the above formula into Matlab syntax. | Create variables for the three resistors $R_1, R_2, R_3$, with values 5, 3, and 4. Then calculate $R_T$ by translating the above formula into Matlab syntax. | ||
- | **Problem 3:** Another series expansion of $pi$ is | + | **Problem 3:** Another series expansion of $\pi$ is |
\begin{eqnarray*} | \begin{eqnarray*} | ||
- | \pi = 4 \sum_{k=1} \frac{(-1)^{k+1}{2k-1} = 1 - \frac{1}{3} + \frac{1}{5} - \ldots | + | \pi = 4 \sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{2k-1} = 4 \left(1 - \frac{1}{3} + \frac{1}{5} - \ldots \right) |
- | \begin{eqnarray*} | + | \end{eqnarray*} |
Do you think finite truncations of this series will converge to $\pi$ faster or slower than the Ramanujan series from [[gibson:teaching:spring-2015:math445:lab1 | lab 1]]? Take a guess before testing in Matlab! | Do you think finite truncations of this series will converge to $\pi$ faster or slower than the Ramanujan series from [[gibson:teaching:spring-2015:math445:lab1 | lab 1]]? Take a guess before testing in Matlab! | ||
Line 30: | Line 28: | ||
\begin{eqnarray*} | \begin{eqnarray*} | ||
- | \e = \sum_{k=1} \frac{1}{k!} | + | e = \sum_{k=0}^{\infty} \frac{1}{k!} = 1 + \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots |
- | \begin{eqnarray*} | + | \end{eqnarray*} |
How many terms of this series do you need to get four digits of accuracy? | How many terms of this series do you need to get four digits of accuracy? | ||
Line 37: | Line 35: | ||
**Problem 5:** Let $e_n$ be the truncation of the above series after the $n$th term, i.e. $e_1 = 1$, $e_2 = 1 + 1/1!$, etc. Devise a Matlab expression that uses the ''log10'' function to count the number of digits of accuracy in any given $e_n$. | **Problem 5:** Let $e_n$ be the truncation of the above series after the $n$th term, i.e. $e_1 = 1$, $e_2 = 1 + 1/1!$, etc. Devise a Matlab expression that uses the ''log10'' function to count the number of digits of accuracy in any given $e_n$. | ||
- | **Problem 6:** Read ''help xor''. Then devise an expression using only ''&&'', ''||'', and '~' that has the same value as ''xor(P,Q)'' for all possible combinations of P and Q. Demonstrate the correctness of your expression using Matlab code like this | + | **Problem 6:** Read ''help xor''. Then devise an expression using only ''&&'', ''||'', and ''~''that has the same value as ''xor(P,Q)'' for all possible combinations of P and Q. Demonstrate the correctness of your expression using Matlab code like this |
<code matlab> | <code matlab> |