Computer Application in Engineering Homework I: Mehmet Fatih Reyhan ID: 110170002
Computer Application in Engineering Homework I: Mehmet Fatih Reyhan ID: 110170002
Homework I
Mehmet Fatih Reyhan
ID : 110170002
1
Problem
dy
Solving the dx = f (x, y) = y + 2x − 1 differential equation numerically with Modified Euler, 4th order
Solution
Modified Euler
Method calculates the next step value by adding stepsize times averages of next step and current step
slopes to current step value. To calculate next step slope, first next step value is calculated by classical
Euler method. This is called predictor step. By using next step slope and current step slope, next
yn+1 = yn + hf (xn , yn )
In this method next step is calculated by adding stepsize times weighted averages of slopes for different
k1 =hf (xn , yn )
h k1
k2 =hf (xn + , yn )
2 2
h k2
k3 =hf (xn + , yn )
2 2
k4 =hf (xn + h, yn + k3 )
k1 + 2k2 + 2k3 + k4
yn+1 =yn +
6
2
Adams-Bashford
The methods mentioned above is single-step methods. They use the values of the last step. But
Adams-Bashford is a multistep method that uses different values of y and y 0 to calculate next step.
h
yn+1 = yn + (23fn − 16fn−1 + 5fn−2 )
12
First three values of f are needed to calculate next steps . These values are taken from 4th order
Error
These solutions are done by taking step size h = 0.1 and h = 0.05. All values and errors can be found
in the HW1.m file with the solution algortihms. Global errors can be seen by the following table for
Solution Method
Global Error
Modified Euler 4th Order Runge-Kutta Adams-Bashford
h = 0.1 0.0084 4.17E-06 0.0015
step size
h = 0.05 0.0022 2.72E-07 2.17E-04
Conclusion
As can be seen from the table as step size decreased accuracy of solution increases. And the most
accurate method is 4th order Runge-Kutta which have a global error of O(h4 ). Adams-Bashford have a
global error of O(h3 ) degree. Modified euler have a gloabal error of O(h2 ) degree. As stepsize becomes
half global errors decreased approximately 4 times, 16 times and 8 times respectively for Modified