0% found this document useful (0 votes)
114 views10 pages

Numerical Methods Final

This document discusses the numerical solution of ordinary differential equations using the Runge-Kutta method. It begins by introducing the Runge-Kutta method and defining the 4th order Runge-Kutta formula. It then applies the 4th order Runge-Kutta method to solve a sample 1st order differential equation to find the distance over time. The document concludes by stating that the Runge-Kutta method provides an accurate numerical solution for solving traffic flow problems modeled as differential equations.

Uploaded by

Sai Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views10 pages

Numerical Methods Final

This document discusses the numerical solution of ordinary differential equations using the Runge-Kutta method. It begins by introducing the Runge-Kutta method and defining the 4th order Runge-Kutta formula. It then applies the 4th order Runge-Kutta method to solve a sample 1st order differential equation to find the distance over time. The document concludes by stating that the Runge-Kutta method provides an accurate numerical solution for solving traffic flow problems modeled as differential equations.

Uploaded by

Sai Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

19M301 – NUMERICAL METHODS

CO 4: Numerical Solution to Ordinary


Differential Equations

21M137:
21M138:
21M140:
21M142:
21M143:
21M145:
21M146: S R Mohan
21M147: Saikrishna V
21M148: Sangamithra S
21M149: Sanjay Vaikunthan
21M150: Sanjay Raj S
21M151: Sarmathi P
RUNGE KUTTA METHOD:
Runge–Kutta method is an effective and
widely used method for solving the initial-value problems
of differential equations. Runge–Kutta method can be used to
construct high order accurate numerical method by functions' self
without needing the high order derivatives of functions.

What is Fourth Order RK Method?


The most commonly used Runge Kutta method to find the solution of a
differential equation is the RK4 method, i.e., the fourth-order Runge-
Kutta method. The Runge-Kutta method provides the approximate
value of y for a given point x. Only the first-order ODEs can be solved
using the Runge Kutta RK4 method.

Runge-Kutta Fourth Order Method Formula


The formula for the fourth-order Runge-Kutta method is given by:
y1 = y0 + (⅙) (k1 + 2k2 + 2k3 + k4)
Here,
k1 = hf(x0, y0)
k2 = hf[x0 + (½)h, y0 + (½)k1]
k3 = hf[x0 + (½)h, y0 + (½)k2]
k4 = hf(x0 + h, y0 + k3)
PROBLEM

INTRODUCTION:
Traffic flow is the study of the movement of individual vehicles
between two points for a particular period and the interaction they
make with each other, with the aim of understanding and providing an
optimal solution. Here we consider a real-time traffic flow problem,
which is converted into a mathematical model to obtain an optimal
solution and it is used to verify the traffic density between two traffic
signals in the city.
The traffic flows are mainly based on the Partial Differential
Equations, but it is very complicated to solve and deduce the solution.
So to make this model more convenient we use numerical methods to
obtain the solution. Numerical differentiation is used for evaluation
because it addresses two issues, accuracy and time. Here we consider
the Runge –Kutta method as it reduces the time spent and gives
relatively more accurate and precise answers. To use this method we
convert PDE into ODE, as Runge–Kutta method is applicable only for
Ordinary Differential Equations. The IV ORDER Runge–Kutta
method (for first order ODE) is more accurate than first, second and
third orders Runge–Kutta method. The real world problem is
converted to a mathematical model and the solution to be obtained is
discussed below. The outcome of the model gives a numerical solution
to vehicular density and velocity of traffic flow between two
consecutive signals in real time situation.

CONSTRUCTION OF A TRAFFIC FLOW PROBLEM:


VARIABLES (or) PARAMETERS:
In this paper, we consider, only vehicular density (ρ) and velocity (v)
to be the relevant variables though there could be many other factors
affecting the system such as accidents, on/off ramps, length of
roadway, the spacing between cars, etc. Thus ignoring the other
factors, let F(ρ,v) represent the Traffic Flow, in which we define
ρ(x,t) as the vehicular density, in particular for car-density and v(x,t)
as the velocity at a point x and time t. The mathematical model for
the above data will be a Partial Differential Equation (PDE). Hence
the obtained PDE will be converted into a pair of Ordinary
Differential Equations (ODE) and solved further

NUMERICAL SOLUTION:
IV ORDER Runge-Kutta Method:
For a given Ordinary Differential Equation, the IV ORDER R.K
method is given by,
k1 = hf (x,y)
k2 = hf (𝒙+𝒉/𝟐 ,y+𝒌1/𝟐)
k3 = hf (𝒙+𝒉/𝟐 ,𝒚+𝒌𝟐/𝟐)
k4 = hf (x+h , y+k3)
and K = 𝟏/𝟔(k1+2k2+2k3+k4) and y(x+h) = y(x) + Δ where, h = Δx

