Вы находитесь на странице: 1из 7

UNIVERSITY OF AGRICULTURE MAKURDI

COLLEGE OF SCIENCE

DEPARTMENT OF MATHS/STATISTICS/COMPUTER SCIENCE

COURSE CODE: MTH 602

COURSE TITLE: MSC SEMINAR

TOPIC: A COMPARISON OF SOLUTIONS OF THE LORENZ MODEL USING EULER AND FOURTH AND ORDER RUNGE-KUTTA METHOD

STUDENT: ISIP UKOABASI NAME MAJOR SUPERVISOR: DR. T. ABOIYAR

MSC/3326/09 _______________ SIGN/DATE _____________________ SIGNATURE/DATE

MINOR SUPERVISOR: PROF. E. S. ONAH

________________________ SIGNATURE/DATE

1.0

Introduction

In this seminar paper, we shall examine the solution of the Lorenz Model. The earth's atmosphere is a layer of radially flowing fluid bounded by two boundaries of different temperature: the warm crust and the chilling upper stratosphere. In 1963, Edward Lorenz attempted to model this convection occurring in the earths atmosphere as a simple set of three first-order non-linear ordinary differential equations, called the Lorenz system. Like the weather, this system is highly sensitive to its initial conditions. Due to the non-linearity of the equations, an exact form of the solution cannot be calculated. Instead, numerical methods, such as Euler's and Runge-Kutta methods, are employed to calculate approximations to the system solution through iteration. 1.1 The Lorenz Model
dx1 = 10 x1 + 10 x 2 dt dx 2 = x1 x3 + 23 x1 x 2 dt dx 3 8 = x1 x 2 x3 dt 3

(1.1)

The above system is a special case of Lorenz equation with chaotic solutions. The highly sensitive nature of the solution of the initial conditions was discovered by Lorenz in 1963. Theoretical properties of Lorenz system, which was originally used to model uid circulation in atmosphere, is the subject of dynamical systems and chaos theory. The important features of these equations are: They are autonomous - time does not explicitly appear on the right hand side; They involve only rst order time derivatives so that (with the autonomy) the evolution depends only on the instantaneous value of(x1, x2, x3); They are non-linear, here through the quadratic terms x1x3 and x1x2 in the second and third equations; They are dissipativecrudely the diagonal terms such as X = X correspond to decaying motion. The solutions are bounded.

2.1 Solution of the Lorenz Model using Eulers method Eulers method is one the simplest methods for solving ODEs. With smaller step sizes, it can give fairly accurate solutions. For a system of ODEs x(i+1) = x1(i) + hf(t,x)) where x is an n-dimensional vector i.e. x = (x1, x2, , xn) Applying this to the Lorenz model we have the recurrence relation: x1(n) = x1(n-1) + h(-10x1+10x2) x2(n) = x2(n-1) + h(-x1x2 + 23x1 x2) x3(n) = x1(n-1)x2(n-1) (8/3)x3 which gives a sequence of iterates for [x1 x2 x3]T. We have solved the equation using the initial condition:

0 x ( 0) = 1 2 0

(1.2)

2.1 Solution of Lorenz Model by Runge-Kutta Method The method of Runge-Kutta is one of the well-known numerical methods for dierential equations. We have solved the equation using the initial condition:

0 x ( 0) = 1 2 0
2.1 Runge-Kutta methods of Order 4 and 5 Consider the system of ordinary differential equations
dx 1 = f 1 ( x1 , x 2 ,..., x n , t ) dt dx 2 = f 2 ( x1 , x 2 ,..., x n , t ) dt dx n = f n ( x1 , x 2 ,..., x n , t ) dt

(2.1)

Which can more simply be expressed as


dx = f ( x, t ) dt

(2.2)

Where x is an n-dimensional vector. This is a non-autonomous equation. If we replace the right hand side by f(x), that is, if we eliminate the explicit time-dependence, we will obtain an autonomous equation.
dx = f (x) dt

(2.3)

