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

CSU Vision CSU Mission Core Values CSU IGA

Transforming lives by CSU is committed to transform the lives Productivity Compassion Competent
of people and communities through high Accessibility Accountability
quality instruction and innovative Relevance
Self-disciplined
Excellence
research, development, production and

Republic of the Philippines

Cagayan State University

COLLEGE OF ENGINEERING

Carig Sur, Tuguegarao City

DEPARTMENT OF CHEMICAL ENGINEERING

Advance Engineering Mathematics for ChE

(ChE 56)

Second Semester 2016 – 2017

Course Topic: NUMERICAL APPROXIMATION METHODS FOR THE SOLUTIONS OF

ORDINARY DIFFERENTIAL EQUATION USING MATLAB®

Course Activity: RESEARCH

1
Name of Students: ABAYA, MARIA HAZEL M.

ACEBEDO, DAPHNE SHEERAH C.

ALUMIT, RAZEL JR. V.

ANDRADA, FILMAR T.

BADUA, REYNALDO JR. A.

Program: BS Chemical Engineering

Year Level: III

Date Submitted: May 12, 2017

Instructor: Engr. CAESAR P. LLAPITAN Rating: ________

Date Checked: ________

2
NUMERICAL APPROXIMATION METHODS FOR THE SOLUTIONS OF
ORDINARY DIFFERENTIAL EQUATION USING MATLAB®

Table of Contents

I. Introduction……………………...……………………………………………..………….1
II. Theoretical Background………………………………………………………..………….2

Discussion of methods

III. Numerical Analysis………………………………………………………..……………..10


a. General Algorithms
b. General Flowcharts
c. General M-files
IV. Applications………………………………………………………………...…………….31
a. Problem Statement
b. Solutions
1. Analytical
2. Euler’s Method
3. Heun’s Method.
4. Midpoint Method
5. Ralston’s Method
6. 4th Order Runge-Kutta Method
V. Generalizations…………………………………………………...………………………62
VI. References…………………………………………………..……………………………64

3
I. Introduction

Historically, numerical methods of working with differential equations were developed


when some equations could not be solved analytically—that is, with their solutions expressed
in terms of elementary functions. Over the past 300 years, mathematicians and scientists have
learned to solve more and more types of differential equations. However, today there are still
complex and nonlinear equations that are impossible to solve using pure mathematical
analysis. In fact, very few differential equations that arise in applications can be solved
exactly; and, perhaps more important, even solution formulas often express the solutions
implicitly via complicated combinations of the solution and the independent variable that are
difficult to work with. This problem exhorts mathematician to use computer simulations and
numerical approximations of their solutions. In this paper we will describe some ways of
getting an approximate numerical solution by using different method and will describe their
discrepancies graphically. This means being able to calculate approximate values of the
solution function y by some process requiring a finite number of steps, so that at the end of
this step-by-step process we are reasonably close to the “true” answer. Graphically, we are
trying to approximate the solution curve with a simpler curve, usually a curve made up of
straight line segments.

4
II. Theoretical Background

Ordinary differential equations of the form

𝑑𝑦
= 𝑓( 𝑡, 𝑦) (1)
𝑑𝑡

can be solved using a developed numerical method in the general form of


New value = old value + slope × step size

or, in mathematical terms,


𝑦𝑖+1 = 𝑦𝑖 + 𝜑ℎ (2)

where the slope φ is called an increment function and according to this equation, the slope
estimate of φ is used to extrapolate from an old value yi to a new value yi+1 over a distance h.
One-step methods are expressed in this general form, with only the manner in which the
slope is estimated being the difference. These one-step methods are discussed,

A. EULER’S METHOD

The simplest approach to solving ordinary differential equations is to use the differential
equation to estimate the slope in the form of the first derivative at ti. The slope at the
beginning of the interval is taken as an approximation of the average slope over the whole
interval. This approach of obtaining an approximation to a solution curve is attributed to the
mathematician Euler. This approach is called the Euler’s method.

y
Predict

True
}
h

𝑡𝑖 𝑡𝑖+1

5
Figure 1: Euler’s Method

In Euler’s method, the first derivative provides a direct estimate of the slope at ti ,
𝜑 = 𝑓(𝑡𝑖 , 𝑦𝑖 ) (3)
where f (ti, yi) is the differential equation evaluated at ti and yi. This estimate can be
substituted into Equation 1.2:
𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑡𝑖 , 𝑦𝑖 )ℎ (4)
This formula is referred to as the Euler’s method (or the Euler-Cauchy or point-slope
method). A new value of y is predicted using the slope (equal to the first derivative at the
original value of t) to extrapolate linearly over the step size h (Figure 1.1).

B. HEUN’S METHOD

A fundamental source of error in Euler’s method is that the derivative at the beginning of
the interval is assumed to apply across the entire interval. Two simple modifications are
available to help circumvent this shortcoming. One modification, being the Heun’s method, is
first discussed.
One method to improve the estimate of the slope involves the determination of two
derivatives for the interval—one at the beginning and another at the end. The two derivatives
are then averaged to obtain an improved estimate of the slope for the entire interval. This
approach is called the Heun’s method and is depicted graphically in Fig. 1.2.

y Slope = f (ti + 1, y0i + 1)

Slope = f (ti, yi)

𝑡𝑖 𝑡𝑖+1 t

Figure 2: Graphical depiction of Heun’s method. (a) Predictor and (b) corrector

6
Recall that in Euler’s method, the slope at the beginning of an interval

