====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:fall-2013:math445:lab5 [2013/09/23 19:21] gibson |
gibson:teaching:fall-2013:math445:lab5 [2013/10/03 05:42] (current) gibson |
||
---|---|---|---|
Line 2: | Line 2: | ||
Helpful Matlab commands/functions/constructs for this lab: | Helpful Matlab commands/functions/constructs for this lab: | ||
- | ''while-end'', ''abs'', ''plot'', ''grid on'', '''for-end'', ''%%\%%'', ''contour'', ''norm'', and anonymous functions. | + | ''while-end'', ''abs'', ''plot'', ''grid on'', ''for-end'', ''%%\%%'', ''contour'', ''norm'', and anonymous functions. |
**Problem 1:** Write a ''newtonsearch1d'' function that computes a zero of a | **Problem 1:** Write a ''newtonsearch1d'' function that computes a zero of a | ||
Line 16: | Line 16: | ||
**(a)** Find an ''x'' for which $x^2 - 8x + 5 = 0$. | **(a)** Find an ''x'' for which $x^2 - 8x + 5 = 0$. | ||
- | **(b)** Find the cube root of 54. (Write an equation $f(x) = 0$ whose answer is $x = \sqrt[3]{54}$.) | + | **(b)** Find the cube root of 54. (Hint: devise an equation whose answer is $x = \sqrt[3]{54}$.) |
**%%(c)%%** Find an ''x'' for which $\sqrt{4-x^2} = x \tan x$. | **%%(c)%%** Find an ''x'' for which $\sqrt{4-x^2} = x \tan x$. | ||
Line 27: | Line 27: | ||
a 2-d function ''f'' starting from the initial guess ''x'', where both ''x'' | a 2-d function ''f'' starting from the initial guess ''x'', where both ''x'' | ||
and ''f(x)'' are two-dimensional vectors. Use this to find a zero of the | and ''f(x)'' are two-dimensional vectors. Use this to find a zero of the | ||
- | nonlinear function | + | nonlinear 2-d function |
<latex> | <latex> | ||
f\left(\begin{array}{c} x_1 \\ x_2 \end{array}}\right) = | f\left(\begin{array}{c} x_1 \\ x_2 \end{array}}\right) = | ||
- | \left(\begin{array}{c} x_1^2 + x_2^2 - 7 \\ x_1^{-1} - x(2) \end{array} \right) | + | \left(\begin{array}{l} x_1^2 + x_2^2 - 7 \\ x_1^{-1} - x_2 \end{array} \right) |
</latex> | </latex> | ||
- | Use a contour plot of the norm of ''f'' over ''x(1), x(2)'' to find an | + | Use a contour plot of the norm of $f$ over $x_1, x_2$ to find an |
initial guess for the search. | initial guess for the search. | ||
- | **Problem 3:** Write a ''newtonsearchNd'' function that finds a zero of | + | **Bonus (10 pts):** Write a ''newtonsearchNd'' function that finds a zero of |
an N-dimensional function ''f'' starting from the initial guess ''x''. | an N-dimensional function ''f'' starting from the initial guess ''x''. | ||
+ | Use this to find a zero of the nonlinear 3d function | ||
+ | <latex> | ||
+ | f\left(\begin{array}{c} x \\ y \\ z \end{array}}\right) = | ||
+ | \left(\begin{array}{l} 10(y-x) \\ x(28-z) - y \\ xy - 8/3 \; z \end{array} \right) | ||
+ | </latex> | ||
+ | |||
+ | Use the initial guess $[x,y,z] = [10, 10, 25]$. Verify your answer by applying it to the 3d function. What do you expect to get? | ||
+ | |||
+ | ** Bonus (10 points): ** | ||
+ | Give a brief explanation for the Newton's Search. Include the answers to the following questions. | ||
+ | |||
+ | ** - ** Purpose: What is the Newton's method used for? | ||
+ | |||
+ | ** - ** Method: How does it do this? (How is it related to the Taylor Series? Can you explain the equations used in the code?) |