1
00:00:09,510 --> 00:00:14,840
So, todayís class what we will do is; we
look at a one sided; we look at a one sided
2
00:00:14,840 --> 00:00:22,230
derivative for the first derivative representation,
right and then we look at again, we will go
3
00:00:22,230 --> 00:00:26,690
back look at the second derivative and if
we have time, we will go on to applying it
4
00:00:26,690 --> 00:00:31,360
to a set of simple problems because by the
time we are finished here, we will know how
5
00:00:31,360 --> 00:00:33,580
to represent functions, we know how to represent
derivatives.
6
00:00:33,580 --> 00:00:38,580
So, we might as well try out a few simple
problems to see if we are able to solve differential
7
00:00:38,580 --> 00:00:47,269
equations that are of interest to us, okay
fine, is that okay right. So, if you want
8
00:00:47,269 --> 00:01:03,190
second order meaning, truncation error is
a second order, first derivative, is that
9
00:01:03,190 --> 00:01:11,700
what we want, right. The last class as I said
I have already done a higher order, let us
10
00:01:11,700 --> 00:01:26,760
look at for a; look for the second order,
so if I have the points i, i + 1, i + 2, these
11
00:01:26,760 --> 00:01:34,650
are located at xi, xi + 1, xi + 2.
12
00:01:34,650 --> 00:01:44,740
The function values there are fi, fi + 1,
fi + 2 and right now, first what we will do
13
00:01:44,740 --> 00:01:52,420
is; we will assume that h is like it is in
fact equals xi + 1 - xi which equals xi - xi
14
00:01:52,420 --> 00:01:57,260
-1, you will assume that they are equivalent
rules right now okay, later we will do unequal
15
00:01:57,260 --> 00:02:07,280
intervals because an unequal intervals are
of interest to us though except here, you
16
00:02:07,280 --> 00:02:10,500
will see it here in this class and then you
will never see me use unequal intervals again.
17
00:02:10,500 --> 00:02:14,810
So, this class is important in that sense
and unequal intervals are important but for
18
00:02:14,810 --> 00:02:20,670
this course, I am not going to do unequal
intervals outside this class, okay, is that
19
00:02:20,670 --> 00:02:27,920
fine, okay. So, it is a simple game now, so
now we are going to do it right clean from
20
00:02:27,920 --> 00:02:32,670
the start, simple game now, you want to find
the derivative at i and I am going to use
21
00:02:32,670 --> 00:02:36,299
the points i + 1 and i + 2, you will use Taylor
series.
22
00:02:36,299 --> 00:02:47,459
So, f at i + 1 is f at i + h times f prime
at i, the prime indicates differentiation
23
00:02:47,459 --> 00:03:02,879
with respect to x + h squared/ 2 factorial
f double prime at i + h cube/ 3 factorial
24
00:03:02,879 --> 00:03:14,930
f triple prime at i + h to the 4th/ 4 factorial,
f 4th derivative at i and then so on, okay.
25
00:03:14,930 --> 00:03:31,269
In a similar fashion, fi + 2 is fi - h times
f prime at i; I am sorry, + 2h times f prime
26
00:03:31,269 --> 00:03:39,549
at i, you can see in my mind I have written
9 -1, it is okay, you have to be very careful,
27
00:03:39,549 --> 00:03:40,609
okay, fine.
28
00:03:40,609 --> 00:03:53,090
Plus 4h squared/ 2 factorial f double prime
at i + 8h cube/ 3 factorial f triple prime
29
00:03:53,090 --> 00:03:58,669
at i, the reason why I do not succumb to the
temptation to expand this out and cancel and
30
00:03:58,669 --> 00:04:03,099
so on is because I know I am going to combine
these 2 terms right, so I leave whatever is
31
00:04:03,099 --> 00:04:07,189
common between them I leave them as they are,
okay, there is a temptation when you are writing
32
00:04:07,189 --> 00:04:16,120
this to cancel terms and so on, do not do
it; +16h to the fourth/ 4 factorial, the fourth
33
00:04:16,120 --> 00:04:21,181
derivative and so on.
34
00:04:21,181 --> 00:04:27,195
So, we look at these 2, our objective is to
extract out the f prime at i, so what do I
35
00:04:27,195 --> 00:04:38,960
need to do? If I multiply the first equation
by 4, I will get a 4h squared here and then
36
00:04:38,960 --> 00:04:43,250
I will get a 4h squared here, so if I multiply
the first equation by 4 and subtract the second
37
00:04:43,250 --> 00:05:01,630
equation and knock out the h square term.
So, 4 fi + 1 - fi + 2 is 4 fi - fi which is
38
00:05:01,630 --> 00:05:15,070
3fi, 4h f prime, right - 2 that is +2h f prime
at i, this will cancel that is the whole point
39
00:05:15,070 --> 00:05:16,620
of multiplying by 4.
40
00:05:16,620 --> 00:05:29,870
And this gives me -4h h cubed/ 3 factorial,
the third derivative -12h cube/ 4 factorial,
41
00:05:29,870 --> 00:05:44,210
fourth derivative, did I make a mistake; h
power 4 and so on, okay, so it is very clear,
42
00:05:44,210 --> 00:05:48,470
it is very easy to make mistakes, you have
to be really careful when you are doing this,
43
00:05:48,470 --> 00:05:49,470
fine.
44
00:05:49,470 --> 00:05:56,000
So, let us solve for f prime at i, so if you
come here and you solve for f prime at i that
45
00:05:56,000 --> 00:06:26,530
derivative is 4fi + 1 - 3fi - fi + 2/ 2h,
what does that leave me, 2h square/ 3 factorial
46
00:06:26,530 --> 00:06:34,490
f double prime + higher order terms, f triple
prime + higher order terms, so if I throw
47
00:06:34,490 --> 00:06:39,780
this out, I say this is the representation
for the derivative, I throw this out, right,
48
00:06:39,780 --> 00:06:43,300
so this is the truncation error; truncation
error is of the order of h squared.
49
00:06:43,300 --> 00:06:51,640
So, it is 1/ 3h squared f triple prime at
i, is that fine, truncation error is of that
50
00:06:51,640 --> 00:07:00,691
order and again like I did last time, I make
a quick check add 4 ñ 3 - 1 that is 0. Why
51
00:07:00,691 --> 00:07:05,340
do I say that, you ask yourself the question,
why do I test even last time I test it by
52
00:07:05,340 --> 00:07:17,430
adding up all the coefficients to make sure
they added up to 0, why do I do that? Constant
53
00:07:17,430 --> 00:07:22,670
function it should work yes, constant function
it should work.
54
00:07:22,670 --> 00:07:28,310
Constant function should give me a; should
give me a 0, right, constant function should
55
00:07:28,310 --> 00:07:36,640
give me 0 and of course, in the limiting process,
the numerator is supposed to go to f at i
56
00:07:36,640 --> 00:07:39,460
if I actually take the limit, remember this
is a finite difference, if I go back to the
57
00:07:39,460 --> 00:07:44,150
infinite process which means I take the limit
h going to 0, right, the numerator is supposed
58
00:07:44,150 --> 00:07:47,990
to independently go to 0 and then denominator
goes independently to 0.
59
00:07:47,990 --> 00:07:53,510
It is a ratio that gives me the derivative,
you understand, right, so from a; how should
60
00:07:53,510 --> 00:07:57,980
I put it; from an operational point of view
yes, I have a derivative; I have a representation
61
00:07:57,980 --> 00:08:01,250
for the derivative and the constant function
should give me a 0 derivative, right that
62
00:08:01,250 --> 00:08:05,360
is one operational point. The other processes
of course, I have an infinite process for
63
00:08:05,360 --> 00:08:08,040
which I have replaced by a finite one.
64
00:08:08,040 --> 00:08:13,090
I stop, I do not divide by, I do not take
the limit h going to 0 but if I do both take
65
00:08:13,090 --> 00:08:17,780
h going to 0, this should go to the derivative,
it has to converge to the derivative right,
66
00:08:17,780 --> 00:08:22,260
we want it to converge to the derivative,
is that clear okay, so the summation; so that
67
00:08:22,260 --> 00:08:27,600
is one sanity check that you can always do
add, make sure that they all add up to 0,
68
00:08:27,600 --> 00:08:37,209
okay, this is fine. Now, what if they were
unequal intervals; what is they were unequal
69
00:08:37,209 --> 00:08:38,209
intervals?
70
00:08:38,209 --> 00:08:41,960
So, we have these weights, we have seen this
is very nice, we have the truncation error
71
00:08:41,960 --> 00:08:50,950
but what if the intervals are unequal intervals;
what if the intervals are unequal intervals
72
00:08:50,950 --> 00:08:58,070
and just for the fun of it; just for the fun
of it, we can do a; we can still do a comparison
73
00:08:58,070 --> 00:09:09,270
but just for the fun of it, we will do i,
iñ 1 and i -2, okay and in this case, this
74
00:09:09,270 --> 00:09:16,970
length happens to be h and to keep or algebra
simple, I will call this some alpha times
75
00:09:16,970 --> 00:09:18,950
h, is that fine.
76
00:09:18,950 --> 00:09:23,700
Just to keep our algebra simple and this kind
of a relationship you may actually get in
77
00:09:23,700 --> 00:09:28,990
future applications, so I leave this as alpha
times h and we will just quickly repeat this
78
00:09:28,990 --> 00:09:37,150
process, okay, we will just quickly repeat
this process, so what do we have? F at i ñ
79
00:09:37,150 --> 00:09:55,890
1, yes f at i - h times f prime at i + h squared/
2 factorial, second derivative right at i
80
00:09:55,890 --> 00:10:07,930
- h cubed/ 3 factorial f triple prime at i
+ h to the 4th/ 4 factorial, the fourth derivative
81
00:10:07,930 --> 00:10:16,570
at i and so on.
82
00:10:16,570 --> 00:10:41,160
F at i - 2 is f at i -; I am sorry; 1 + alpha
times h f prime at i + 1 + alpha squared;
83
00:10:41,160 --> 00:10:56,070
1 + alpha whole squared h squared/ 2 factorial
f at second derivative i, right, so it is
84
00:10:56,070 --> 00:11:11,230
very clear, it is not that bad plus so on,
right, 1 + alpha power 4, 4 factorial h to
85
00:11:11,230 --> 00:11:20,000
the 4th and that will be multiplying the fourth
derivative and you have all the other terms,
86
00:11:20,000 --> 00:11:33,279
what do I do now? So, if I multiply the first
equation by 1 + alpha squared, I should be
87
00:11:33,279 --> 00:11:38,070
able to cancel out the second derivative term,
okay.
88
00:11:38,070 --> 00:12:01,780
So, 1 + alpha squared fi ñ 1- ; I am going
to subtract out this term, fi - 2 equals,
89
00:12:01,780 --> 00:12:07,180
so you should be happy if alpha over 1+ alpha
squared is 2 squared which is 4, which is
90
00:12:07,180 --> 00:12:19,550
what we did earlier right, so that is not
bad, fi - 2 equals, you have 1 + alpha squared,
91
00:12:19,550 --> 00:12:49,860
so I keep doing that - 1 fi, what happens
to this term, so you get a 1 + alpha squared
92
00:12:49,860 --> 00:13:21,960
- 1 + alpha h f prime, then what else; minus
alpha, no by 2 that is the first derivative
93
00:13:21,960 --> 00:13:22,960
term.
94
00:13:22,960 --> 00:13:36,700
Then, what is the third term? Third term goes
away, so and then you get ñ 1 + alpha squared
95
00:13:36,700 --> 00:13:52,040
ñ 1 + alpha cubed h cube/ 3 factorial f triple
prime and I would not bother with the fourth
96
00:13:52,040 --> 00:13:55,810
term, right the fourth term something that
you can work out because normally, when I
97
00:13:55,810 --> 00:14:01,230
do it, when I am sitting alone I sort of simplify
this a little faster than this, right so but
98
00:14:01,230 --> 00:14:03,850
it is fine, we will let us see what we get
here.
99
00:14:03,850 --> 00:14:18,910
So, you have 1 + alpha squared fi - 1 - fi
- 2 equals, alpha * 2 + alpha, is that fine,
100
00:14:18,910 --> 00:14:34,850
in that alpha equals 1 that gives you 3, so
we are happy, it is working out, so it is
101
00:14:34,850 --> 00:14:47,250
fi, okay and what is the next term, I can
factor out 1 + alpha, so that gives me a -1
102
00:14:47,250 --> 00:15:04,780
+ alpha * alpha h f prime at i in the alpha
equals 1 that is 2, okay that also works,
103
00:15:04,780 --> 00:15:34,551
+ or -; -1 + alpha squared * 1 ñ 1 - alpha
h cubed/ 3 factorial f triple prime i and
104
00:15:34,551 --> 00:15:36,270
so on, okay.
105
00:15:36,270 --> 00:15:45,970
Actually, I made a mistake here, there is
a 3 factorial at that point, it is okay, is
106
00:15:45,970 --> 00:16:02,180
that okay, so what does it give me for a f
prime at i; 1 + alpha squared - alpha 2 +
107
00:16:02,180 --> 00:16:34,100
alpha fi, fi ñ 1, fi ñ fi ñ 2/ alpha * 1
+ alpha, do you have a sign problem? There
108
00:16:34,100 --> 00:16:46,720
should be a negative sign here okay, in this
what is the truncation error now; - alpha
109
00:16:46,720 --> 00:17:00,350
* 1 + alpha squared h squared/ 3 factorial
and I have to divide by alpha times 1 + alpha,
110
00:17:00,350 --> 00:17:11,060
so it gives you an 1 + alpha f triple prime
at i.
111
00:17:11,060 --> 00:17:24,480
It has to be a plus, no it is right, there
is a negative sign here, there is a negative
112
00:17:24,480 --> 00:17:31,830
sign here, there is a negative sign here,
there is a negative sign here and there is
113
00:17:31,830 --> 00:17:35,490
one more negative sign, it will turn out,
right. See, I have another way; I have another
114
00:17:35,490 --> 00:17:38,830
way by which I checked if you notice I glanced
at the other board, what was the truncation
115
00:17:38,830 --> 00:17:43,920
error for the 4 difference that was positive,
so this will be negative, right.
116
00:17:43,920 --> 00:17:52,670
There are some simple sanity checks that you
can do fine, okay, so and you can see if you
117
00:17:52,670 --> 00:17:59,230
set alpha equals 1, whether it works out,
so clearly if they are unequal; clearly if
118
00:17:59,230 --> 00:18:21,290
they are unequal, it is going to become very
messy yes, ìProfessor ñ student conversation
119
00:18:21,290 --> 00:18:40,790
startsî We use i but you would not able to
use i -1, I am not sure that I am understand
120
00:18:40,790 --> 00:18:44,610
the question. No, no you have; it is the same
thing, you have 3 points, they are unequal,
121
00:18:44,610 --> 00:18:46,520
there are equal distances.
122
00:18:46,520 --> 00:18:50,640
But I can still eliminate, I can still eliminate
the second derivative term and get an expression
123
00:18:50,640 --> 00:18:55,230
for the first derivative leaving a truncation
error which has only a third derivative, do
124
00:18:55,230 --> 00:19:02,130
you want to calculate the derivative at the
next point and that could be; it could be
125
00:19:02,130 --> 00:19:07,250
you know some beta h or something of that,
so that could be something else altogether,
126
00:19:07,250 --> 00:19:12,890
you would still have an unequal intervals,
you could still have an unequal intervals.
127
00:19:12,890 --> 00:19:20,990
No, no it need not always be alpha, there
is a process called geometric stretching,
128
00:19:20,990 --> 00:19:27,140
where it is always alpha, right it is a constant
that is a nice situation but if it is not;
129
00:19:27,140 --> 00:19:35,000
it need not always be the same, okay so the
point next to it could be a sum ratio, is
130
00:19:35,000 --> 00:19:38,600
that fine, right it need not be h/ alpha or
something of that sort, it need not be that
131
00:19:38,600 --> 00:19:47,380
way okay, right. So, the idea is that the
adjacent intervals are not of equal size,
132
00:19:47,380 --> 00:19:48,450
fine.
133
00:19:48,450 --> 00:19:53,910
So, and as you can see from the fact that
the expression is so messy, it is possible
134
00:19:53,910 --> 00:20:03,880
for us to calculate it but clearly from a;
thank you, clearly from a classroom point
135
00:20:03,880 --> 00:20:10,150
of view, right it does not add anything, I
just want you to have an awareness, I will
136
00:20:10,150 --> 00:20:14,680
do one more in this class with unequal intervals
as I said but it does not add anything to
137
00:20:14,680 --> 00:20:21,600
my class as such, right, so if you take uneven
intervals, which you very often will be forced
138
00:20:21,600 --> 00:20:26,980
for other reasons right to take uneven intervals
then you are forced to take uneven intervals,
139
00:20:26,980 --> 00:20:29,290
you will get messy expressions.
140
00:20:29,290 --> 00:20:34,220
And this error seems to be slightly large
I mean, if alphas depending on the value of
141
00:20:34,220 --> 00:20:39,010
alpha, the magnitude of this error term is
going to change, okay so you may; you should
142
00:20:39,010 --> 00:20:44,380
have a reason, so you will be changing these
h values because you have maybe possibly some
143
00:20:44,380 --> 00:20:48,380
knowledge and how the function is varying,
right and then that is reason why you are
144
00:20:48,380 --> 00:20:52,130
trying to compensate, if you know that the
triple prime is large, then you may be changing
145
00:20:52,130 --> 00:20:55,470
your alpha in order to compensate for that,
it is possible, okay.
146
00:20:55,470 --> 00:20:58,860
There are many reasons, you will see that
when you run into it at a later date in a
147
00:20:58,860 --> 00:21:03,520
more advanced course, you will see why you
change take unequal intervals, in this class
148
00:21:03,520 --> 00:21:09,240
as I said I will do it one more time but the
reason why I will not persist, I will always
149
00:21:09,240 --> 00:21:13,169
assume equivalent rules is because it just
makes life easier and the derivations are
150
00:21:13,169 --> 00:21:16,470
always possible, whatever I do with unequal
intervals you can repeat as I have indicated
151
00:21:16,470 --> 00:21:20,440
with unequal intervals, is that fine, okay.
ìProfessor ñ student conversation ends.î
152
00:21:20,440 --> 00:21:25,610
So, let us look at the second derivative right,
so far we looked at the first derivative,
153
00:21:25,610 --> 00:21:30,440
you have a first order forward difference
representation, backward difference representation
154
00:21:30,440 --> 00:21:34,790
second order forward difference backward difference
right, you have one third order representation
155
00:21:34,790 --> 00:21:39,410
that I did in the last class, so you can work
out other higher order, I would suggest I
156
00:21:39,410 --> 00:21:43,450
would strongly recommend that you work, other
higher order representations for the first
157
00:21:43,450 --> 00:21:45,830
derivative, okay, for the first derivative.
158
00:21:45,830 --> 00:21:52,670
Now, let us look at the second derivative
again, I will repeat the second derivative,
159
00:21:52,670 --> 00:22:00,040
I quickly repeat the second derivative, right
that we did last time, so it is second order
160
00:22:00,040 --> 00:22:10,610
second derivative just because I am going
to do it, I am going to do it twice one which
161
00:22:10,610 --> 00:22:16,910
we did last class and then I am going to repeat
it again with unequal intervals. So, like
162
00:22:16,910 --> 00:22:35,160
I did I have xi, xi + 1, sorry; xi ñ 1, xi
+ 1, i ñ 1, i, i + 1, of course you can also
163
00:22:35,160 --> 00:22:40,560
see whether you can get one sided derivatives,
right for the second derivative one sided
164
00:22:40,560 --> 00:22:44,130
representations, I leave that to you.
165
00:22:44,130 --> 00:22:54,540
So, what we have is simple expansion again
using Taylor series about the point i fi +
166
00:22:54,540 --> 00:23:05,740
h times f prime at i. And again h equals xi
+ 1 ñ xi equals xi - xi ñ 1, okay, this
167
00:23:05,740 --> 00:23:16,390
case they are equal, + h squared/ 2 factorial
second derivative of i + h cube/ 3 factorial
168
00:23:16,390 --> 00:23:27,309
third derivative i + h to the 4th / 4 factorial
and so on, please remember so we are using
169
00:23:27,309 --> 00:23:34,730
Taylor series to expand about the point i;
xi, okay you could as well use Taylor series
170
00:23:34,730 --> 00:23:38,480
to expand about any other point which was
expand about the point i because we want the
171
00:23:38,480 --> 00:23:40,650
representation at the point i right.
172
00:23:40,650 --> 00:23:44,840
We want the representation of the derivative
at point i therefore we choose i, if you want
173
00:23:44,840 --> 00:23:49,540
the representation elsewhere then you have
to expand about that point, is that fine,
174
00:23:49,540 --> 00:24:00,890
is that okay. So, f at i - 1 is f at i - h
times f prime at i + h squared/ 2 factorial
175
00:24:00,890 --> 00:24:14,169
f double prime at i - h cube/ 3 factorial,
so this is sort of a jury process unfortunately,
176
00:24:14,169 --> 00:24:19,179
you have to get it, right okay, it does not
work, details very important.
177
00:24:19,179 --> 00:24:28,440
So, if I just add the 2, this cancels that
cancels, so it gives me for my first derivative
178
00:24:28,440 --> 00:24:33,330
and expression we derived in the last class,
the second I am sorry the second derivative
179
00:24:33,330 --> 00:24:40,600
and expression we derived in the last class
that is f double prime at i is fi + 1 - 2
180
00:24:40,600 --> 00:25:07,120
fi + fi ñ 1/ h squared - h squared/ there
are 2 of them, okay, this is the truncation
181
00:25:07,120 --> 00:25:11,100
error, we have seen this; we have seen this.
182
00:25:11,100 --> 00:25:16,500
So, the question is what happens if we take
on unequal intervals, okay, we look at that
183
00:25:16,500 --> 00:25:21,270
and then I will sort of; we will close the
subject of what happens with unequal intervals,
184
00:25:21,270 --> 00:25:28,860
so what happens if you take unequal intervals
for the representation of the second derivative,
185
00:25:28,860 --> 00:25:33,240
we have seen what happens for the first derivative;
first derivative, we still got a second order
186
00:25:33,240 --> 00:25:37,580
representation, it is just that the coefficient
of that truncation term change, we will see
187
00:25:37,580 --> 00:25:40,090
what happens here.
188
00:25:40,090 --> 00:25:56,280
So, instead of h, instead of h so, okay we
will just write it again, so we have i ñ
189
00:25:56,280 --> 00:26:06,440
1, i, i + 1, this is h, this is alpha h, okay
just to keep it clean, you just redo it quickly,
190
00:26:06,440 --> 00:26:16,580
so fi + 1 is fi + h times the first derivative
+ h squared time/ 2 second derivative, which
191
00:26:16,580 --> 00:26:29,580
is what you want, + h cube/ 3 factorial the
third derivative + h to the fourth/ 4 factorial,
192
00:26:29,580 --> 00:26:36,419
4th term and so on, okay. Normally, if you
did not know how many, I would; you would
193
00:26:36,419 --> 00:26:40,559
take a lot of terms depending on what is it,
what order you are going to take, right.
194
00:26:40,559 --> 00:26:44,549
You cannot stop at fourth derivative if you
want a much higher order I stop at fourth
195
00:26:44,549 --> 00:26:48,140
derivative because I know I am going to get
something that is of the order of second order;
196
00:26:48,140 --> 00:27:08,310
fi - 1 one is fi - alpha h f prime at i +
alpha square h/ 2 f double prime at i - alpha
197
00:27:08,310 --> 00:27:19,299
cubed h/ 3 factorial f triple prime at i +
alpha to the fourth, this is not as bad as
198
00:27:19,299 --> 00:27:29,610
the first derivative, right h to the 4th,
4 factorial 4th derivative i and so on, is
199
00:27:29,610 --> 00:27:31,549
that fine.
200
00:27:31,549 --> 00:27:44,130
H squared, H cubed being a little careless
today, so if I multiply by the; so now, I
201
00:27:44,130 --> 00:27:47,750
am a little desperate I want to get rid of
that, I have to get rid of that first derivative
202
00:27:47,750 --> 00:27:52,320
that is my need, I want the second derivative,
so I multiply the first equation by alpha
203
00:27:52,320 --> 00:28:01,600
to get rid of that okay. So, I get alpha fi
+ 1 and to that I add the second equation
204
00:28:01,600 --> 00:28:16,860
fi - 1 equals 1 + alpha times fi, I get an
alpha fi + 1 fi, the second term cancels.
205
00:28:16,860 --> 00:28:36,130
What happens here; + alpha, 1 + alpha * 1
+ alpha h squared/ 2 f double prime at i that
206
00:28:36,130 --> 00:29:16,350
is a term that I want, + alpha * and what
happens to the last one, now this looks very
207
00:29:16,350 --> 00:29:26,360
different, this looks very different, so if
I do; if I try to evaluate it maybe write
208
00:29:26,360 --> 00:29:35,630
it here, pardon me; ìProfessor ñ student
conversation startsî no, no I think you can
209
00:29:35,630 --> 00:29:44,350
verify, you can check get it out, it is okay,
I get it out to the way, we will stick with
210
00:29:44,350 --> 00:29:55,310
this material, what we are doing right now.
ìProfessor ñ student conversation ends.î
211
00:29:55,310 --> 00:30:27,980
So, f double prime and i is alpha fi + 1 - 1
+ alpha fi + fi ñ 1/ alpha * 1 + alpha h
212
00:30:27,980 --> 00:30:35,080
squared to 2, right so if alpha equals 1 that
2 and this 1 + alpha will cancel that is the
213
00:30:35,080 --> 00:30:39,340
idea, okay and alpha equals 1, this will be
1, that is 2, that is 1, it goes back to the
214
00:30:39,340 --> 00:30:48,740
standard expression. What about the truncation
error? So, you have a third derivative term
215
00:30:48,740 --> 00:30:54,620
right, so you have a minus, this is a truncation
error, so I have divided by alpha, 1 + alpha.
216
00:30:54,620 --> 00:31:16,799
So, it gives me a 1 - alpha h/ 3 at i and
this gives me a ñ 1- alpha + alpha squared,
217
00:31:16,799 --> 00:31:31,870
a little algebraic 4th derivative at i and
there is an h squared here and this is the
218
00:31:31,870 --> 00:31:40,190
difference, so for the second derivative term,
if you take unequal grids, the convergence
219
00:31:40,190 --> 00:31:46,970
rate drops, the representation of the derivative
suddenly became; the truncation error became
220
00:31:46,970 --> 00:31:52,299
first and the convergence is linear, it is
not quadratic, it goes to 0 as h, not as h
221
00:31:52,299 --> 00:31:53,299
squared.
222
00:31:53,299 --> 00:31:57,860
This is very important to remember and it
introduces a third derivative term, this will
223
00:31:57,860 --> 00:32:03,910
have significance later in the semester, I
will remind you about this okay, later in
224
00:32:03,910 --> 00:32:08,140
the semester I will remind you about this,
it adds so if you have unequal grids, if you
225
00:32:08,140 --> 00:32:14,920
have unequal grids, it introduces a third
derivative term, is that fine, okay and it
226
00:32:14,920 --> 00:32:20,330
introduces a convergence, which is first order
and not something that a second order.
227
00:32:20,330 --> 00:32:25,779
Of course, if alpha equals 1, this goes away
rate and we retrieve what we had for equal
228
00:32:25,779 --> 00:32:32,409
intervals, is that fine okay, so as I said
it is always possible for us with unequal
229
00:32:32,409 --> 00:32:35,890
intervals to calculate derivatives, it is
always possible, so when you encounter it
230
00:32:35,890 --> 00:32:39,620
you know how to do it but we are not going
to do anymore because it is just a mess and
231
00:32:39,620 --> 00:32:42,620
it does not add anything else, okay but I
do want you to remember.
232
00:32:42,620 --> 00:32:47,900
This is very important that if you go for
unequal intervals, you cannot be sure that
233
00:32:47,900 --> 00:32:52,530
the order that you get is the same order,
you have to recalculate, you have to rework
234
00:32:52,530 --> 00:32:59,320
okay, right. Now, let us apply this now that
we have all these derivatives that we can
235
00:32:59,320 --> 00:33:07,070
represent and functions that we can represent,
let us apply these; let us apply what we have
236
00:33:07,070 --> 00:33:11,790
got, right to differential equations some
differential equations, we will choose a simple
237
00:33:11,790 --> 00:33:13,520
one right now.
238
00:33:13,520 --> 00:33:27,500
We will use; we will look at Laplace equation;
we look at Laplace's equation, is that fine
239
00:33:27,500 --> 00:33:35,390
okay, so we look at Laplace's equation in
2 dimensions, I am going to stick to 2 dimensions
240
00:33:35,390 --> 00:33:47,940
here, so this symbol is called nabla, right
you are used to calling it del but it is called
241
00:33:47,940 --> 00:34:04,210
nabla, so this would be nabla squared phi
0, okay, fine and we could choose to solve
242
00:34:04,210 --> 00:34:07,929
this problem in a very simple region.
243
00:34:07,929 --> 00:34:20,080
We can choose a region that is in the first
quadrant maybe a unit square
244
00:34:20,080 --> 00:34:26,010
and in this unit square, you have this equation
that is valid and on the boundary possibly
245
00:34:26,010 --> 00:34:33,080
we provide boundary conditions, so you know
of many ways by which you can solve this equation
246
00:34:33,080 --> 00:34:37,970
possibly, in PD you studied variable separable
and so on, right there are many ways by which
247
00:34:37,970 --> 00:34:45,020
you can solve it. Here, we look at see whether
we can represent the derivatives on a mesh.
248
00:34:45,020 --> 00:34:51,960
And whether we can use that in for the solution,
okay, so to obtain that solution, so we know
249
00:34:51,960 --> 00:35:00,390
that in 2 dimensions, this would be dou squared
phi dou x squared + dou squared phi dou y
250
00:35:00,390 --> 00:35:06,960
squared equals 0, I will use an alternative
notation, I may switch between them depending
251
00:35:06,960 --> 00:35:13,970
on convenience, so if there is no confusion
you may occasionally see me write that it
252
00:35:13,970 --> 00:35:19,420
is much more compact notation, okay both of
them represent Laplaceís equation in two
253
00:35:19,420 --> 00:35:20,420
dimensions.
254
00:35:20,420 --> 00:35:28,550
And this is an expansion of that nabla squared,
so what is the typical mesh point that I am
255
00:35:28,550 --> 00:35:35,720
going to take, just like we said i, i + 1,
i ñ 1, how are we going to do it in 2 dimensions.
256
00:35:35,720 --> 00:35:42,729
In two dimensions, in Cartesian coordinates,
I am going to take equivalent rules, right
257
00:35:42,729 --> 00:35:52,280
so this would have now 2 indices; one for
going traversing along in the x direction
258
00:35:52,280 --> 00:35:55,190
and one for traversing along in the y direction.
259
00:35:55,190 --> 00:36:05,000
So, that would be i + 1 j that would be i
ñ 1j that would be ij - 1 and that would
260
00:36:05,000 --> 00:36:23,300
be ij + 1, okay I will take all of these intervals
for the sake of convenience to be h, I think
261
00:36:23,300 --> 00:36:26,610
you can figure out what will happen if you
change the values, you could there are so
262
00:36:26,610 --> 00:36:30,430
many different things that could happen, it
could be h here and it could be some different
263
00:36:30,430 --> 00:36:34,320
value in the y direction, each one of them
can be different there is so many possibility,
264
00:36:34,320 --> 00:36:36,140
you can work it out.
265
00:36:36,140 --> 00:36:45,640
So, what is the first derivative; what is
the first term at the point ij using the expression
266
00:36:45,640 --> 00:37:00,920
that we have just derived, it is phi i + 1j
- 2 phi ij + phi i ñ 1j/ h squared, okay.
267
00:37:00,920 --> 00:37:12,680
So, at the nodal points if I have the function
phi given by i + 1j, ij, i - 1j, phi of the
268
00:37:12,680 --> 00:37:17,450
appropriate points, I can estimate the derivative
okay and we have a truncation error associated
269
00:37:17,450 --> 00:37:22,619
with it, I say equals at this point but we
know already that I say equals but we know
270
00:37:22,619 --> 00:37:24,690
it is an approximation, it is a representation,
right.
271
00:37:24,690 --> 00:37:44,490
But I will write equals ij in a similar fashion
is phi ij + 1 - 2 phi ij + phi ij ñ 1/ h
272
00:37:44,490 --> 00:37:49,200
squared clearly, if they were delta x and
delta y, it would be delta x squared and delta
273
00:37:49,200 --> 00:37:57,190
y squared, okay that is not a big deal, fine.
So, now to represent Laplace equation at that
274
00:37:57,190 --> 00:38:00,050
point, so now I am talking about representation,
so far we talk about derivatives, now I am
275
00:38:00,050 --> 00:38:04,000
going to actually represent the equation,
I will add these 2, okay.
276
00:38:04,000 --> 00:38:17,251
I will add the 2 and I can actually represent
Laplace's equation, xx + phi yy at the point
277
00:38:17,251 --> 00:38:38,330
ij gives me phi ij, phi i + 1j ñ 2phi ij
+ phi i ñ 1j/ h squared + phi ij + 1, not
278
00:38:38,330 --> 00:38:50,520
a big deal means ñ 2phi ij + phi ij - 1 h
squared and this is supposed to be 0, this
279
00:38:50,520 --> 00:39:01,640
at that point supposed to be 0 at that point
okay, so now i say this represents the Laplace's
280
00:39:01,640 --> 00:39:08,440
equation at that point; at the point ij and
it is actually possible for us, it is actually
281
00:39:08,440 --> 00:39:13,520
possible for us to solve for phi at ij.
282
00:39:13,520 --> 00:39:18,920
After all that is really what we want, we
want the phi at ij in fact, turns out, so
283
00:39:18,920 --> 00:39:22,610
if you multiply through by h squared, the
right hand side is 0, so the h squared will
284
00:39:22,610 --> 00:39:35,780
go away, okay this turns out to be phi i +
1j + phi i ñ 1j + phi ij + 1 + phi ij ñ
285
00:39:35,780 --> 00:39:47,860
1/ 4, right
you could write by 4 just to encourage you
286
00:39:47,860 --> 00:39:52,990
to multiply instead of divide, I will write
times 0.25, so now change to a programming
287
00:39:52,990 --> 00:39:59,150
notation, multiplied by 0.25, okay that is
fine.
288
00:39:59,150 --> 00:40:06,810
But by the 4 is important, it is the average
of this; of the neighbour that is the key,
289
00:40:06,810 --> 00:40:12,140
so solution to this equation is the average
of solution to this equation at this point,
290
00:40:12,140 --> 00:40:16,900
the value at this point is the average of
the values at the neighbouring point, okay
291
00:40:16,900 --> 00:40:27,230
is that fine, okay. So, now we have some mechanism
by which we can take represent Laplaceís
292
00:40:27,230 --> 00:40:30,650
equation at a given point, we will see what
we can do with this.
293
00:40:30,650 --> 00:40:40,360
ìProfessor ñ student conversation startsî
Yeah, do you have question, oh, well in this
294
00:40:40,360 --> 00:40:43,651
case it does not matter because we are taking
derivatives only with x and y but you can
295
00:40:43,651 --> 00:40:51,120
actually write Taylor series in 2 dimensions,
there is a Taylor series expansion for 2 dimensions,
296
00:40:51,120 --> 00:40:57,641
so if you say, you may have seen it in multivariate
calculus, you can actually write it, you can
297
00:40:57,641 --> 00:41:02,130
actually expand about the point f of xy, right.
ìProfessor ñ student conversation ends.î
298
00:41:02,130 --> 00:41:07,680
And then it will turn out to be; I am just
writing this fx, fy, where fx is derivative
299
00:41:07,680 --> 00:41:15,660
with respect to x, fy is derivative with respect
to y and you can go on, so you will get a
300
00:41:15,660 --> 00:41:24,270
h squared fxx, g squared fyy, 2hg fxy, you
understand and you can add, you can keep on
301
00:41:24,270 --> 00:41:28,540
adding terms right, so there is a from your
multivariate calculus, you go back you look,
302
00:41:28,540 --> 00:41:31,560
you will see that you will actually pick up,
okay.
303
00:41:31,560 --> 00:41:37,940
So and you would need that you would need
that if these grids were not orthogonal to
304
00:41:37,940 --> 00:41:45,770
each other that is if you had grids that were
not only unequal but they are not along the
305
00:41:45,770 --> 00:41:53,710
coordinate lines, so not only are there it
could be equal or unequal but they are not
306
00:41:53,710 --> 00:41:58,000
along coordinate lines, right and then you
can run into this problem that you would have
307
00:41:58,000 --> 00:42:00,390
to do it in, you would have to do it this
way.
308
00:42:00,390 --> 00:42:08,440
But trust me there are better ways by which
one can do this, right, so we will see, if
309
00:42:08,440 --> 00:42:15,090
we will see may, I do not know whether you
need to look up a little tensor calculus,
310
00:42:15,090 --> 00:42:18,490
I usually do something on tensor calculus
we will see whether we get there or not at
311
00:42:18,490 --> 00:42:21,420
least I will give you a motivation for why
you should learn tensor calculus as we go
312
00:42:21,420 --> 00:42:25,900
along, okay let us get back here, what do
we have?
313
00:42:25,900 --> 00:42:33,730
So, this is a problem that we want to solve,
we will make up a problem and we will see
314
00:42:33,730 --> 00:42:40,920
how we would go about solving using what we
have just derived, so what we do is again
315
00:42:40,920 --> 00:42:53,000
to keep life easy, we will break this up,
we will break up our problem domain using
316
00:42:53,000 --> 00:43:01,300
a mesh and you will notice that in this case
of course, there are 1, 2, 3, 4, 5 at the
317
00:43:01,300 --> 00:43:08,480
three interior points, right, so this would
be; so that would be at some point ij that
318
00:43:08,480 --> 00:43:11,280
I was talking about okay.
319
00:43:11,280 --> 00:43:14,990
And how would the problem be normally prescribed,
how would you normally prescribe the problem?
320
00:43:14,990 --> 00:43:19,630
So, just say this is a unit square, so this
is the point 0, 0 which is the origin, this
321
00:43:19,630 --> 00:43:28,940
is a point 1, 1, right so unit square located
at the origin; unit square located the origin
322
00:43:28,940 --> 00:43:33,050
and what we want to do is; we want to see
whether we can solve Laplace's equation, so
323
00:43:33,050 --> 00:43:36,230
given some boundary condition we will figure
out how to get those boundary conditions,
324
00:43:36,230 --> 00:43:37,450
given some boundary conditions.
325
00:43:37,450 --> 00:43:44,470
So, I prescribe some boundary conditions which
means that the values at these points are
326
00:43:44,470 --> 00:43:54,910
known, so if I prescribe some boundary conditions,
the values at these points are known and if
327
00:43:54,910 --> 00:44:05,050
we are able to find the values at the interior
points, right then we have phi ij's at the
328
00:44:05,050 --> 00:44:09,369
interior points and using possibly hat functions
or something of that sort we may be able to
329
00:44:09,369 --> 00:44:12,940
interpolate, it actually we use hat functions
in 2D but I have not defined hat functions
330
00:44:12,940 --> 00:44:13,940
in 2D.
331
00:44:13,940 --> 00:44:17,880
But you can use hat functions and actually
use linear interpolants to find a value anywhere
332
00:44:17,880 --> 00:44:29,060
in between okay, is that fine. So, what you
can do now is at any given point ij, you just
333
00:44:29,060 --> 00:44:41,750
repeat this, so phi ij is phi i + 1j, phi
i ñ 1j, phi ij + 1, phi ij ñ 1, then say
334
00:44:41,750 --> 00:44:50,020
divided by 4 here but you know you have to
multiply by 0.25, you just repeat this process
335
00:44:50,020 --> 00:44:55,790
for every interior; every interior node, the
conditions on the boundary are given okay.
336
00:44:55,790 --> 00:45:03,650
So, when you are trying to figure out what
is the value at that node, this is known that
337
00:45:03,650 --> 00:45:15,000
is known, right let us number these, so let
us say this point is 0, 0, this is 1, 0, 2,
338
00:45:15,000 --> 00:45:30,790
0, 3, 0, 4, 0 okay, so this is 0, 1 and this
would be 1, 1 get rid of that 2, 1 and so
339
00:45:30,790 --> 00:45:40,950
on and this point is of interest, this is
0, 2, this is 1, 2, so if you want to find
340
00:45:40,950 --> 00:45:49,960
the value at 1, 1 you need the values at 1,
2; 2, 1; 0, 1; 1, 0 from the boundary conditions
341
00:45:49,960 --> 00:45:54,290
you have the values at 1, 0 and 0, 1 okay.
342
00:45:54,290 --> 00:45:57,540
You do not have the values at 1, 2 and 2,
1 so if you not only do not have the value
343
00:45:57,540 --> 00:46:03,660
at 1, 1 we do not have the values anywhere
in between, so in order to get this working,
344
00:46:03,660 --> 00:46:07,010
the process that we will start doing is we
will make an assumption about the interior
345
00:46:07,010 --> 00:46:12,370
values, just make an assumption let us start
with the guess, right a good guess would be
346
00:46:12,370 --> 00:46:16,410
0, we have nothing to go with right now.
347
00:46:16,410 --> 00:46:20,680
There are many possible guesses right now,
I have not even told you about the boundary
348
00:46:20,680 --> 00:46:24,579
conditions, so good guess is 0, so let us
just assume that all the interior values are
349
00:46:24,579 --> 00:46:31,070
0 and your given boundary conditions okay,
so you can find phi ij at any given point
350
00:46:31,070 --> 00:46:38,220
by taking the values of the neighbouring point,
then you can go to the adjacent point, take
351
00:46:38,220 --> 00:46:42,850
the values of the neighbouring point, you
understand.
352
00:46:42,850 --> 00:46:46,510
And you can do this for all the interior points,
you do not touch the boundary points because
353
00:46:46,510 --> 00:46:50,210
the boundary points are known already, so
if you keep repeating this process for all
354
00:46:50,210 --> 00:46:55,980
the interior points as time progresses, we
hope that the phi ij of all that you are generating
355
00:46:55,980 --> 00:47:05,690
a sequence of phi ijís, so this is the generating
a sequence of phi ijís right, n equals 1,
356
00:47:05,690 --> 00:47:09,220
n equals 2, n equals 3, n equals 4 that you
generate a sequence of phi ij's.
357
00:47:09,220 --> 00:47:13,500
And you hope that sequence converges right
now, we hope that sequence converges and if
358
00:47:13,500 --> 00:47:21,450
that sequence converges you will have a set
of few values at every grid point okay, is
359
00:47:21,450 --> 00:47:29,730
that fine, okay, so I i's better if you just
try it out and work a problem and I think
360
00:47:29,730 --> 00:47:36,650
then it will work out. If you go through that
sequence and it has converged, how do you
361
00:47:36,650 --> 00:47:41,339
know the answer that you have got is the right
answer?
362
00:47:41,339 --> 00:47:47,170
Well, you have points at these values, you
have grid points, so when you say something
363
00:47:47,170 --> 00:47:50,700
is the solution to a differential equation
what do you do you substitute into the differential
364
00:47:50,700 --> 00:47:53,740
equation and verify whether it is true or
not right, so you could substitute into the
365
00:47:53,740 --> 00:47:59,760
original differential equation phi xx + phi
yy equals 0 but in this case, you just have
366
00:47:59,760 --> 00:48:05,510
points at various nodes, okay right.
367
00:48:05,510 --> 00:48:09,660
And if you substitute in the difference equation,
you can find out what is it that the difference
368
00:48:09,660 --> 00:48:16,339
equation gives you, okay but the differential
equation itself requires that you take derivatives
369
00:48:16,339 --> 00:48:25,230
and you have only discrete nodes okay, is
that fine right. So, I think what you do is
370
00:48:25,230 --> 00:48:32,040
you can try this out just give some arbitrary
boundary conditions will work out maybe a
371
00:48:32,040 --> 00:48:36,329
more specific problem in the next class, just
try to give it some arbitrary boundary conditions
372
00:48:36,329 --> 00:48:38,640
and see what it works, what happens, right.
373
00:48:38,640 --> 00:48:44,960
Professor ñ student conversation startsî
yeah, right, in this, what I have drawn have
374
00:48:44,960 --> 00:48:56,270
9 unknowns, right. We have 9 conditions, right
so we can solve linear set of equation, yeah
375
00:48:56,270 --> 00:49:00,859
there are issues so that we will get to that
right, so we will see what it is that we are
376
00:49:00,859 --> 00:49:03,470
doing that is actually what we are doing,
right we will actually figure out what is
377
00:49:03,470 --> 00:49:06,970
it exactly; what exactly are you doing okay,
right. Professor ñ student conversation endsî.
378
00:49:06,970 --> 00:49:13,080
So, we will get back to this on Monday, thank
you.