WEBVTT

00:00:05.580 --> 00:00:09.950
PROFESSOR: Here is the
classical Runge-Kutta method.

00:00:09.950 --> 00:00:14.510
This was, by far and away,
the world's most popular

00:00:14.510 --> 00:00:22.790
numerical method for over 100
years for hand computation

00:00:22.790 --> 00:00:26.240
in the first half
of the 20th century,

00:00:26.240 --> 00:00:29.030
and then for computation
on digital computers

00:00:29.030 --> 00:00:32.150
in the latter half
of the 20th century.

00:00:32.150 --> 00:00:38.300
I suspect it's
still in use today.

00:00:38.300 --> 00:00:42.240
You evaluate the function
four times per step,

00:00:42.240 --> 00:00:45.080
first in the beginning
of the interval.

00:00:45.080 --> 00:00:48.290
And then use that to step into
the middle of the interval,

00:00:48.290 --> 00:00:50.360
to get s2.

00:00:50.360 --> 00:00:54.990
Then you use s2 to step into the
middle of the interval again.

00:00:54.990 --> 00:00:59.720
And evaluate the function
there again to get s3.

00:00:59.720 --> 00:01:03.350
And then use s3 to step
clear across the interval,

00:01:03.350 --> 00:01:06.150
and get s4.

00:01:06.150 --> 00:01:13.880
And then take a combination
of those four slopes,

00:01:13.880 --> 00:01:17.480
weighting the two in
the middle more heavily,

00:01:17.480 --> 00:01:20.580
to take your final step.

00:01:20.580 --> 00:01:24.040
That's the classical
Runge-Kutta method.

00:01:28.560 --> 00:01:33.170
Here's our MATLAB
implementation.

00:01:33.170 --> 00:01:37.290
And we will call
it ODE4, because it

00:01:37.290 --> 00:01:42.270
evaluates to function
four times per step.

00:01:42.270 --> 00:01:47.120
Same arguments, vector y out.

00:01:47.120 --> 00:01:54.020
Now we have four slopes-- s1
at the beginning, s2 halfway

00:01:54.020 --> 00:01:57.630
in the middle, s3
again in the middle,

00:01:57.630 --> 00:02:01.600
and then s4 at the right hand.

00:02:01.600 --> 00:02:09.500
1/6 of s1, 1/3 of s2,
1/3 of s3, and 1/6 of s4

00:02:09.500 --> 00:02:12.480
give you your final step.

00:02:12.480 --> 00:02:15.595
That's the classical
Runge-Kutta method.

00:02:20.660 --> 00:02:25.740
Carl Runge was a fairly
prominent German mathematician

00:02:25.740 --> 00:02:30.290
and physicist, who
published this method,

00:02:30.290 --> 00:02:35.200
along with several
others, in 1895.

00:02:35.200 --> 00:02:39.530
He produced a number of
other mathematical papers

00:02:39.530 --> 00:02:42.150
and was fairly well known.

00:02:42.150 --> 00:02:47.690
Martin Kutta discovered
this method independently

00:02:47.690 --> 00:02:52.140
and published it in 1901.

00:02:52.140 --> 00:02:59.690
He is not so nearly well
known for anything else.

00:02:59.690 --> 00:03:03.530
I'd like to pursue a
simple model of combustion.

00:03:03.530 --> 00:03:09.700
Because the model has some
important numerical properties.

00:03:09.700 --> 00:03:13.040
If you light a match,
the ball of flame

00:03:13.040 --> 00:03:17.090
grows rapidly until it
reaches a critical size.

00:03:17.090 --> 00:03:20.240
Then the remains at that size,
because the amount of oxygen

00:03:20.240 --> 00:03:24.380
being consumed by the combustion
in the interior of the ball

00:03:24.380 --> 00:03:27.210
balances the amount available
through the surface.

00:03:31.120 --> 00:03:34.760
Here's the dimensionless model.

00:03:34.760 --> 00:03:40.440
The match is a sphere,
and y is its radius.

00:03:40.440 --> 00:03:45.660
The y cubed term is the
volume of the sphere.

00:03:45.660 --> 00:03:50.540
And the y cubed accounts for
the combustion in the interior.

00:03:53.370 --> 00:03:57.000
The surface of the sphere
is proportional y squared.

00:03:57.000 --> 00:04:00.340
And the y squared term
accounts for the oxygen that's

00:04:00.340 --> 00:04:03.160
available through the surface.

00:04:03.160 --> 00:04:05.700
The critical parameter,
the important parameter,

00:04:05.700 --> 00:04:11.410
is the initial
radius, y0, y naught.

00:04:11.410 --> 00:04:15.480
The radius starts
at y0 and grows

00:04:15.480 --> 00:04:19.690
until the y cubed
and y squared terms

00:04:19.690 --> 00:04:24.980
balance each other, at which
point the rate of growth is 0.

00:04:24.980 --> 00:04:27.710
And the radius
doesn't grow anymore.

00:04:27.710 --> 00:04:29.900
We integrate over a long time.

00:04:29.900 --> 00:04:34.260
We integrate over a time
that's inversely proportional

00:04:34.260 --> 00:04:36.620
to the initial radius.

00:04:36.620 --> 00:04:37.385
That's the model.

00:04:41.340 --> 00:04:43.620
Here's an animation.

00:04:43.620 --> 00:04:46.880
We're starting with
a small flame here,

