Written Exercises
(13 points total)
Exercise 1. (Component Skill 6.1)
A tornado passes over a weather station with a barometer that was recording atmospheric pressure
as a function of time1
. Several weeks after the storm passed and clean-up efforts concluded, meteorologists at the weather station fit the pressure data to a curve and found the following relationship:
p(t) = 1 −
12t
57 + 16(t − 2)
2
.
Here, t is time in minutes after the tornado sirens first went off, and p(t) is the atmospheric pressure
(measured in standard atmospheres) at the weather station. The tornado destroyed the barometer
after t = 3 minutes, so the relationship above is valid only for 0 ≤ t ≤ 3.
a. Is p(t) a unimodal function over 0 ≤ t ≤ 3? Justify your answer by finding the critical point(s)
of p(t) over the interval 0 ≤ t ≤ 3.
Hint: Please use Wolfram Alpha to calculate p
′(t).
b. Show that your critical point from (b) is a local minimum using the second derivative test.
Hint: Please use Wolfram Alpha to calculate p
′′(t).
c. What is the minimum pressure recorded at the weather station over 0 ≤ t ≤ 3? Don’t forget
to check the boundaries of the interval!
d. What is the maximum pressure recorded at the weather station over 0 ≤ t ≤ 3? Don’t forget
to check the boundaries of the interval!
e. The tornado is right on top of the weather station when the pressure is minimized. At what
time does the tornado arrive at the weather station?
Exercise 2. (Component Skills 6.2-6.3)
Consider the function
f(x) = ∣x − 1∣
defined over the interval −2 ≤ x ≤ 6.
a. Perform three iterations of the three-point equal interval search by hand. What interval
is guaranteed to contain the value of x that corresponds to the minimum of f after three
iterations of the three-point equal interval search?
1
Ironic, I know.
2
b. Perform one iteration of successive parabolic interpolation if f is sampled initially at x1 = 0,
x2 = 2, and x3 = 4. Based on this one iteration, at what value of x does f attain a minimum?
Exercise 3. (Component Skill 6.4)
Consider the quadratic polynomial
f(x) = ax2
,
with free parameter a > 0. Clearly, this quadratic has a global minimum at x = 0.
a. Set a = 1. Perform three iterations of gradient descent by hand with initial guess x0 = 1 and
learning rate γ = 1/4. Does gradient descent appear to be converging?
b. Set a = 1. Perform three iterations of gradient descent by hand with initial guess x0 = 1 and
learning rate γ = 1. Does gradient descent appear to be converging?
c. According to Theorem 6.4.1 in the weekly lecture notes, the learning rate γ must be strictly
less than 1/L for gradient descent to converge, where L is the maximum of ∣f
′′(x)∣. Use this
theorem to explain why (a) converged and (b) did not.
d. According to Theorem 6.4.2 in the weekly lecture notes,
∣f(xk) − f(x∗)∣ ≤
(x0 − x∗)
2
2γk ,
where x∗ is the exact x-coordinate of the minimum, xk is the kth iterate of gradient descent,
x0 is the initial guess, and γ is the learning rate. The expression on the LHS of this inequality
can be thought of as the error between the exact minimum of f and what gradient descent
predicts is the minimum of f after k iterations.
Given f(x) = x
2
, x0 = 1, x∗ = 0, and γ = 1/4, how many iterations of gradient descent
are necessary to guarantee that ∣f(xk) − f(x∗)∣ < 10−15?
Hint: Find the exact k such that the RHS of the inequality equals 10−15
.
3
Coding Exercises
(7 points total)
Exercise 1. (Component Skills 6.2-6.4)
A seminal breakthrough in HIV treatment was the use of multiple-drug combination therapy. The
idea behind the therapy is that multiple drugs, when introduced to the body at specific times, fight
the virus off better than one drug alone. A key step in the development of multiple-drug therapy
was to determine the best time to take the next drug. One way this is done is to take the next drug
when the previous drug is at its maximum concentration in the body.
Suppose the concentration of the first drug in the therapy is modeled by
x(t) =
10
3
(e
−
t
24 − e
−
t
2 ) .
Here, x(t) represents the concentration of the first drug in the body (in mol/L) and t is time in
hours since the initial injection of the first drug. Assume that we want to administer our second
drug when x(t) is at its maximum. Let’s call this time tmax.
a. In order to find tmax, we need to convert this maximization problem into a minimization
problem. This can be done by introducing
y(t) = −x(t).
Note that the minimum of y(t) occurs at t = tmax.
Copy my function file threePtSearch from the weekly lecture notes. Place this function
file at the very bottom of your hw6.m script. Modify this function to return not only the variable int, but also the number of iterations N needed to achieve the desired error threshold.
Use this function to compute a three-point equal interval search for the minimum of y(t) over
the interval 0 ≤ t ≤ 12. Set the error threshold to ε = 10−3
.
Assign the variable A1 to the interval returned by the threePtSearch function. Assign A2
to the midpoint of A1. Assign the variable A3 to the number of iterations of the three-point
equal interval search.
Answers:
4
b. Copy my function file succParInt from the weekly lecture notes. Place this function file at
the very bottom of your hw6.m script. Modify this function to return not only the variable
int, but also the number of iterations N needed to achieve the desired error threshold. Use
this function to compute find the minimum of y(t) by successive parabolic interpolation. Set
the initial sample points to be t1 = 3, t2 = 6, and t3 = 9. Set the error threshold to ε = 10−3
.
Assign the variable A4 to the interval returned by the threePtSearch function. Assign A5
to the midpoint of A4. Assign the variable A6 to the number of iterations of the successive
parabolic interpolation.
Answers:
c. Copy my function file gradDescent from the weekly lecture notes. Place this function file at
the very bottom of your hw6.m script. Calculate y
′(t) by hand. (You don’t have to show your
work for this.) Use y
′(t) to perform gradient descent on y(t). Take the initial guess for the
minimum to be t0 = 1. Set the learning rate to be γ = 20 and the Cauchy error threshold to
be ε = 10−3
.
Assign the variable A7 to the value of the minimum of y(t) according to gradient descent.
Answers:
AMATH, Beginning, Computing, Homework, Scientific, solved
[SOLVED] Homework 6. amath 301 beginning scientific computing
$25
File Name: Homework_6__amath_301_beginning_scientific_computing.zip
File Size: 489.84 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.