## Description

1. Solve the coffee cup problem analytically for 5 minutes based upon Newton’s law of cooling:

ππππππ

ππππ = βππ(ππππ β πππ π )

πππ π = 19β, ππππ = 84β, ππ = 0.025/π π π π π π π π π π π π

By making sure the supplied program runs using Matlab. Write the function Tsexact which is

the analytical solution for use in the supplied matlab code. Use the solution to the in class

activity to help you write this function.

2. Using the supplied program to solve the coffee cup problem using the Forward Euler

Method calculate and compare your results to the analytical answer given by the provided

function.

β’ Plot the results for all algorithms using several different values for the step size β (β =

30π π , 15π π , 10π π , 5π π , 1π π , 0.5π π , 0.25π π )

β’ Using these results estimate the order of the error after the first step and at the end of

the integration. Describe how the error changes with changes in β. Use a graph

3. Implement the ODE23 method described in the book Moler in the test program you have

been given . For the standard equation dy/dt = f(t,y) (note y here is Tc above) the method

is given by

β’ S1 = f(tn,yn)

β’ S2 = f(tn + h/2, yn+h/2 S1)

β’ S3 = f(tn + 3h/4, yn+3h/4 S2)

β’ tn+1 = tn + h

β’ yn+1 = yn + h/9 ( 2S1 + 3S2 + 4S3)

β’ S4 = f(tn+1, yn+1)

β’ Errorn+1 = h/72 ( -5S1 + 6S2 + 8S3 -9 S4)

4. Plot the results for this algorithms using several different values for the step size β (β =

30π π , 15π π , 10π π , 5π π , 1π π , 0.5π π , 0.25π π )

5. Using these results estimate the order of the error after the first step and at the end of the

integration. Compare the actual error on the first step with the predicted error on the first

step.

6. Change the value of r in the problem being solved to r = 0.6. Does the error estimator blow

up in the same way as the solution when the solution becomes unstable?

2

What to turn in

For these assignments, we expect both SOURCE CODES and a written REPORT be uploaded

as a zip or tarball file to Canvas.

β’ Source code for all programs that you write, thoroughly documented.

o Include a README file describing how to compile and run your code.

β’ Your report should be in PDF format and should stand on its own.

o It should describe the methods used.

o It should explain your results and contain figures.

o It should also answer any questions asked above.

o It should cite any sources used for information, including source code.

o It should list all of your collaborators.

This homework is due on April 14th by 11:59 pm. If you don’t understand these directions, please

send questions to teach-cs3200@list.eng.utah.edu or come see one of the TAs or the instructor

during office hours well in advance of the due date.