Você está na página 1de 3

Advanced Mathematics 2

AE 5001

1st Assignment
The following initial value problem solved by computer using the euler, modified euler,
and the fourth order Runge-Kutta algorithm. The problem is taken from Advanced Engineering
Mathematics (Jeffrey, 2002), exercises 19.7, problem number 20.

= sin + 4 cos

= sin 3 sin

With (0) = 1, (0) = 2, and = 0.2 over the interval 0 1.

Exact value
The value of x and y were calculated using MATLAB ODE solvers ode45. ode45 is used to
evaluate solution of differential equation problem. This function implements a Runge-Kutta
method with a variable time step for efficient computation. ode45 is design to handle the
following general problem:

= (, ),

(0 ) = 0 ,

Where t is the independent variable, x is the vector of dependent variables to be found and f(t,x)
is a function of t and x. the mathematical problem is specified when the vector of functions on
the right hand side of the above equation is set and the initial conditions, x=x0 at time t0 are
given. With the time step of 0.2, the value of x and y calculated using MATLAB are
t

-2

0.2

0.614

-2.589

0.4

-0.066

-2.835

0.6

-0.899

-2.640

0.8

-1.688

-2.206

-2.208

-1.840

Euler Method
Euler method or the Euler-Cauchy method for this problem is started given the system

= (, )

= (, )

Advanced Mathematics 2
AE 5001

The initial condition (x0, y0), and step size h, Eulers method approximates a solution (x, y) by
+1 = + ( , )
+1 = + (, )
Geometrically it is an approximation of the curve x (t) and y (t) by using a polygon. Using the
Euler method, the approximate values of x and y at 0 < t < 1 are
t

-2

0.2

0.835

-2.687

0.4

0.265

-3.220

0.6

-0.480

-3.361

0.8

-1.353

-3.040

-2.345

-2.475

Improved Euler Method


The modified Euler method, applied to the problem, comprises the following statements:
Given x0 and y0, for i=0, 1 N-1
1, = ( , , )
1, = ( , , )
2, = ( + , + 1, , + 1, )
2, = ( + , + 1, , + 1, )
1
1+1 = + (1, + 2, )
2
1
1+1 = + (1, + 2, )
2
The modified Euler method is a predictor-corrector method, because in each step we predict a
value and then correct it. Apply the modified Euler method to the system, then we get the value
of x and y
t

-2

0.2

0.633

-2.610

0.4

-0.046

-2.864

0.6

-0.896

-2.682

0.8

-1.698

-2.272

Advanced Mathematics 2
AE 5001

-2.224

-1.948

Runge-Kutta 4th Order


A method of great practical importance and much greater accuracy than that of the Euler
method is the classical Runge-Kutta method of fourth order, which we call the Runge-Kutta
method. In each step we first compute four auxiliary quantities k1, k2, k3, k4, and then the new
value yn+1. For simultaneous ODE, there are 8 auxiliary quantities needed to find the value of
x and y.
t

-2

0.2

0.614

-2.588

0.4

-0.066

-2.834

0.6

-0.898

-2.640

0.8

-1.685

-2.205

-2.205

-1.840

MATLAB Algorithm
%% ODE 45
f = inline('[sin(y(1))+4*cos(y(2));sin(y(2))-3*sin(y(1))]','t','y');
[t,y]=ode45(f,[0,1],[1,-2]);

Você também pode gostar