𝑦𝑖′ = 𝑓(𝑡𝑖 , 𝑦𝑖 ) (5)

is used to extrapolate linearly to yi+1:

0
𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑡𝑖 , 𝑦𝑖 )ℎ (6)

For the standard Euler method we would stop at this point. However, in Heun’s method
0
the 𝑦𝑖+1 calculated in Equation1.6 is not the final answer, but an intermediate prediction.
Equation 1.6 is called a predictor equation. It provides an estimate that allows the calculation
of a slope at the end of the interval:

′ 0
𝑦𝑖+1 = 𝑓(𝑡𝑖+1 , 𝑦𝑖+1 ) (7)

Thus, the two slopes Equations 1.5 and 1.7 can be combined to obtain an average slope
for the interval:

f (ti , yi )  f (ti 1 , yi01 )


y'  (8)
2

This average slope is then used to extrapolate linearly from yi to yi+1 using Euler’s method:

f (ti , yi )  f (ti 1 , yi01 )


yi 1  yi  h
2 (9)

which is called a corrector equation.

C. MIDPOINT METHOD

Figure 3: Graphical depiction of midpoint method.

7
(a) Predictor and (b) corrector

Another simple modification of Euler’s method is called the midpoint method. This
technique uses Euler’s method to predict a value of y at the midpoint of the interval (Figure
3):
h
yi 1/ 2  yi  f (ti , yi )
2 (10)
Then, this predicted value is used to calculate a slope at the midpoint:
yi' 1/ 2  f (ti 1/ 2 , yi 1/ 2 )
(11)

which is assumed to represent a valid approximation of the average slope for the entire
interval. This slope is then used to extrapolate linearly from t i to t i 1 (Figure 3b):

yi1  yi  f (ti1/ 2 , yi1/ 2 )h (12)

RUNGE-KUTTA METHODS

Runge-Kutta methods achieve the accuracy of a Taylor series approach without requiring
the calculation of higher derivatives. Many variations exist but all can be cast in the
generalized form of Equation 2:
𝑦𝑖+1 = 𝑦𝑖 + φh

where φ is called an increment function, which can be interpreted as a representative


slope over the interval. The increment function can be written in general form as

  a1 k1  a 2 k 2  ...  a n k n
(13)

where the a’s are constants and the k’s are

k1  f (ti , yi )
(14)

k 2  f (t i  p1h, yi  q11k1h)
(15)

8
k3  f (ti  p2 h, yi  q21k1h  q22k2 h)
(16)

...

k n  f (ti  pn1 , yi  qn1 ,1 k1h  qn1, 2 k 2 h  ...  qn1 , n1 k n1h) (17)

The p’s and q’s are constants. The k’s are recurrence relationships. That is, k1 appears in
the equation for k2, which appears in the equation for k3, and so forth. Because each k is a
functional evaluation, this recurrence makes RK methods efficient for computer calculations.
Various types of Runge-Kutta methods can be devised by employing different numbers of
terms in the increment function as specified by n. The number of terms n usually represents
the order of the approach.

D. SECOND-ORDER RUNGE-KUTTA METHODS


The second-order version of Equation 13 is
yi1  yi  (a1k1  a2 k2 )h (18)
where
k1  f (ti , yi ) (19)
k2  f (ti  p1h, yi  q11k1h) (20)
The values for a1, a2, p1, and q11 are evaluated by setting Equation 18 equal to a second-
order Taylor series. By doing this, three equations can be derived to evaluate the four
unknown constants. The three equations are:
a1  a2  1 (21)
a2 p1  1 / 2 (22)
a2 p1  1 / 2 (23)
Because we have three equations with four unknowns, these equations are said to be
underdetermined. We, therefore, must assume a value of one of the unknowns to determine
the other three. Suppose that we specify a value for a2. Then Equations (21) through (23) can
be solved simultaneously for
a1  1  a2 (24)

9
1
p1  q11 
2 a2 (25)

Because we can choose an infinite number of values for a2, there are an infinite number of

second-order RK methods. Every version would yield exactly the same results if the solution

to the ODE were quadratic, linear, or a constant. However, they yield different results when

(as is typically the case) the solution is more complicated. Three of the most commonly used

and preferred versions are presented next.

i. Heun Method without Iteration ( a2  1 / 2 )


If a2 is assumed to be 1 / 2 , Eqs. (24) and (25) can be solved for a1  1 / 2 and

a1  1 / 2  p1  q11  1 . These parameters, when substituted into Eq. (22), yield

1 1 
yi 1  yi   k1  k 2 h (26)
2 2 
Where
k1  f (ti , yi ) (27)

k2  f (ti  h, yi  k1h) (28)

Note that k1 is the slope at the beginning of the interval and k2 is the slope at the end of

the interval. Consequently, this second-order Runge-Kutta method is actually Heun’s

technique without iteration of the corrector.

ii. The Midpoint Method (𝑎2 = 1)


If a2 is assumed to be 1, then a1  0, p1  q11  1 / 2 , and Eq. (18) becomes
yi 1  yi  k 2 h (29)
Where
k1  f (ti , yi ) (30)

k2  f (ti  h / 2, yi  k1h / 2) (31)


This is the midpoint method.

10
iii. Ralston’s Method (a2 = 2/3)
Ralston (1962) and Ralston and Rabinowitz (1978) determined that choosing a2=2/3
provides a minimum bound on the truncation error for the second-order RK algorithms. For
this version, a1 =1/3 and p1 =q11 =3/4, and Eq. (18) becomes

