Solved-Programming Assignment 2- Solution

$35.00 $24.00

Improving Euler’s method (again): Read section 7.2 of the text. Make sure you can explain the idea of improved Euler’s method. Write a function named \ImprovedEuler” using the same inputs and output as the \Euler” function in project 1. Write a script to reproduce table 7.1 in the text. Plot the approximate solution combined with…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)
  1. Improving Euler’s method (again):

    1. Read section 7.2 of the text. Make sure you can explain the idea of improved Euler’s method.

    1. Write a function named \ImprovedEuler” using the same inputs and output as the \Euler” function in project 1.

    1. Write a script to reproduce table 7.1 in the text. Plot the approximate solution combined with the true solution.

  1. The Runge-Kutta Method:

    1. Read section 7.3 of the text. Make sure you can explain the idea of the Runge-Kutta method.

    1. Write a function named \RK” using the same inputs and output as the \Euler” function in project 1.

    1. Write a script to reproduce table 7.2 in the text. Plot the approximate solution combined with the true solution.

  1. Order of convergence: We showed in class that (forward) Euler’s method is a rst order method. That is, the error can be shown to be of the form

jeN j = jyN y(tN )j = C t ( rst power for t):

where C is a constant independent of t. An order p method has error of the form jeN j = jyN y(tN )j = C tp (pth power for t)

so that for t small, tp is very small for big whole number p implying the error is very small as well.

(a) If a method is of order p, then

jeN j = C tp:

. Taking half the stepsize (twice the number of steps), we have that

je2N j = C

t

p

:

2

Show that

je2Nj :

p log2

eN

j

j

Use this formula for the next two parts.

(b) Using the example in the previous two problems, write a script which computes the error and order of convergence for t = 101 ; 201 ; 401 ; for each of the following methods.

      1. Euler’s method

      1. Improved Euler’s method

      1. The Runge-Kutta method

    1. Find a way to see the order of convergence for centered Euler’s method. Compare this method to other methods.

  1. Scilab ODE solver:

    1. Use the Scilab command \ode(y0,t0,t,f,‘rk’)” to solve the problem in the previous three problems.

    1. Find the order of convergence of this method.

    1. Compare this method to our other methods.

1

  1. (Bonus Problem!) Scilab is open source. Track down the source code for the \ode” command and explain what you nd.

  1. (Bonus Problem!) Prove that improved Euler’s method is an order 2 method. Prove that Runge-Kutta is an order 4 method.

  1. (Bonus Problem!) Eventually you will see these high order methods stop improving in your Scilab outputs. Explain why.

2