Tip:
Highlight text to annotate it
X
.
.
In this segment what we are going to do is we are going to take a higher order differential equation and
we are going to solve by it by using Heun's Method which is a Runge Kutta
second order method, one of the three popular Runge Kutta second order
methods. We are going to take a second order differential equation and we are going to see that, what we
get here. So we have 2(d2y/dx2) + 3(dy/dx) + 5y = 11e^-x
2(d2y/dx2) + 3(dy/dx) + 5y = 11e^-x
2(d2y/dx2) + 3(dy/dx) + 5y = 11e^-x
2(d2y/dx2) + 3(dy/dx) + 5y = 11e^-x So that's the second order
differential equation which is given to us which somebody asked us to solve. And they have given us the
initial conditions that y(0)=7 and
dy/dx(0)=13.
As we know that, all the Runge Kutta second order methods, fourth order methods, Euler's Method,
the things which we have talked about for solving intial value, boundary value, initial value
ordinary differential equations, we find out that we are only able to solve
first order ordinary differential equations by those methods so we have to reduce the
higher order differential equation or the coupled ordinary differential equation to a set of first order
differential equations. And the way we are going to do this, this is
second derivative here. The way we are going to do it is by assuming
dy/dx=z. We are going to let dy/dx=z
What that will do is it will reduce this to first order differential equations. So that will be
our first equation, dy/dx=z. And then when we substitute
dy/dx=z in here I get 2(dz/dx) + 3z + 5y = 11e^-x
2(dz/dx) + 3z + 5y = 11e^-x
and then I can rewrite this so that I can
write it in the form which I need for my numerical methods for
Heun's Method. dz/dx = (11e^(-x) - 3z - 5y)/2
That's what I will get there and that becomes the second
differential equation which I need to solve. So you have a coupled first order differential
equation now which you can now solve by using any of the methods we have learned for solving initial
value problems, initial value ordinary differential equation problems. So
in this I need an initial condition corresponding to that and that'll be
y(0)=7, that what I get from here. And the initial condition
here will be z(0)=13 because I need the initial condition of z. z is
nothing but dy/dx, so dy/dx(0)=13 so I get
z(0)=13 there. So that's my second differential equation.
Now this is my function f1, which I will call, of x, y, and z
and this will be my function f2 of x, y, and z
which I will need for setting up my Heun's Method there. So you
have this as your first differential equation, this as your second differential equation
where f1 is nothing but z and f2 is nothing but this function which you have there,
which we have calculated. So now what I need to do is, I need to use, I am going to use
Heun's Method, that's what I am proclaiming, that I am going to use Heun's method to be able to find out
what the values of y are, so the problem
statement, I didn't write down the complete problem statement here. And the problem statement is hey, go ahead and find
out what y(0.5) is when h=0.25.
So you are given that the step size is 0.25 and you want to find out what the value of
y at 0.5 is. So that means that you have to take two steps because you start from 0.
0 to 0.25 will be one step and 0.25 to
0.5 will be the next step. So what are the equations now
for the Heun's Method? They will be as follows, that you have
y_i+1=y_i + [(1/2)ky_1 + (1/2)ky_2)]*h
y_i+1=y_i + [(1/2)ky_1 + (1/2)ky_2)]*h
Now, keep in mind that unlike when we are solving just single first order differential equation,
we have to differentiate between the values of k1 and k2, between y and z.
So that's why you have a superscript y here and a superscript y here because that corresponds to the slopes
which are calculated for y and then you have
z_i+1=z_i + [(1/2)kz_1 + (1/2)kz_2)]*h
z_i+1=z_i + [(1/2)kz_1 + (1/2)kz_2)]*h
z_i+1=z_i + [(1/2)kz_1 + (1/2)kz_2)]*h
z_i+1=z_i + [(1/2)kz_1 + (1/2)kz_2)]*h. So you do need to understand that here you have the slope
on the z values which you are supposed to substitute here. So these are
different. These k1 and k2 are based on the value of f1 and this
k1 and k2 here, which are z here, are based on the value of f2.
Now, so what is ky_1? ky_1 is nothing but the value of the function
f1(xi, yi, zi),
the independent variable and the two dependent variables, one of which was introduced by us and
kz_1 will be equal to f1(),
no, f2(). So let's write ky_2 here first.
ky_2 will be equal to f1(xi+h, yi+(ky_1)*h, zi+(kz_1)*h),
f1(xi+h, yi+(ky_1)*h, zi+(kz_1)*h),
f1(xi+h, yi+(ky_1)*h, zi+(kz_1)*h),
f1(xi+h, yi+(ky_1)*h, zi+(kz_1)*h), so you have to see
that you need the value of ky_1, the slope of y corresponding to
k1 to calculate the next value of y here for this argument here and to calculate the corresponding
value of z which you need you need kz_1 there,
so it is very important to make a demarcation, a distinction between the two so that you do
it right. So same thing here, which you have kz_1 will be
corresponding to function f2(xi, yi, zi) being calculated at this argument,
while kz_2 which is the slope calculated at the point
ahead. That's the point where we want to go. Again the arguments would be the same as which you are
here, which is f2(xi+h, yi+(ky_1)*h, zi+(kz_1)*h)
f2(xi+h, yi+(ky_1)*h, zi+(kz_1)*h).
Although I wrote them like this, you've got to understand that you have to calculate ky_1
first, so this is what you are to calculate first. Then you have to calculate
kz_1. The reason why that is so is because you need ky_1 and kz_1
to calculate the arguments which are right here in the ky_2 value. So then calculate
this (c) and this as (d). So it is very important to understand what the sequence is. So many
times when you do this problem people do it, write a table out so that they know what the sequence is.
I'm not going to use a table because it would be too lengthy to show on the screen.
So I am going to just do it step by step to show you how the
value of y would be calculated.
.