1 2 
yi 1  yi   k1  k2 h (32)
3 3 
Where
k1  f (ti , yi ) (33)

 3 3 
k 2  f  ti  h, yi  k1h  (34)
 4 4 

E. CLASSICAL FOURTH-ORDER RUNGE-KUTTA METHOD


The most popular RK methods are fourth order. Just like the second-order approaches,
there also are an infinite number of versions. The following is the most commonly used form,
and we therefore call it the classical fourth-order RK method:
1
yi 1  yi  (k1  2k2  2k3  k4 )h
6 (35)
where
k1  f (ti , yi ) (36)
 1 1 
k 2  f  ti  h, yi  k1h 
 2 2  (37)
 1 1 
k3  f  ti  h, yi  k 2 h 
 2 2  (38)
k4  f (ti  h, yi  k3h)
(39)

The fourth-order RK method is similar to the Heun approach in that multiple estimates of
the slope are developed to come up with an improved average slope for the interval. As

11
depicted in Figure 1.4, each of the k’s represents a slope. Equation (35) then represents a
weighted average of these to arrive at the improved slope.

Figure 4: Graphical depiction of the slope estimates comprising the fourth-order RK


method.

12
III. Numerical analysis:
General algorithm for Euler’s method
1. Start
2. Define the function.
3. Declare the variables (dydt, t,y).
4. State initial conditions (t0, y0) , n, and step size(h).
5. Start loop. Check if i<n
If yes, continue to 6
If no proceed to 9
6. Calculate the value of y
7. Add a step
8. Return to 5
9. Display the results.
10. Plot (t,y).
11. End.

13
GENERAL FLOWCHART FOR EULER’S METHOD
Start

F(t, y)

t(1)=t0, y(1)=y0

steps size, h

i+1
Plot(t,y) print(t,y) i< n
No

Yes
END
yi+1 = yi + f (ti,yi)h

ti1  ti  h

The program to solve the problem using MATLAB starts with the definition of function,
declaration of variables, and reading the required initial conditions. The next part is the loop
where the program checks if the function is executed as the number of times specified. If not,
he program will proceed in solving the equation given and find for the required outputs. This

14
process will continue until it satisfies the desired number of executions needed. In the last
part, the program will display the results with the graph.

Problem Code for the solution of ODE using Euler’s method:

% eulers method

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt='f(t,y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time


t0 ;

% y0, corresponding value of y at t0


y0;

% tf, upper boundary of time t (end time).


tf;
% n, number of steps to take
n;

% Displays title information


