Numerical Solution of Ordinary Differential Equations: Spring Semester 2016

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

COMSATS Institute of Information Technology

Department of Mathematics
Prof. Dr. Shamsul Qamar

February 22, 2016

Numerical Solution of Ordinary Differential Equations


Spring Semester 2016

Exercise Sheet 1
Due date 29.02.2016 in the lecture.

Exercise 1 [8 marks]
(a) Calculate with Euler polygon method the approximate solution of
dy
1
= x + 2y,
y(1) =
dx
2
at the interval x [1, 2] with step size h = 0.1. Compare your numerical results with exact
solution. Plot both exact and numerical solutions.
(b) The result of Euler method can become better if apart from first order derivative of y one
also use the second order derivative. Hence for calculating y(x + h) one has to use the first
three terms of Taylor-expansion
h2
y (x) + . . . .
2!
Program this modified Euler-method for the differential equation given in part (a) and compare your results.
y(x + h) = y(x) + hy (x) +

(c) The order of convergence p is characterized by relation


|yh (2) y(2)| Chp ,
where yh represents numerical solution and y is exact solution. Calculate the numerical
convergence order of both methods for sufficiently small h. One can plot the numerical order
of convergence for different step sizes.
Exercise 2 [7 marks]
(a) Consider the initial value problem
y (x) = y 2

y(0) = 1.

Calculate the value y(1/2) numerically with Euler-method. Use the step sizes h = 2k , k =
1, 2, . . . , 12. Calculate the corresponding error at x = 1/2.
(b) Consider the initial value problem
y (x) = f (y)

y(0) = y0 .

If in the neighbourhood of the exact solution the estimate



f
L
|f | A,
y
is valid, then the error bound for the Euler-method with step size h is given as

|y(x) yh (x)| A eLx 1 h.
Compare graphically the errors obtained in part (a) and the error estimate for the same step
sizes h.

You might also like