ILLUSTRATION:
Consider an ODE of first order for one parameter, say v(t,x).
Let the differential equation be, x’= t2+x with initial condition,
x(0)=1. Assume h=0.1. Now let us find the value of x(1.0).
From the given, x(0) = 1 è t0=0 ; x0 =1 and h=0.1
By IV ORDER Runge-Kutta method,
K1 = hv (t0 , x0) = 0.1
K2 = hv (𝑡0+ℎ/2 ,𝑥0+𝐾1/2) = 0.1053
K3 = hv (𝑡0+ℎ/2 , 𝑥0+𝐾2/2) = 0.1055
K4 = hv (t0 + h , x0 + K3) = 0.1116
Δx = 1/6(K1+2K2+2K3+K4) = 0.1055 and
x1 = x(0.1) = x0 + Δx = 1.1055
Now, we can find x(0.2) with initial values x1 = 1.1055 and t1 = 0.1
K1 = hv (t1 , x1) = 0.1116
K2 = hv (𝑡1+ℎ/2 ,𝑥1+𝐾1/2) = 0.1184
K3 = hv (𝑡1+ℎ/2 , 𝑥1+𝐾2/2) = 0.1187
K4 = hv (t1 + h , x1 + K3) = 0.1264
Δx = 1/6(K1+2K2+2K3+K4) = 0.1187
x2 = x(0.2) = x1 + Δx = 1.2242
And continuing the process until the time we need to calculate,
For x (1.0) with initial values x9 = 2.7689 and t9 = 0.9
K1 = hv (t9 , x9) = 0.3579
K2 = hv (𝑡9+ℎ/2 ,𝑥9+𝐾1/2) = 0.3850
K3 = hv (𝑡9+ℎ/2 , 𝑥9+𝐾2/2) = 0.3864
K4 = hv (t9 + h , x9 + K3) = 0.4155
Δx = 1/6(K1+2K2+2K3+K4) = 0.3861 and
x10 = x(1.0) = x9 + Δx 3.1550
The value of x10 represents, at t = 1.0 second, the distance covered is
x = 3.1550 meters.
Therefore the velocity of traffic flow will be, V =3.155 m/s.
A similar process can be followed to find the vehicular density,
assuming N to be the Number of vehicles with a distance between the
signals as 1000 meters (i.e, 1 km) for a particular period of time.
Consider the same problem, to find the solution using Euler’s method.
x(0.1) = x1 = x0 + hv (t0 , x0) = 1.1000
x(0.2) = x2 = x1 + hv (t1 , x1) = 1.2110
……
x(1.0) = x10 = x9 + hv (t9 , x9) = 2.9406

CONCLUSION:
Traffic flow is the study of movement between two vehicles and the
complications in those flow is identified and it is converted into a
mathematical model to obtain the mathematical solution. Most of the
traffic flow problems that use partial differential equations to deduce
the solution but it is complicated to solve the equations and so we use
Numerical methods to solve the problem where PDE is converted into
ODE and then numerical integration is used as it reduces the time
consumption. We use IV ORDER Runge –Kutta method (for first
order ODE) which is more accurate and reliable. We have also
provided a comparative study between the reliability of the RK
method and Euler's method. The procedure looks simple, but more
complicated situations arise when boundary conditions are introduced.
The above traffic flow analysis gives the traffic density between two
traffic signals in the city and it is applied to verify the density and
gives the appropriate time to pass the signal and can be used to find
the shortest route to reach the destination. This method can also be
converted into program code and the solution is obtained within a
short period. Thus Runge –Kutta method is the best alternative method
to solve the Traffic Flow Analysis for a city to obtain an accurate
solution.
COMPUTATIONAL PROCEDURE FOR RUNGE
KUTTA METHOD USING C PROGRAMMING
#include<stdio.h>
#include<math.h>
float f(float x,float y);
int main()
{
float x0,y0,m1,m2,m3,m4,m,y,x,h,xn;
printf("Enter x0,y0,xn,h:");
scanf("%f %f %f %f",&x0,&y0,&xn,&h);
x=x0;
y=y0; printf("\n\nX\t\
tY\n"); while(x<xn)
{ m1=f(x0,y0); m2=f((x0+h/2.0),
(y0+m1*h/2.0));
m3=f((x0+h/2.0),(y0+m2*h/2.0));
m4=f((x0+h),(y0+m3*h));
m=((m1+2*m2+2*m3+m4)/6);
y=y+m*h;
x=x+h; printf("%f\t%f\
n",x,y);
}
}
float f(float x,float y)
{
float m;
m=(x-y)/(x+y);
return m;
}

You might also like