Description
3.4
8 pts
3.5
4 pts
PRETEND you are trying to computa7onally solve for the root of the equa7on f (x) = 10^{x} −100 = 0 using the bisec7on method star7ng with the ini7al “bracket” a = 0, b = 3.
(a) Are these acceptable values for a and b? Explain. (Write out the general criteria that determine whether an ini7al a and b are acceptable for the bisec7on method, and use that to explain whether these values in par7cular are acceptable for this func7on f(x).)
(b) Calculate the values of tol_{X} and tol_{f} you would use for the two convergence criteria,
x_{k} – x_{k1} < tol_{X} and f(x_{k}) < tol_{f} , if you were to write your own bisec7on method in MATLAB.
Now (pretend) you’ve completed 33 itera7ons with the last two itera7ons having values x_{32} =
2.000 100000000001 and x_{33} = 2.000100000000000. Knowing (by inspec7on) the exact solu7on is x = 2, answer the following (and SHOW YOUR WORK!!):

What is the (just plain old) error in the last itera7on (x_{33})?

What is the “proxy” error for the last itera7on?

What is the “residual” error for the last itera7on?

Based on all your values above, explain whether the process has “converged” yet or not.
Use the fzero command in MATLAB to solve problem 3.3 for the weight of the hog, w, at t = 30 days. If you weren’t sure of the right f(x) = 0 equa7on to use in problem 3.3, be sure to check my solu7ons posted aZer classes Monday.
Do NOT submit your MATLAB rou7nes for this problem. But as proof you accomplished this task correctly, please write out all the following on paper:

The en7re func7on (“something”.m) you needed to create for fzero to call.

How you called the fzero command in your command window. It should be something like:
…something… = fzero(…something…)

Your final answer for the hog weight w, in pounds, rounded to four decimals (not 4 sig. figs; I do mean 4 decimals).
3.6
4 pts
Assume the NewtonRaphson method to solve f(x) = 0 converges according to 
^{e}k+1 
≈ C for 

e 
r 

C = 0.1, and assume the error for the first itera7on is e_{1} = 0.1. 
k 

(a) Calculate the absolute value of the errors for the first 5 itera7ons 
e_{1} through e_{5}, and plot these errors on a “convergence plot” of k vs. log_{10} e_{k}, (byhand, on paper).
(b) Explain by which itera7on k should the value of x_{k} be accurate to within 8 decimals.
Remember: For every ques7on show your work! You’ll be very sad when you aren’t given credit when you write down the correct answer but don’t show me your thought process or assump7ons behind that answer.
HW3B (3.4, 3.5, 3.6 on paper, 3.7 online)
3.7
13 pts
Ever wanted to fry an egg on hot pavement? The Imagina7on^{TM} Sta7on in Toledo says you’ve got to get the egg above 70^{o} C to coagulate the proteins. Lets create and solve a physicsbased model to see if the surface of a road can really get that hot.
Here’s a realis7c model of the heats (Q, in Wals) entering and leaving the surface of a road at (unknown) temperature T (in Celsius). You’ll learn more about this in Heat Transfer later:

• Q_{SUN} = 650 is solar heat directly hinng the pavement
at noon on a very sunny day.
• Q_{AIR} = (15) (T – 32) is the heat convected away from
the pavement by slow moving air at 32^{o}C.
^{Q}SUN
• Q_{SKY} = (5.103 x 10^{8}) { (T+273)^{4} – (27+273)^{4} } is the
heat radia7ng oﬀ the pavement to the upper sky
at 27^{o}C. The “+273” in the equa7on is conver7ng ^{o}C to Kelvin.
The temperature T (in Celsius) of the pavement is obtained when all the incoming heat balances the outgoing heat,
i.e. when Q_{SUN} = Q_{AIR} + Q_{SKY} .
Following the instruc7ons below, you’ll solve for T two ways:
T_{SKY} = 27^{o}C
T_{AIR} = 32^{o}C
^{Q}SKY ^{Q}AIR
Pavement at unknown temperature T (in ^{o}C)
1. Wri7ng your own BISECTION rou7ne, which calls your own func7on pavement(T),
2. Using MATLAB’s builtin fzero func7on
and then compare how they did (and what’s easier to do!).
[A] Create the “f(x)” funcIon
First, look at the model above, and think about the func7on f(T) needed so that the solu7on to the root of f(T) = 0 gives you the desired pavement temperature T.
Hint: Since T is the solu7on to Q_{SUN} = Q_{AIR} + Q_{SKY} , then a great idea is to make f(T) = Q_{SUN} – Q_{AIR} – Q_{SKY} , where each Q has the formula above.
[B] Turn f(T) into a MATLAB funcIon
Create a func7on called pavement.m that starts with this exact line: function f = pavement(T) .
Complete the func7on so that it outputs the value of the func7on f(T) from part [A] for an input T in ^{o}C.

Create a plot of f(T) over T = 0 to 100^{o}C to help you visualize the problem. From the plot, what do you think would be a good first bracket [a, b] for the bisec7on method?
(You do not submit this plot to me – it’s just for you to see the problem before you get started.)

Start with my “code fragment” (provided online) for the script HW3_7.m. Complete the code by wri7ng your own bisec7on method to converge on the solu7on for T:
• Use the given ini7al bracket of [a, b] = [0, 100] Celsius. Do not change those values please!
• Develop appropriate convergence tolerances (tol_{X}, tol_{f}) based on the ini7al bracket just like we discussed in class.
• Use a while loop to keep itera7ng un7l both convergence criteria are met (i.e. keep looping if either or both criteria are not met). Remember: you don’t know the “real” solu7on for temperature T yet when comparing to tol_{x} , so use the “proxy” error T_{k} – T _{k1}.
• Be sure to store the value of each itera7on T_{k} in a vector called T_history so you can plot the method’s convergence history later.
HW3B (3.4, 3.5, 3.6 on paper, 3.7 online)
3.7 Con7nued …
• For the purposes of keeping track of the itera7ons in the “history” vector, define T_{1} = a and
T_{2} = b as the “first two” itera7ons, and then define T_{3} to be the first midpoint of a and b.

AZer the rou7ne converges, add even more code to your HW3_7.m script to do the following:
• Run fzero with itera7ons displayed, using the same ini7al bracket [0, 100].

ˆ
, and use it to back
• Assume this result from fzero is the “true” answer for temperature T
calculate a vector of all the “true” errors e
=
ˆ
for all the itera7ons in your Bisec7on
T −T
rou7ne you stored in the T_history vector. ^{k}
k
• Make & label a convergence history plot of your bisec7on method: plot log_{10}(e_{k}) as a func7on of itera7on k, up un7l convergence. Save this plot as a pdf called PLOT3_7.pdf.
That’s it! Admire how well your code did converging compared to the builtin MATLAB rou7ne. What kind of shape do you see in your “convergence history” plot? What did you think was easier (wri7ng your own code [D] or using fzero [E])? Did you ever actually fry the egg (was the pavement above 70^{o}C)?
Finally, here’s exactly what I need you to submit ONLINE:
• Your convergence history plot PLOT3_7.pdf.
• Your two mfiles: your completed, documented script HW3_7.m and func7on pavement.m.
• Enter answers to the following three ques7ons (in order) in the comment sec7on on Carmen:
a) From your Bisec7on rou7ne [D], what is the final (converged) value for temperature T to four decimals (e.g. 43.1234 ^{o}C), and how many itera7ons did it take?
ˆ
b) From the fzero rou7ne [E], what is the value of T to four decimals, and how many itera7ons
did it take?
c) Does the shape of your convergence plot (log_{10}(error) vs. k) indicate a linear– or quadraRctype convergence rate? Explain (briefly).
• Ther