, , , , ,

[SOLVED] Homework 7. amath 301 beginning scientific computing

$25

File Name: Homework_7__amath_301_beginning_scientific_computing.zip
File Size: 489.84 KB

5/5 - (1 vote)

Written Exercises
(13 points total)
Exercise 1. (Component Skill 7.1)
Consider f(x) = 3x
3 − 2x
2 + 3x − 2 over the interval 0 ≤ x ≤ 4.
a. What is the exact root of f in this interval?
Hint: Factor by grouping.
b. In what interval is the root guaranteed to be after three iterations of the bisection method?
c. Based on your answer to (b), what is the best guess for the root of f after three iterations of
the bisection method?
d. What is the maximum possible error of your answer to (c)?
e. How many iterations of the bisection method are needed to guarantee that the maximum
possible error of the best guess of the root of f is less than 10−6?
Exercise 2. (Component Skills 7.2-7.3)
Consider again f(x) = 3x
3 − 2x
2 + 3x − 2.
a. Perform one iteration of Newton’s method with initial guess x0 = 1.
b. A grad student is concerned that there is an initial guess x0 such that f
′(xk) = 0 for some
k ≥ 0. In such a situation, Newton’s method will fail. Explain why the grad student has
nothing to worry about.
Hint: Consider the values of x such that f
′(x) = 0.
c. Perform one iteration of the secant method with initial guesses x0 = 0 and x1 = 1.
Exercise 3. (Component Skill 7.4)
Consider yet again f(x) = 3x
3 − 2x
2 + 3x − 2.
2
a. A grad student wants to solve f(x) = 0 by fixed point iteration. They naively choose the
following fixed point form:
x = 3x
3 − 2x
2 + 4x − 2,
which inspires the iteration scheme
xk+1 = 3x
3
k − 2x
2
k + 4xk − 2.
Does this fixed point iteration converge for any initial guess x0 (assuming x0 is not exactly
the root of f)? Perform a small calculation to justify your answer.
b. A postdoc tries to fix the grad student’s mistake by proposing the following fixed point form:
x = −x
3 +
2
3
x
2 +
2
3
,
which inspires the iteration scheme
xk+1 = −x
3
k +
2
3
x
2
k +
2
3
.
Does this fixed point iteration converge for all initial guesses sufficiently close to the root of
f? Perform a small calculation to justify your answer.
c. A professor tries to improve convergence of the postdoc’s scheme by proposing the following
fixed point form:
x = (
2
3
x
2 − x +
2
3
)
1
3
,
which inspires the iteration scheme
xk+1 = (
2
3
x
2
k − xk +
2
3
)
1
3
.
Does this fixed point iteration converge faster than the postdoc’s for all initial guesses sufficiently close to the root of f? Perform a small calculation to justify your answer.
Hint: Use WolframAlpha to calculate and/or evaluate any derivatives you need to take.
3
Coding Exercises
(7 points total)
Exercise 1. (Component Skills 7.1-7.3, 7.5)
A former TA of this class studied caterpillar life cycles. She encountered the following equation in
her research:
6 − 3x(1 + e
3(1−x)
) = 0. (1)
Here, x represents the population of caterpillars in thousands. By guess and check, one can see
that x = 1 is a solution of (1). There are two other nontrivial solutions x1 and x2. We take x2 > x1
without loss of generality.
a. Use the MATLAB built-in function fzero with initial guess 0.1 to determine the value of x1.
Assign A1 to the value of x1.
Answer:
b. Use the MATLAB built-in function fzero with initial guess 1.9 to determine the value of x2.
Assign A2 to the value of x2.
Answer:
c. Copy the MATLAB function bisectionMethod from the weekly lecture notes. Paste this
function at the very bottom of your hw7.m script. Use this function to perform the bisection
method on the function f(x) given by the LHS of (1). Take the initial interval to be 0 ≤ x ≤ 0.5.
Set the stop criterion to 10−15. Assign A3 to the approximation of the root x1 according to the
bisection method. Assign A4 to the number of iterations necessary to satisfy the stop criterion.
Answer:
4
d. Repeat (c) but take the initial interval to be 1.5 ≤ x ≤ 2. Set the stop criterion to 10−15
.
Assign A5 to the approximation of the root x2 according to the bisection method. Assign A6
to the number of iterations necessary to satisfy the stop criterion.
Answer:
e. Copy the MATLAB function newtonMethod from the weekly lecture notes. Modify the function so that the Cauchy error is used as the stopping criterion. Have your function return the
approximation of the root according to Newton’s method as well as the number of iterations
necessary to satisfy the stop criterion.
Once your function has been modified appropriately, paste this function at the very bottom
of your hw7.m script. Use this function to perform the Newton’s method on the function f(x)
given by the LHS of (1). Take the initial guess to be x0 = 0.1. Set the stop criterion to 10−15
.
Assign A7 to the approximation of the root x1 according to Newton’s method. Assign A8 to
the number of iterations necessary to satisfy the stop criterion.
Note: You will need to compute f
′(x) by hand and write this as a function handle to run
Newton’s method in MATLAB.
Answer:
5
f. Repeat (e) but take the initial guess to be x0 = 1.9. Set the stop criterion to 10−15. Assign
A9 to the approximation of the root x2 according to Newton’s method. Assign A10 to the
number of iterations necessary to satisfy the stop criterion.
Answer:
g. Create your own MATLAB function secantMethod. The function should have the following
inputs:
• a function handle for the function whose root is to be found,
• an initial guess for the root,
• a second guess for the root, and
• a threshold for the Cauchy error.
The function should output the following:
• the approximate value of the root according to the secant method and
• the number of iterations necessary to satisfy the threshold for the Cauchy error.
Paste your function at the very bottom of your hw7.m script. Use this function to perform
the secant method on the function f(x) given by the LHS of (1). Take the initial guess to be
x0 = 0.1, the second guess to be x1 = 0.11, and the stop criterion to be 10−15. Assign A11 to
the approximation of the root x1 according to the secant method. Assign A12 to the number
of iterations necessary to satisfy the stop criterion.
Answer:
6
h. Repeat (g) but take the initial guess to be x0 = 1.9 and second guess to be x1 = 1.8. Set the
stop criterion to 10−15. Assign A13 to the approximation of the root x2 according to the secant
method. Assign A14 to the number of iterations necessary to satisfy the stop criterion.
Answer:

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Homework 7. amath 301 beginning scientific computing[SOLVED] Homework 7. amath 301 beginning scientific computing
$25