00:04:46.880 --> 00:04:49.422
a small spherical flame.

00:04:49.422 --> 00:04:53.020
You'll just see a
small radius there.

00:04:53.020 --> 00:04:57.300
The time and the radius are
shown at the top of the figure.

00:04:57.300 --> 00:04:59.990
It's beginning to grow.

00:04:59.990 --> 00:05:04.240
When time gets to 50,
we're halfway through.

00:05:04.240 --> 00:05:07.890
The flame sort of
explodes, and then gets up

00:05:07.890 --> 00:05:14.620
the radius 1, at which time the
two terms balance each other.

00:05:14.620 --> 00:05:18.240
And the flame stops growing.

00:05:18.240 --> 00:05:20.170
It's still growing
slightly here,

00:05:20.170 --> 00:05:24.810
although you can't see
it on this this scale.

00:05:33.780 --> 00:05:37.750
Let's set this up
for Runge-Kutta.

00:05:37.750 --> 00:05:41.550
The differential
equation is y prime is y

00:05:41.550 --> 00:05:44.740
squared minus y cubed.

00:05:44.740 --> 00:05:52.470
Starting at zero, with the
critical initial radius,

00:05:52.470 --> 00:05:56.930
I'm going to take to be 0.01.

00:05:56.930 --> 00:06:00.380
That means we're going to
integrate out to two over y0

00:06:00.380 --> 00:06:04.910
out to time 200.

00:06:04.910 --> 00:06:10.260
I'm going to choose the
step size to take 500 steps.

00:06:10.260 --> 00:06:12.896
I'm just going to pick
that somewhat arbitrarily.

00:06:16.650 --> 00:06:19.490
OK, now I'm ready to use ODE4.

00:06:19.490 --> 00:06:21.060
And I'll store the results in y.

00:06:23.790 --> 00:06:27.720
And it goes up to 1.

00:06:27.720 --> 00:06:29.100
I'm going to plot the results.

00:06:29.100 --> 00:06:32.600
So here's the
values of t I need.

00:06:32.600 --> 00:06:33.715
And here's the plot.

00:06:38.870 --> 00:06:43.360
Now, you can see the
flame starts to grow.

00:06:43.360 --> 00:06:44.950
It grows rather slowly.

00:06:44.950 --> 00:06:47.970
And then halfway through
the time interval,

00:06:47.970 --> 00:06:51.020
it's sort of explodes
and goes up quickly,

00:06:51.020 --> 00:06:55.670
until it reaches a radius
of 1, and then stays here.

00:06:55.670 --> 00:06:59.620
Now this transition
period is fairly narrow.

00:06:59.620 --> 00:07:05.020
And we're going to continue
to study this problem.

00:07:05.020 --> 00:07:08.690
And is this
transition area which

00:07:08.690 --> 00:07:15.490
is going to provide a challenge
for the numerical methods.

00:07:15.490 --> 00:07:17.740
Now here, we just
went through it.

00:07:17.740 --> 00:07:21.620
We had a step size h, that
we picked pretty arbitrarily.

00:07:21.620 --> 00:07:24.540
And we just generated
these values.

00:07:24.540 --> 00:07:30.623
We have really little idea how
accurate these numbers are.

00:07:30.623 --> 00:07:32.350
They look OK.

00:07:32.350 --> 00:07:35.540
But how accurate are they?

00:07:35.540 --> 00:07:40.010
This is the critical
question about the

00:07:40.010 --> 00:07:43.870
about the classical
Runge-Kutta method.

00:07:43.870 --> 00:07:47.875
How reliable are the values
we have here in our graph?

00:07:54.750 --> 00:07:58.820
I have four exercises
for your consideration.

00:07:58.820 --> 00:08:03.100
If the differential
equation does not involve y,

00:08:03.100 --> 00:08:06.520
then this solution
is just an integral.

00:08:06.520 --> 00:08:09.920
And the Runge-Kutta method
becomes a classic method

00:08:09.920 --> 00:08:12.470
of numerical integration.

00:08:12.470 --> 00:08:14.790
If you've studied
such methods, then you

00:08:14.790 --> 00:08:17.045
should be able to
recognize this method.

00:08:22.140 --> 00:08:27.810
Number. two-- find the exact
solution of y prime equals 1

00:08:27.810 --> 00:08:31.660
plus y squared, with
y of 0 equals zero.

00:08:31.660 --> 00:08:36.510
And then see what happens with
ODE4, when you try and solve it

00:08:36.510 --> 00:08:39.539
on the interval
from t from 0 to 2.

00:08:44.030 --> 00:08:48.710
Number three- what happens
if the length of the interval

00:08:48.710 --> 00:08:52.440
is not exactly divisible
by the step size?

00:08:52.440 --> 00:08:58.880
For example, if t final is
pi, and the step size is 0.1.

00:08:58.880 --> 00:09:01.150
Don't try and fix this.

00:09:01.150 --> 00:09:03.950
It's just one of the hazards
of a fixed step size.

00:09:07.550 --> 00:09:13.140
And finally, exercise four--
investigate the flame problem

00:09:13.140 --> 00:09:19.250
with an initial
radius of 1/1,000.

00:09:19.250 --> 00:09:24.910
For what value of
t does the radius

00:09:24.910 --> 00:09:29.600
reach 90% of its final value?