Sie sind auf Seite 1von 2

List No.

10
Problems proposed in the course of Math-III
Civil Engineering

1. M-file. RK1. Use Euler’s explicit method to obtain a six decimal approximation of the indicated

value y = f (x, y), y(a) = α, a ≤ x ≤ b.
Algorithm for the Euler’s explicit method:

wi+1 = wi + hf (xi , wi ), xi = x0 + ih, i = 0, 1, 2, ...

(a) Solve by hand using h = 0.1. (b) Write a Matlab program in a script file that solves the equation
using h = 0.05 (c) Use the program from part (b) to solve the equation using h = 0.01

a) y = 2x − 3y, y(1) = 5, find y(1.5)

b) y = x + y 2 , y(0) = 0, find y(0.5)

2. M-file. RK1. Use Euler’s explicit method to obtain a six decimal approximation of the indicated
value. (a) Write a Matlab program in a script file that solves the equation using h = 0.05 (b) Use
the program from part (a) to solve the equation using h = 0.01

a) y = y, y(0) = 1, find y(1)

b) y = 2xy, y(1) = 1, find y(1.5)

c) y = e−y , y(0) = 0, find y(0.5)

d ) y = xy, y(0) = 1, find y(0.5)
e) y = xy 2 − xy , y(1) = 1,

find y(1.5)

Report table of data

(i) (xi ) (yi ) (wi ) (abi ) (rei ) pr(i)


0 0.0 0.458478 0.4589879 0.258974 0.256989 25.6987
1 0.1 0.489871 0.4589879 0.258974 0.256989 25.6987
2 0.2 0.498713 0.4589879 0.258974 0.256989 25.6987
3 0.3 0.505897 0.4589879 0.258974 0.256989 25.6987
4 0.4 0.505897 0.4589879 0.258974 0.256989 25.6987
5 0.5 0.505897 0.4589879 0.258974 0.256989 25.6987

where (yi ) exact solution, (wi ) approximate solution, (abi ) absolute error, (rei ) relative error, (pri )
percentage error.

3. M-file. RK2. Use the Modified Euler method


Algorithm for the modified Euler’s method:

f (xi , wi ) + f (xi+1 , wi+1



)
wi+1 = wi + h , xi = x0 + ih, i = 0, 1, 2, ...
2

c
LL. Copyright All rights reserved 1
where

wi+1 = wi + hf (xi , wi )

to approximate the solutions of the following initial value problem. (a) Solve by hand using h = 0.2
by find y(1). (b) Write a Matlab program in a script file that solves the equation using h = 0.1 (c)
Use the program from part (b) to solve the equation using h = 0.01

a) y = te3t − 2y, y(0) = 0, analitical solution y(t) = 51 te3t − 1 3t
25
e + 1 −2t
25
e

b) y = cos 2t + sin 3t, y(0) = 1, analitical solution y(t) = 12 sin 2t − 1
3
cos 3t + 43 .

4. M-file. Use RK4 method to obtain a six decimal approximation of the indicated value. (a) Solve
by hand using h = 0.1 (b) Write a Matlab program in a script file that solves the equation using
h = 0.01

a) y = 2x − 3y + 1, y(1) = 5, y(1.5)

b) y = 1 + y 2, y(0) = 0, y(0.5)

c) y = x2 + y 2, y(0) = 1, y(0.5)
′ √
d ) y = xy + y, y(0) = 1, y(0.5)

Algorithm for the runge-kutta method:


1
yi+1 = yi + (k1 + 2k2 + 3k3 + k4)
6
where

k1 = f (xi , yi )
1 1
k2 = f (xi + h, yi + k1 h)
2 2
1 1
k3 = f (xi + h, yi + k2 h)
2 2
k4 = f (xi + h, yi + k3 h)

c
LL. Copyright All rights reserved 2

Das könnte Ihnen auch gefallen