If the functions fi on the right hand side are nonlinear, we will need a numerical technique. We can use Taylor expansions, but they require the calculation of derivatives of the functions fi, which is impractical. The Runge-Kutta methods have the same accuracy as Taylor at any order, yet theres no need for derivatives.

Suppose we know the x at the time ti. Lets call it xi. Then we calculate x at ti+1 = ti+h as follows: Runge-Kutta method of Order 4
k1 = hf (t i , xi ) k h k 2 = hf t i + , xi + 1 2 2 k h k 3 = hf t i + , xi + 2 2 2 k 4 = hf (t i + h, xi + k 3 ) xi +1 = xi + 1 ( k1 + 2 k 2 + 2 k 3 + k 4 ) 6

(2.4)

Runge-Kutta Method of Order 5

2.2 MATLAB Algorithm for solution of Lorenz equation The following MATLAB le solves the Lorenz equation using Runge Kutta Method of order 4 or 5. By changing the first few lines, we can give the equation, initial point(s), step size, maximum running time, maximum error and the order of the method. The program will halt if the error limit is satisfied or time limit exceeded, whichever comes first. The given system must be an autonomous system of equations. %Fourth or Fifth order Runge-Kutta %to solve the system of autonomous ODE x =f(x) %where x=(x1,x2,...,xn) %prints the solution to matrix x. tic;clear; f=inline([-10*x(1)+10*x(2);-x(1)*x(3)+23*x(1)-x(2); x(1)*x(2)-(8/3)*x(3)]);%equation x0=[0 120]; %initialpoints k=2000; %k+1 is the number of columns of the solution matrix x dt=0.01; %step size of t error=10^(-4); %maximum error of x plotrange=[-1616 -2020 0 40];%the region to be plotted

order=5; %the order of the Runge-Kutta method. Must be 4 or 5. timelimit=3000; %maximum time allowed for the program to run. dim=size(x0,1);%the dimension of the system m=size(x0,2); %the number of initial points tmax=timelimit/4 fprintf(This program uses Runge-Kutta method of order%-2.0f\n,order) fprintf(starting with the initial point%2.2f %2.2f%2.2f\n,x0) fprintf(from time t=0to t=%-3.0f,k*dt) fprintf(with step size delta t=%2.12g\n,dt) fprintf(Itwill continue until error falls below%2.12g,error) fprintf(or time limit %3.0f,timelimit) fprintf(seconds is exceeded\n\n\n) for q=1:m x=zeros(dim,k+1); x(:,1)=x0(:,q); xprevious=repmat(inf,dim,k+1); ttt=0;e=inf;p=0; whilettt<tmax & e>error n=2^p; h=dt/n; ta=0;xa=x0(:,q); t0=clock; for j=1:n*k if order==4 k1=h*f(xa); k2=h*f(xa+k1/2); k3=h*f(xa+k2/2); k4=h*f(xa+k3); xa=xa+(k1+2*k2+2*k3+k4)/6; ta=j*h; elseif order==5 k1=h*f(xa); k2=h*f(xa+k1/2); k3=h*f(xa+(3*k1+k2)/16);

k4=h*f(xa+k3/2); k5=h*f(xa+(-3*k2+6*k3+9*k4)/16); k6=h*f(xa+(k1+4*k2+6*k3-12*k4+8*k5)/7); xa=xa+(7*k1+32*k3+12*k4+32*k5+7*k6)/90; ta=j*h; else fprintf(order must be 4 or5\n) break end if mod(j,n)==0; i=j/n; x(:,i+1)=xa; end end e=max(max(abs(x-xprevious))); xprevious=x; fprintf(step size =dt/%-2.0f,2^p) fprintf(= %2.12g\n,h) fprintf(estimated error <%2.12g\n,e) ttt=etime(clock,t0); fprintf(time in seconds= %2.1f\n\n,ttt) if e<error fprintf(ERROR LIMIT SATISFIED\n\n) elseifttt>tmax fprintf(TIME LIMIT EXCEEDED\n\n) end p=p+1; end plot3(x(1,:),x(2,:),x(3,:)); axis(plotrange); grid on; end fprintf(total time in seconds =%2.1f\n,toc)