.
In this segment we are going to continue
the same problem. We have x1 which we just calculated, x1 is
0.25, y1 we calculated to be 9.2656
and z1 we calculated to be
5.4339.
So what we want to be do is, we wanted to be able to y2 so we have to take the
next step, so let's go ahead and do that. So we have to choose now i equal
to 1 and the way we are going to do it is we are going to calculate ky_1 first,
then we are going to calculate kz_1, then we are going to calculate ky_2,
then kz_2, then we are going to calculate our y2
and then we are going to calculate our z2. Although we don't need to calculate z2 for this
case because y2 is the answer we are looking for, but for the sake of completion I'm going to go all the way up to the
value of z2 to do so. So, let's go and see
that, how we are going to calculate these values so, ky_1
is nothing but the value of the function f1 at
x1, y1, z1. So f1,
so what are the arguments, x1 we just calculated, 0.25,
y1 is 9.2656, and z1 is 5.4339
and since f1 is nothing but the value of z itself
which will be 5.4339, so I don't need to go too
far with that. Now, in order to calculate kz_1, kz_1
the arguments, and this is for function f2, but the
arguments are the same, arguments are the same as this one, so just
0.25, 9.2656, 5.4339,
so it's very important to realize that when you are calculating kz_1, the only
thing that is going to change for the corresponding value of kz_1 is what function
you are using. The arguments stay the same, so f2 is, what
is f2, f2 is 11e^-x, which is 0.25,
minus 3 times z, which is 5.4339,
minus 5 times y, which is 9.2656
and divided by 2. And this value here [[11e^(-0.25) - 3(5.4339) - 5(9.2656)]/2] now turns out to be
equal to -27.031.
That's what I get for kz_1, so I need to,
so I was showing you here I just calculated ky_1, kz_1,
now i'm going to calculate my ky_2 and kz_2. The difference between k1 and
k2 is that k2 values are calculated at a different argument of x, y, and z, at the
point ahead and that's what I need to do. So, let's go and calculate
ky_2. ky_2 is the value of the function
f1 at xi+h,
in this i is 1 so I need to substitute that.
x1+h, y1+(ky_1)*h,
y1+(ky_1)*h,
z1+(kz_1)*h
f1, x1 is 0.25
plus 0.25, y1
is 9.2656 plus ky_1
which is 5.4339 times
0.25 which is the value of h, comma, then this value of z1
which is 5.4339
plus kz_1 we just calculated to be -27.031,
times h which is 0.25
and that gives me the arguments of f1 turn out to be
0.5, and then 10.624,
and then -1.324. So you do need to understand the
significance of these arguments. This is now the value of x at the point
where I want to be. This is an approximate value of y
at that particular point because I need the value of y and this is the approximate value
of the z at x equal to 0.5 because I need all these 3 values to be able to calculate what f1
is. Now f1 is nothing but the value of z which is
-1.324. The value of kz_2 which
is the, which is the, again
is the value of f2 but the arguments are the same so I am not going to go through the whole
process because I know the arguments are the same. 10.624,
-1.324, and f2 is nothing but
11e^-x, which is 0.5, minus 3
times z, which is -1.324, minus 5 times
y, which is 10.624
divided by,
divided by 2 and this value here [(11e^(-0.5) -3(-1.324) - 5(10.624))/2] turns out to be
equal to -21.238. So
what we do have is all the values of k1's and k2's which we need to be able to
calculate what our y2 is and z2 is. So let's go ahead and do that,
we have y2 is nothing but y1 plus 1/2 the
value of ky_1 plus 1/2 ky_2
times h. y1 we just calculated,
calculated in the pervious step to be 9.6256,
ky_1 we just calculated to be 5.4339,
k2 we just calculated to
be -1.324
times h which is 0.25 and this gives me the value of y to be
9.7794 and that's
the approximate value of y at x equal to 0.5 and that's
the number which we are looking for so that's the answer. So y(0.5) is
approximately equal to 9.7794 because this is
the value of y2 and y2 is nothing but the value of y at x2. x2 is nothing but,
x1 was 0.25, so x2 becomes
0.25 plus 0.25 and I get 0.5. Now, as I said that, I'm going to show you
the calculations for z2 also, although, we don't need it because this is what
the answer we're looking for. Just for the sake of completion I've got z2 is equal to z1
plus 1/2 kz_1 plus 1/2
kz_2 times h. So z1 we just
calculated, was given to us at the end of the first step, which is 5.4339
plus 1/2 kz_1, which is
-27.031 and
kz_2, which is again 1/2 kz_2,
-21.238, times h, which is
0.25 and this value here [5.4339 + ((1/2)(-27.031) + (1/2)(-21.238))*0.25] turns out to be
-0.59986 and thats the
approximate value of z at 0.5, or dy/dx at 0.5.
Now, we did conduct an analysis
with different step sizes to see that, how well
by reducing the step size that we get a better answer.
Do we get a better answer? and How fast does it converge? So let me
go and show you what values that I obtain by changing the step size. So,
y at 0.5 exactly found out to be
9.9046, so that's something which you can do as
homework by using your ordinary differential equation course knowledge
by using Laplace Transforms or a classic solution techniques.
But what I did was in excel spread sheet I said hey, let me go ahead and calculate the value of
y at 0.5 by using different step sizes. So when I use 0.25 which is
the current problem whuch I just showed you, this is the answer which I got.
Now when I do half the step size, that means that I have to take four steps now,
I get 9.8703, so that could be your homework.
Now when I do 0.0625,
I get 9.8957 and
when I do 0.03125, I get
9.9024 and of course the exact value is
9.9046, so you can calculate what the relative true error in that
case is. And that's the end of this segment.
.