Professional Documents
Culture Documents
LAB REPORT
COMPUTATIONAL METHODS FOR MECHANICAL
ENGINEER
EME 3156
TRIMESTER 2 (2015/2016)
Experimen
t1
Date of
Experimen
t
Student Name
Lee Chng Keat
Student ID
1122700207
Objectives:
1. Using excel to solve ODE initial value problems.
2. Using different method to solve the problem which is Euler method, Midpoint
y(t) =
t tan
When t = 1, y = 0
1 = 1 tan (c + log 1)
c=0
3
0+ log
y(t) =
( 3 ) tan
y = 5.8741
Exact
h = 0.05
h = 0.1
h = 0.5
h = 0.2
h=1
When t=3
Error (h=0.05) = |5.8741-5.864075| = 0.010025
Error (h=0.1) = |5.8741-5.836088| = 0.038012
Error (h=0.2) = |5.8741-5.738647| = 0.135453
Error (h=0.5) = |5.8741-5.287636| = 0.586464
Error (h=1.0) = |5.8741-4.524779|= 1.349321
7
6
5
4
Exact
h = 0.05
h = 0.1
h = 0.2
h = 0.5
h=1
h
6 (K1+2K2+2K3+K4)
yi+1 = yi +
h
6 (K1+2K2+2K3+K4)
= 0.10516
When t=3
Error (h=0.05) = |5.8741-5.874099| = 0.000001
Error (h=0.1) = |5.8741-5.874083| = 0.000017
Error (h=0.2) = |5.8741-5.873839| = 0.000261
Error (h=0.5) = |5.8741-5.865642| = 0.008458
Error (h=1.0) = |5.8741-5.776963| = 0.097137
7
6
5
4
3
Exact
h = 0.05
h = 0.1
h = 0.2
h = 0.5
h=1
y i+1 = yi +
h
2 (K1+K2)
When t=3
Error ( h=0.05) = |5.8741-5.861999| = 0.012101
Error (h=0.1) = |5.8741-5.827854| = 0.046246
Exact
h = 0.05
h = 0.1
h = 0.2
h = 0.5
h=1
7
6
5
4
3
Exact
Euler Method
Midpoint Method
Runge-Kutta Method
Exercise
Given:
dL
dt
dS
dt
Number of
Species
3500
3000
2500
2000
1500
1000
500
0
0
Lion
Sheep
50
100
150
200
Time
h = 0.2
Number of 1000
Species
500
0
0
Sheep
50
h = 0.05
800
Lion
600
Sheep
400
200
0
0
50
100
150
200
Time
Discussions:
From the result shown in the table and graphs, we know that the smaller the value of step size
the lesser the percentage of error. The value in this case also will make the value to be much
more accurate by comparing to the exact value. All of the result we have calculated, h=0.05
will give the result which have the less error so we use h=0.05 for all method to compare with
method gives the lesser percentage of error and we find out it is Runge-Kutta Method (RK4).
For the exercise we have done for predator prey problem, we can see that the lions and sheep
growth in relation of time. The growth and death of this two species is vice versa to each
other. The lower step size value give a more accurate value because the number of species
against time did not deflect largely and maintain in a smooth curve.
Conclusions:
In a nut shell, we found that Runge-Kutta (RK4) method will give the best answer
which is accurate to the exact value which can be seen in the graph. This is because the other
method uses simpler calculation and lesser effort to gain the answer so the value we achieve
is less accurate to the exact method. In this lab, we have learn how to use excel to do the
calculation because in this kind of problem which required a lots of repeated steps in
calculation will cause a lot of human error without the aids of excel. We uses excel to get
lesser error as possible.