1. (10 points) Consider solving the initial value problem given by
y˙ = f (t, y . 1
t) + cos(y + t)[arctan(y) − 1cos(y)]
over t [0, 5] with initial condition y(0) = 1. You will solve this by two second-order Runge-Kutta methods. The first method is a second-order Runge-Kutta with the parameter from class being γ = 0.5 (equivalently, c2 = 0.5 in the textbook, page 361). The second method is a second-order Runge-Kutta with the parameter from class being γ = 100 (equivalently, c2 = 100 in the textbook, page 361). Apply both methods with n = 10, 102, 103 and 104 steps. For each method, plot all the approximate solutions (for various n) on a single graph (for two plot windows in total – one per method). Treating the solution with γ = 0.5, n = 105 as the true solution, plot the log10 of the errors (i.e., yn y¯(tn) ) versus the log10(n) for each method, all on one graph, but in different colors. Using matlab, indicate which color corresponds to which method on your graph. Comment on the slopes.
(5 points) Do the same thing as in the previous problem, but now include the fourth-order Runge-Kutta method (that you have written yourself) as well. In this problem, treat the fourth-order Runge-Kutta solution with n = 105 as the true solution. Also, in addition to plotting
the log10 of the errors (i.e., |yn−y¯(tn)|) versus the log10(n), plot the log10
of the errors versus the log10 of the number of function evaluationsthe number of times that you evaluated f (t, y)) for each method. Has this changed the slopes compared with the plot where the horizontal axis was the number of steps (log10(n))?
(3 points) Do the same thing as in the previous problem, but now include Euler’s method. From the log-log plot, estimate the error in Euler’s method with n = 1000 steps.
(12 points) Now modify the initial value problem to
y˙ = f (t, y)+ σB
t)+ cos(y + t)[arctan(y) − 1 cos(y)]+ σB˙ , (1)
where σ = 0.1 and B(t) denotes a Brownian motion (and the deriva- tive notation is only formal, but fine for our needs). Approximate the solution of this IVP by combining the Euler method with an addition of Gaussian noise (a normal random variable) at each step. That is, modify your Euler one-step update to be
y = y + hf (t , y ) + σ√h ν ,
where νk has mean zero and variance one, and where the νk are all independent from each other. (You may use the matlab command “nu=randn;” to create each of these νk values.) Let the number of steps in each simulation be n = 1000. Save the terminal values, yn, for each run, and run this code NR times. Note that you have generated NR values of yn. Make a histogram with 20 bars, of these values. Do this two times, each time with NR = 1000, creating two histograms. Are these identical? If not, roughly explain why. Now, do this one more time, but with NR = 4000. By examining the data from the output of
your code in the case NR = 4000, roughly estimate the probability that the solution of (1) will be within ±0.2 of the nominal solution (i.e., the one with no noise). How about within ±0.4?
(10 points) Adapt (if necessary) your fourth-order Runge-Kutta code to handle systems of ODEs. Apply your code to the ODE system given by
only values for the number of steps of the form n = 2k, find the smallest value of n such that the error in the terminal value is less than 10−8. (Here, by error with n steps, we mean the euclidean norm of the vector
error, i.e., en . √(yn − y¯1(6))2 + (yn − y¯2(6))2, where (y¯1(6), y¯2(6)) is
the true solution at t = 6. As usual, given that we do not know the
true solution, you may substitute the next size of n, nˆ = 2k+1, in place of the true value.)
(10 points) Consider the previous problem. Suppose you can vary µ, and that you would like to find the value of µ such that y¯1(6) = − Apply a secant method, starting from µ0 = 4 and µ1 = 3 to search for this value of µ. You may exit the secant method when y1(6) ( 5) < 10−6. Note that the secant method will call your Runge-Kutta code to
evaluate the function. You should use the value of n that you obtained in the previous problem as the number of steps in the Runge-Kutta code.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme
Get Free Quote!
271 Experts Online