This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gibson:teaching:fall-2013:math445:hw5 [2013/11/14 12:53] gibson created |
gibson:teaching:fall-2013:math445:hw5 [2013/11/14 12:58] (current) gibson |
||
---|---|---|---|
Line 32: | Line 32: | ||
**Problem 4:** Make a 3d plot of $f$ versus $x,y$ for the function $f(x,y) = 3 e^{-(x^2/2 + xy + 2 y^2)}$ | **Problem 4:** Make a 3d plot of $f$ versus $x,y$ for the function $f(x,y) = 3 e^{-(x^2/2 + xy + 2 y^2)}$ | ||
- | for $-3 \le x \le $ and $-3 \le y \le $. Use Matlab's ''meshgrid'' function. | + | for $-3 \le x \le $ and $-3 \le y \le 3$, on a mesh with $Delta x = \Delta y = 0.1$. Use Matlab's ''meshgrid'' function. |
Line 41: | Line 41: | ||
0 (false) for a composite. Don't worry about efficiency, just loop over 2 and the odd integers | 0 (false) for a composite. Don't worry about efficiency, just loop over 2 and the odd integers | ||
less than or equal to $\sqrt{n}$, and return 0 if any divide ''n'' evenly, and 1 if not. | less than or equal to $\sqrt{n}$, and return 0 if any divide ''n'' evenly, and 1 if not. | ||
- | (You might have already done this as an optional problem for | + | (You might have already done this as an optional problem for exam 1 prep.) |
**Problem 7:** Write Matlab code that will compute the first 20 prime numbers, using your | **Problem 7:** Write Matlab code that will compute the first 20 prime numbers, using your | ||
Line 47: | Line 47: | ||
- | **Problem 8:** | + | **Problem 8:** Deduce the functional relationship between $y$ and $x$ for the data shown in this plot |
+ | |||
+ | {{:gibson:teaching:fall-2012:math445:fig1.png?direct&300}} | ||
**Bonus:** Write an ''primes(N)'' function that returns all primes less than or equal to ''N'' | **Bonus:** Write an ''primes(N)'' function that returns all primes less than or equal to ''N'' | ||
using the [[http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes | Sieve of Eratosthenes algorithm]]. | using the [[http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes | Sieve of Eratosthenes algorithm]]. | ||
- |