disp(sprintf('\n\nthe eulers method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('------------------------------------------------'))

15
% Adding Step Size
ta(i+1)=ta(i)+h ;
% Using eulers formula
ya(i+1)=ya(i)+ f(ta(i),ya(i))*h

disp(sprintf('1) Apply the eulers method to estimate y%g',i))


disp(sprintf(' y%g = y%g +f(ta(i),ya(i))*h',i,i-1))
disp(sprintf(' = %g + %g * %g * %g',ya(i),f(ta(i),ya(i)),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel
ylabel
title

disp(sprintf('\n\n***********************Results********************'))

16
General Algorithm for Heun’s method:
1. Start
2. Define the function.
3. Declare the variables (dydt, t,y).
4. State initial conditions (t0, y0) , n, and step size(h).
5. Start loop. Check if i<n
If yes, continue to 6
If no proceed to 9
6. Calculate y
7. Add a step
8. Return to 5
9. Display the results.
10. Plot (t,y).
11. End.

17
General Flowchart for Heun’s method
Start

F(t, y)

t(1)=t0, y(1)=y0

steps size, h

i+1
Plot(t,y) print(t,y) i< n
No

Yes
END
h
y i 1  y i  ( k1  2 k 2  2 k 3  k 4 )
6

ti1  ti  h

The program to solve the problem using MATLAB starts with the definition of function,
declaration of variables, and reading the required initial conditions. The next part is the loop
where the program checks if the function is executed as the number of times specified. If not,
he program will proceed in solving the equation given and find for the required outputs. This
process will continue until it satisfies the desired number of executions needed. In the last
part, the program will display the results with the graph.

18
Problem Code for the solution of ODE using Heun’s method:

% heuns method

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt=’f(t,y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time


t0=(enter initial time);

% y0, corresponding value of y at t0


Y0=(enter initial value of y);

% tf, upper boundary of time t (end time).


Tf=(enter final time);

% n, number of steps to take


n=(enter number of steps);
% Displays title information
disp(sprintf('\n\nthe heuns method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('-------------------------------------------------'))

19
% Adding Step Size
ta(i+1)=ta(i)+h ;

% Using heuns formula


ya(i+1)=ya(i)+0.5*h*(f(ta(i),ya(i))+f(ta(i)+h,ya(i)+h*f(ta(i),ya(i))))
disp(sprintf('1) Apply the heuns method to estimate y%g',i))
disp(sprintf(' y%g = y%g +
0.5*h*(f(ta(i),ya(i))+f(ta(i)+h*ya(i)+h*f(ta(i),ya(i))))',i,i-1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),0.5,h,(f(ta(i),ya(i))+f(ta(i)+h,ya(i)+h*f(ta(i),ya(i)))),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel
ylabel
title

disp(sprintf('\n\n*********************Results*************************'))

20
General Algorithm for midpoint method:
1. Start
2. Define the function.
3. Declare the variables (dydt, t,y).
4. State initial conditions (t0, y0) , n, and step size(h).
5. Start loop. Check if i<n
If yes, continue to 6
If no proceed to 10
6. Calculate the values of k1, and k2 using the initial values given.
7. Calculate the value of y using the values of k1, and k2 calculated.
8. Add a step
9. Return to 5
10. Display the results.
11. Plot (t,y).
12. End.

21
General Flowchart for Midpoint method
Start

F(t, y)

t(1)=t0, y(1)=y0

steps size, h

i+1
Plot(t,y) print(t,y) i< n
No

Yes
END
k1  f (ti , yi )

k2  f (ti  h / 2, yi  k1h / 2)

yi 1  yi  k 2 h

ti 1  ti  h

The program to solve the problem using MATLAB starts with the definition of function,
declaration of variables, and reading the required initial conditions. The next part is the loop

22
where the program checks if the function is executed as the number of times specified. If not,
he program will proceed in solving for the values of k depending on the order of the method
used then compute the required outputs. This process will continue until it satisfies the
desired number of executions needed. In the last part, the program will display the results
with the graph.

Problem Code for the solution of ODE using midpoint method:

% midpoint

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt='f(t,y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time


t0=(enter initial time) ;

% y0, corresponding value of y at t0


y0=(enter initial value of y);

% tf, upper boundary of time t (end time).


tf=(enter tfinal);

% n, number of steps to take


n=(enter number of steps);

% Displays title information


disp(sprintf('\n\nthe midpont method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

23
ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('------------------------------------------------'))

% Adding Step Size


ta(i+1)=ta(i)+h ;
% Calculating k1, and k2
k1 = f(ta(i),ya(i)) ;
k2 = f(ta(i)+0.5*h,ya(i)+0.5*k1*h) ;

% Using midpoint formula


ya(i+1)=ya(i)+k2*h ;

disp('1) Find k1 and k2 using the previous step information.')


disp(sprintf(' k1 = f( t%g , y%g )',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i),ya(i)))
disp(sprintf(' = %g\n',k1))
disp(sprintf(' k2 = f( t%g + 0.5 * h , y%g + 0.5 * k1 * h )',i-
1,i-1))
disp(sprintf(' = f( %g + 0.5 * %g , %g + 0.5 * %g *
%g)',ta(i),h,ya(i),k1,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.5*h,ya(i)+0.5*k1*h))
disp(sprintf(' = %g\n',k2))

disp(sprintf('2) Apply the midpoint to estimate y%g',i))


disp(sprintf(' y%g = y%g + k2*h',i,i-1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),((1/3)*k1+(2/3)*k2),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel
ylabel
title

24
disp(sprintf('\n\n**********************Results*************************'))
General Algorithm for Ralston’s method:
1. Start
2. Define the function.
3. Declare the variables (dydt, t,y).
4. State initial conditions (t0, y0) , n, and step size(h).
5. Start loop. Check if i<n
If yes, continue to 6
If no proceed to 10
6. Calculate the values of k1,and k2 using the initial values given.
7. Calculate the value of y using the values of k1, k2 calculated.
8. Add a step
9. Return to 5
10. Display the results.
11. Plot (t,y).
12. End.

25
General Flowchart for Ralston’s method
Start

F(t, y)

t(1)=t0, y(1)=y0

steps size, h

i+1
Plot(t,y) print(t,y) i< n
No

Yes
END
k1  f (ti , yi )

 3 3 
k 2  f  ti  h, yi  k1h 
 4 4 

1 2 
yi 1  yi   k1  k2 h
3 3 

ti 1  ti  h

26
The program to solve the problem using MATLAB starts with the definition of function,
declaration of variables, and reading the required initial conditions. The next part is the loop
where the program checks if the function is executed as the number of times specified. If not,
he program will proceed in solving for the values of k depending on the order of the method
used then compute the required outputs. Since this is a second order method, the program will
first determine two values of k. This process will continue until it satisfies the desired number
of executions needed. In the last part, the program will display the results with the graph.

Problem Code for the solution of ODE using Ralston method:


% ralston method

% Solve dy/dt = f(t,y)%

function dydt=f(t,y)
dydt='f(t,y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time

t0=(enter initial time) ;

% y0, corresponding value of y at t0

y0=(enter initial value of y);

% tf, upper boundary of time t (end time).

tf=(enter final time);


% n, number of steps to take

n=(enter number of steps);


% Displays title information
disp(sprintf('\n\nthe Ralston method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))

27
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('-------------------------------------------------------
'))

% Adding Step Size


ta(i+1)=ta(i)+h ;
% Calculating k1, and k2
k1 = f(ta(i),ya(i)) ;
k2 = f(ta(i)+0.75*h,ya(i)+0.75*k1*h ) ;

% Using ralston formula


ya(i+1)=ya(i)+((1/3)*k1+(2/3)*k2)*h ;

disp('1) Find k1 and k2 using the previous step information.')


disp(sprintf(' k1 = f( t%g , y%g )',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i),ya(i)))
disp(sprintf(' = %g\n',k1))
disp(sprintf(' k2 = f( t%g + 0.75*h , y%g + 0.75*ki*h )',i-1,i-1))
disp(sprintf(' = f( %g + 0.75 * %g , %g + 0.75 * %g *
%g)',ta(i),h,ya(i),k1,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.75*h,ya(i)+0.75*k1*h))
disp(sprintf(' = %g\n',k2))

disp(sprintf('2) Apply the ralston formula to estimate y%g',i))


disp(sprintf(' y%g = y%g + k2*h',i,i-1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),((1/3)*k1+(2/3)*k2),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel
ylabel

28
title

disp(sprintf('\n\n*********************Results**************************'))
General Algorithm for 4th order Runge-Kutta method:
1. Start
2. Define the function.
3. Declare the variables (dydt, t,y).
4. State initial conditions (t0, y0) , n, and step size(h).
5. Start loop. Check if i<n
If yes, continue to 6
If no proceed to 10
6. Calculate the values of k1, k2, k3, k4 using the initial values given.
7. Calculate the value of y using the values of k1, k2, k3, k4 calculated.
8. Add a step
9. Return to 5
10. Display the results.
11. Plot (t,y).
12. End.

29
General Flowchart for 4th order Runge-Kutta method
Start

F(t, y)

t(1)=t0, y(1)=y0

steps size, h

i+1
Plot(t,y) print(t,y) i< n
No

Yes
END
k1  f (ti , yi )
1 1
k2  f (ti  h, yi  hk1 )
2 2
1 1
k3  f (ti  h, yi  hk2 )
2 2
k4  f (ti  h, yi  hk3 )

h
y i 1  y i  ( k1  2 k 2  2 k 3  k 4 )
6

ti 1  ti  h

30
The program to solve the problem using MATLAB starts with the definition of function,
declaration of variables, and reading the required initial conditions. The next part is the loop
where the program checks if the function is executed as the number of times specified. If not,
he program will proceed in solving for the values of k depending on the order of the method
used then compute the required outputs. Since this is a fourth order method, the program will
first determine four values of k. This process will continue until it satisfies the desired
number of executions needed. In the last part, the program will display the results with the
graph.

Problem Code for the solution of ODE using 4th- Order Runge-Kutta Method:

% RK4 method

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt=’f(t,y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time

t0=(enter initial time) ;


% y0, value of y at t0

y0=(enter initial value of y);


% tf, upper boundary of time t

tf=(enter final time);


% n, number of steps to take

n=(enter number of steps);


% Displays title information

31
disp(sprintf('\n\nThe 4th Order Runge-Kutta Method of Solving Ordinary
Differential Equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('------------------------------------------------------
'))

% Adding Step Size


ta(i+1)=ta(i)+h ;
% Calculating k1, k2, k3, and k4
k1 = f(ta(i),ya(i)) ;
k2 = f(ta(i)+0.5*h,ya(i)+0.5*k1*h) ;
k3 = f(ta(i)+0.5*h,ya(i)+0.5*k2*h) ;
k4 = f(ta(i)+h,ya(i)+k3*h) ;

% Using 4th Order Runge-Kutta formula


ya(i+1)=ya(i)+1/6*(k1+2*k2+2*k3+k4)*h ;
disp('1) Find k1,k2,k3 and k4 using the previous step information.')
disp(sprintf(' k1 = f( t%g , y%g )',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i),ya(i)))
disp(sprintf(' = %g\n',k1))
disp(sprintf(' k2 = f( t%g + 0.5 * h , y%g + 0.5 * k1 * h )',i-
1,i-1))
disp(sprintf(' = f( %g + 0.5 * %g , %g + 0.5 * %g *
%g)',ta(i),h,ya(i),k1,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.5*h,ya(i)+0.5*k1*h))
disp(sprintf(' = %g\n',k2))

disp(sprintf(' k3 = f( t%g + 0.5 * h , y%g + 0.5 * k2 * h )',i-


1,i-1))

32
disp(sprintf(' = f( %g + 0.5 * %g , %g + 0.5 * %g *
%g)',ta(i),h,ya(i),k2,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.5*h,ya(i)+0.5*k2*h))
disp(sprintf(' = %g\n',k3))
disp(sprintf(' k4 = f( t%g + h, y%g + k3*h)',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i)+h,ya(i)+k3*h))
disp(sprintf(' = %g\n',k1))
disp(sprintf('2) Apply the Runge-Kutta 4th Order method to estimate
y%g',i))
disp(sprintf(' y%g = y%g + 1/6*( k1 + 2*k2 + 2*k3 +k4) * h',i,i-
1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),1/6,(k1+2*k2+2*k3+k4),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel
ylabel
title
disp(sprintf('\n\n********************Results************************'))

33
IV. Application:

Problem statement:
Solve the following problem over the interval from t = 0 to 1 using a step size of 0.25
where y(0) = 1.
𝑑𝑦
= ( 1 + 4𝑡)√𝑦
𝑑𝑡

Analytical method:

𝑑𝑦
= ( 1 + 4𝑡) √𝑦
𝑑𝑡
𝑑𝑦
= (1 + 4𝑡)𝑑𝑡
√𝑦
1
𝑦 −2 𝑑𝑦 = (1 + 4𝑡)𝑑𝑡

Integrating both sides of the equation, the following result is obtained:

2√𝑦 = 𝑡 + 2𝑡 2 + c
At x=0, y(0)=1 , c = 2
Therefore the final expression is:
(𝑡 + 2𝑡 2 + 2)2
𝑦(𝑡) =
4

Substituting values of t into the equation on the interval [0,1] with the step size 0.25, the
values of y obtained are 1.410156, 2.25, 3.7539,6.25.

34
Euler’s Method
Algorithm:
1. Start
2. Function definition: dydt = (1+4x) y
3. Variable declaration (dydt, t,y).
4. State initial conditions
t0= 0
y0= 1
tf = 1
h= 0.25
5. Start loop. Check if i<n
n= 4
If yes, continue to 6
If no proceed to 8
6. Calculate the value of y
y i  1  yi  f (ti, yi )h
Add a step: i+1
7. Return to 5
8. Display the results.
9. Plot (t,y).
10. End.

35
Flowchart
Start

F(t, y)
dydt = (1+4x) y

t0=0, y0=1

steps size, h=0.25

i+1
i< n
Plot(t,y) print(t,y)
No n=4

Yes
END

yi+1 = yi + f (ti,yi)h

ti1  ti  h

36
Problem Code for the solution of ODE using Euler’s method:

% eulers method

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt='(1+4*t)*sqrt(y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time


t0=0 ;

% y0, corresponding value of y at t0


y0=1;

% tf, upper boundary of time t (end time).


tf=1;
% n, number of steps to take
n=4;

% Displays title information


disp(sprintf('\n\nthe eulers method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n

37
disp(sprintf('\nStep %g',i))
disp(sprintf('------------------------------------------------'))

% Adding Step Size


ta(i+1)=ta(i)+h ;
% Using eulers formula
ya(i+1)=ya(i)+ f(ta(i),ya(i))*h

disp(sprintf('1) Apply the eulers method to estimate y%g',i))


disp(sprintf(' y%g = y%g +f(ta(i),ya(i))*h',i,i-1))
disp(sprintf(' = %g + %g * %g * %g',ya(i),f(ta(i),ya(i)),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel('time')
ylabel('y')
title('eulers method result')

disp(sprintf('\n\n*********************Results*******************'))

38
Output:

39
40
41
Heun’s Method
Algorithm:
1. Start
2. Function definition: dydt = (1+4x) y
3. Variable declaration (dydt, t,y).
4. State initial conditions
t0= 0
y0= 1
tf = 1
h= 0.25
5. Start loop. Check if i<n
n= 4
If yes, continue to 6
If no proceed to 9
6. Calculate the value of y
h
y i 1  y i  ( k1  2 k 2  2 k 3  k 4 )
6
7. Add a step: i+1
8. Return to 5
9. Display the results.
10. Plot (t,y).
11. End.

42
Flowchart
Start

F(t, y)
dydt = (1+4x) y

t0=0,y0=1

steps size, h=0.25

i< n i+1
Plot(t,y) print(t,y)
No n=4

Yes
END
h
y i 1  y i  ( k1  2 k 2  2 k 3  k 4 )
6

ti1  ti  h

Problem Code for the solution of ODE using Heun’s method:

43
% heuns method

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt='(1+4*t)*sqrt(y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time


t0=0 ;

% y0, corresponding value of y at t0


y0=1;

% tf, upper boundary of time t (end time).


tf=1;

% n, number of steps to take


n=4;
% Displays title information
disp(sprintf('\n\nthe heuns method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('-------------------------------------------------'))

% Adding Step Size


ta(i+1)=ta(i)+h ;

% Using heuns formula


ya(i+1)=ya(i)+0.5*h*(f(ta(i),ya(i))+f(ta(i)+h,ya(i)+h*f(ta(i),ya(i))))

44
disp(sprintf('1) Apply the heuns method to estimate y%g',i))
disp(sprintf(' y%g = y%g +
0.5*h*(f(ta(i),ya(i))+f(ta(i)+h*ya(i)+h*f(ta(i),ya(i))))',i,i-1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),0.5,h,(f(ta(i),ya(i))+f(ta(i)+h,ya(i)+h*f(ta(i),ya(i)))),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel('time')
ylabel('y')
title('heuns method result')

disp(sprintf('\n\n*********************Results*************************'))

Output:

45
46
Midpoint Method
Algorithm:
1. Start
2. Function definition: dydt = (1+4x) y
3. Variable declaration (dydt, t,y).
4. State initial conditions
t0= 0
y0= 1
tf = 1
h= 0.25
5. Start loop. Check if i<n
n= 4
If yes, continue to 6
If no proceed to 9
6. Calculate the values of k1, and k2 using the initial values given.
k1  f (ti , yi )

k2  f (ti  h / 2, yi  k1h / 2)

7. Calculate the value of y using the values of k1, and k2 calculated.


yi 1  yi  k 2 h

8. Add a step: i+1


9. Return to 5
10. Display the results.
11. Plot (t,y).
12. End.

47
Flowchart
Start

F(t, y)
dydt = (1+4x) y

t0=0,y0=1

steps size, h= 0.25

i+1
i< n
Plot(t,y) print(t,y)
No n=4

Yes
END
k1  f (ti , yi )

k2  f (ti  h / 2, yi  k1h / 2)

yi 1  yi  k 2 h

ti 1  ti  h

48
Problem Code for the solution of ODE using midpoint method:

% midpoint

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt='(1+4*t)*sqrt(y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time


t0=0 ;

% y0, corresponding value of y at t0


y0=1;

% tf, upper boundary of time t (end time).


tf=1;

% n, number of steps to take


n=4;

% Displays title information


disp(sprintf('\n\nthe midpont method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('------------------------------------------------'))

% Adding Step Size


ta(i+1)=ta(i)+h ;

49
% Calculating k1, and k2
k1 = f(ta(i),ya(i)) ;
k2 = f(ta(i)+0.5*h,ya(i)+0.5*k1*h) ;

% Using midpoint formula


ya(i+1)=ya(i)+k2*h ;

disp('1) Find k1 and k2 using the previous step information.')


disp(sprintf(' k1 = f( t%g , y%g )',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i),ya(i)))
disp(sprintf(' = %g\n',k1))
disp(sprintf(' k2 = f( t%g + 0.5 * h , y%g + 0.5 * k1 * h )',i-
1,i-1))
disp(sprintf(' = f( %g + 0.5 * %g , %g + 0.5 * %g *
%g)',ta(i),h,ya(i),k1,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.5*h,ya(i)+0.5*k1*h))
disp(sprintf(' = %g\n',k2))

disp(sprintf('2) Apply the midpoint to estimate y%g',i))


disp(sprintf(' y%g = y%g + k2*h',i,i-1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),((1/3)*k1+(2/3)*k2),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel('time')
ylabel('y')
title('heuns method result')

disp(sprintf('\n\n**********************Results**********************'))

50
Output:

51
52
Ralston’s Method
Algorithm:
1. Start
2. Function definition: dydt = (1+4x) y
3. Variable declaration (dydt, t,y).
4. State initial conditions
t0= 0
y0= 1
tf = 1
h= 0.25
5. Start loop. Check if i<n
n= 4
If yes, continue to 6
If no proceed to 9
6. Calculate the values of k1, and k2 using the initial values given.
k1  f (ti , yi )

 3 3 
k 2  f  ti  h, yi  k1h 
 4 4 
7. Calculate the value of y using the values of k1, and k2 calculated.
1 2 
yi 1  yi   k1  k2 h
3 3 
8. Add a step: i+1
9. Return to 5
10. Display the results.
11. Plot (t,y).
12. End.

53
Flowchart
Start

F(t, y)
dydt = (1+4x) y

t0=0,y0=1

steps size, h=0.25

i+1
i< n
Plot(t,y) print(t,y)
No n=4

Yes
END k1  f (ti , yi )

 3 3 
k 2  f  ti  h, yi  k1h 
 4 4 

1 2 
yi 1  yi   k1  k2 h
3 3 

ti 1  ti  h

54
Problem Code for the solution of ODE using Ralston method:

% ralston method

% Solve dy/dt = f(t,y)%

function dydt=f(t,y)
dydt='(1+4*t)*sqrt(y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time

t0=0 ;

% y0, corresponding value of y at t0

y0=1;

% tf, upper boundary of time t (end time).

tf=1;
% n, number of steps to take

n=4;
% Displays title information
disp(sprintf('\n\nthe Ralston method of solving differential
equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))

55
disp(sprintf('-------------------------------------------------------
'))

% Adding Step Size


ta(i+1)=ta(i)+h ;
% Calculating k1, and k2
k1 = f(ta(i),ya(i)) ;
k2 = f(ta(i)+0.75*h,ya(i)+0.75*k1*h ) ;

% Using ralston formula


ya(i+1)=ya(i)+((1/3)*k1+(2/3)*k2)*h ;

disp('1) Find k1 and k2 using the previous step information.')


disp(sprintf(' k1 = f( t%g , y%g )',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i),ya(i)))
disp(sprintf(' = %g\n',k1))
disp(sprintf(' k2 = f( t%g + 0.75*h , y%g + 0.75*ki*h )',i-1,i-1))
disp(sprintf(' = f( %g + 0.75 * %g , %g + 0.75 * %g *
%g)',ta(i),h,ya(i),k1,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.75*h,ya(i)+0.75*k1*h))
disp(sprintf(' = %g\n',k2))

disp(sprintf('2) Apply the ralston formula to estimate y%g',i))


disp(sprintf(' y%g = y%g + k2*h',i,i-1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),((1/3)*k1+(2/3)*k2),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))
end
plot(ta,ya);
xlabel('time')
ylabel('y')
title('ralston method result')

disp(sprintf('\n\n*********************Results***********************'))

56
Output:

57
58
4th Order Runge-Kutta Method
Algorithm:
1. Start
2. Function definition: dydt = (1+4x) y
3. Variable declaration (dydt, t,y).
4. State initial conditions
t0= 0
y0= 1
tf = 1
h= 0.25
5. Start loop. Check if i<n
n= 4
If yes, continue to 6
If no proceed to 9
6. Calculate the values of k1, k2,k3 and k4 using the initial values given.
k1  f (ti , yi )
1 1
k2  f (ti  h, yi  hk1 )
2 2
1 1
k3  f (ti  h, yi  hk2 )
2 2
k4  f (ti  h, yi  hk3 )
7. Calculate the value of y using the values of k1, k2, k3, and k4 calculated.
h
y i 1  y i  ( k1  2 k 2  2 k 3  k 4 )
6
8. Add a step: i+1
9. Return to 5
10. Display the results.
11. Plot (t,y).
12. End.

59
Flowchart
Start

F(t, y)
dydt = (1+4x) y

t0=0, y0= 1

steps size, h= 0.25

i< n i+1
Plot(t,y) print(t,y)
No n=4

Yes
END

k1  f (ti , yi )
1 1
k2  f (ti  h, yi  hk1 )
2 2
1 1
k3  f (ti  h, yi  hk2 )
2 2
k4  f (ti  h, yi  hk3 )

h
y i 1  y i  ( k1  2 k 2  2 k 3  k 4 )
6

ti 1  ti  h

60
Problem Code for the solution of ODE using 4th- Order Runge-Kutta Method:

% RK4 method

% Solve dy/dt = f(t,y)%


function dydt=f(t,y)
dydt='(1+4*t)*sqrt(y)' ;
f=inline(dydt,'t','y') ;

% t0, initial time

t0=0 ;
% y0, value of y at t0

y0=1;
% tf, upper boundary of time t

tf=1;
% n, number of steps to take

n=4;
% Displays title information
disp(sprintf('\n\nThe 4th Order Runge-Kutta Method of Solving Ordinary
Differential Equations'))
h=(tf-t0)/n ;
disp(sprintf(' h = ( tf - t0 ) / n '))
disp(sprintf(' = ( %g - %g ) / %g ',tf,t0,n))
disp(sprintf(' = %g',h))

ta(1)=t0 ;
ya(1)=y0 ;

for i=1:n
disp(sprintf('\nStep %g',i))
disp(sprintf('------------------------------------------------------
'))

61
% Adding Step Size
ta(i+1)=ta(i)+h ;
% Calculating k1, k2, k3, and k4
k1 = f(ta(i),ya(i)) ;
k2 = f(ta(i)+0.5*h,ya(i)+0.5*k1*h) ;
k3 = f(ta(i)+0.5*h,ya(i)+0.5*k2*h) ;
k4 = f(ta(i)+h,ya(i)+k3*h) ;

% Using 4th Order Runge-Kutta formula


ya(i+1)=ya(i)+1/6*(k1+2*k2+2*k3+k4)*h ;
disp('1) Find k1,k2,k3 and k4 using the previous step information.')
disp(sprintf(' k1 = f( t%g , y%g )',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i),ya(i)))
disp(sprintf(' = %g\n',k1))
disp(sprintf(' k2 = f( t%g + 0.5 * h , y%g + 0.5 * k1 * h )',i-
1,i-1))
disp(sprintf(' = f( %g + 0.5 * %g , %g + 0.5 * %g *
%g)',ta(i),h,ya(i),k1,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.5*h,ya(i)+0.5*k1*h))
disp(sprintf(' = %g\n',k2))

disp(sprintf(' k3 = f( t%g + 0.5 * h , y%g + 0.5 * k2 * h )',i-


1,i-1))
disp(sprintf(' = f( %g + 0.5 * %g , %g + 0.5 * %g *
%g)',ta(i),h,ya(i),k2,h))
disp(sprintf(' = f( %g , %g )',ta(i)+0.5*h,ya(i)+0.5*k2*h))
disp(sprintf(' = %g\n',k3))
disp(sprintf(' k4 = f( t%g + h, y%g + k3*h)',i-1,i-1))
disp(sprintf(' = f( %g , %g )',ta(i)+h,ya(i)+k3*h))
disp(sprintf(' = %g\n',k1))

disp(sprintf('2) Apply the Runge-Kutta 4th Order method to estimate


y%g',i))
disp(sprintf(' y%g = y%g + 1/6*( k1 + 2*k2 + 2*k3 +k4) * h',i,i-
1))
disp(sprintf(' = %g + %g * %g *
%g',ya(i),1/6,(k1+2*k2+2*k3+k4),h))
disp(sprintf(' = %g\n',ya(i+1)))
disp(sprintf(' at t%g = %g',i,ta(i+1)))

62
end
plot(ta,ya);
sxlabel('time')
ylabel('y')
title('rk4 method result')

disp(sprintf('\n\n***********************Results*********************'))

Output:

63
64
65
V. Generalization
Table of values of y obtained using different methods:

t Y(analytical Y(Euler’s Y(Heun’s Y(Ralston Y(4th order


method) method) method) method) RK method)
0 1 1 1 1 1
0.25 1.410156 1.25 1.20225 1.40117 1.41009
0.50 2.25 1.809 1.587 2.22102 2.24979
0.75 3.7539 2.82 2.22 3.68678 3.75341
1 6.25 4.5 3.2 6.11935 6.24905

Plot of the values of y obtained using different methods against t


7

0
0 0.2 0.4 0.6 0.8 1 1.2

Analytical method Euler's Heun's Ralston 4th Order RK

Exact solution and solutions obtained with different numerical approximation


methods, the Euler, Heun, 2nd –order Midpoint nad Ralston and 4th-order Runge-Kutta.
Euler’s method serves as a base for other methods. But, it is less used as compared to
4th order method even if it does yield the smoothest curve because the error involved in the
calculation is higher than higher order Runge-Kutta (RK2, RK3, RK4). Solutions for Runge-
Kutta methods are graphically near to the exact solution that indicates its higher accuracy
than Euler’s method.

66
If the exact solution to the differential equation is a polynomial or order n it will be
solved exactly by an n-th Runge-Kutta method. For example, forward Euler will be exact if
the solution is a line and RK4 will be exact if the solution is a polynomial of degree 2-4.

67
VI. References

Steve Chapra(2005), Applied Numerical Methods with MATLAB for Engineers and
Scientists, 3rd ed., McGraw-Hill, New York.

Erwin Kreyzig(2009), Advance Engineering Mathematics, 10th ed.,John Wiley and


Sons Inc.

Ahmad, R.R. and Yaacob, N. (2005) Third-order composite Runge–Kutta method for
stiff problems, International Journal of Computer Mathematics, 82(10)

Butcher, J.C. (1994) Initial value problems: numerical methods and mathematics,
Computers and Mathematics with Applications, 28(10-12)
Jaan Kiusalaas(2005), Numerical Methods in Engineering with MATLAB,
Cambridge University Press
Steven J. Chapman(2001), MATLAB Programming for Engineers, 2nd ed.
Kopal, Z. (1955) Numerical Analysis, John Wiley & Sons, New-York.

68

Вам также может понравиться