1
00:00:10,369 --> 00:00:20,550
So this morning we will continue with representation
of numbers. Let me just get back to where
2
00:00:20,550 --> 00:00:25,939
we were, what we did in the last class. We
saw that computational fluid dynamics that
3
00:00:25,939 --> 00:00:32,019
we are going to solve differential equations
that come from fluid mechanics. The solutions
4
00:00:32,019 --> 00:00:40,590
to such equations are functions and these
functions in ordered for us to be able to
5
00:00:40,590 --> 00:00:42,930
solve these equations both the differential
equations.
6
00:00:42,930 --> 00:00:49,260
And the functions had to be represented on
a computer that is the idea. So to that end
7
00:00:49,260 --> 00:00:57,149
they decided to represent various mathematical
entities on a computer. We started the way
8
00:00:57,149 --> 00:01:00,780
that you have learnt calculus that we started
by saying that let us try to represent to
9
00:01:00,780 --> 00:01:09,600
the real line on the computer and what we
have basically done now is we have tried fixed
10
00:01:09,600 --> 00:01:13,649
point. We have done integers. We have finally
come down to floating point. I have asked
11
00:01:13,649 --> 00:01:21,179
you to look up by triple E 754 standard. I
gave you what is used for what is the format
12
00:01:21,179 --> 00:01:22,179
that is used for single position.
13
00:01:22,179 --> 00:01:32,240
Single position for a float or in fact I asked
you to look up this file on your computer,
14
00:01:32,240 --> 00:01:39,149
locate where it is a look up this file on
your computer, and just to recollect for float
15
00:01:39,149 --> 00:01:54,030
or I use the word now a single precision as
suppose to double precision. So we have indicated
16
00:01:54,030 --> 00:02:06,069
that the first bit was the sign bit. We used
the next 8 bits 1 through 8. We used them
17
00:02:06,069 --> 00:02:15,180
for the exponent. Again I remind you that
please go look up Big Endian and Little Endian.
18
00:02:15,180 --> 00:02:23,829
Then the remaining how many are there 23 bits
going from 9 numbers till 31. Please remember
19
00:02:23,829 --> 00:02:29,569
we started the count at 0. Remaining bits
are typically used for the mantissa. It is
20
00:02:29,569 --> 00:02:35,140
possible that if you come across something
called a NaN not a number we will see that
21
00:02:35,140 --> 00:02:38,939
may be there are 22 bits and we will look
up the standard we will find out about it,
22
00:02:38,939 --> 00:02:47,620
but I am not going to really talk about this
now so they have 23 bits which are the mantissa.
23
00:02:47,620 --> 00:02:51,959
To this end I had asked you to try out an
experiment which I hope that you guys have
24
00:02:51,959 --> 00:03:02,760
tried which is to ask the question is there
a positive what is the smallest positive epsilon,
25
00:03:02,760 --> 00:03:15,120
smallest positive number such that, that is
epsilon 1 plus epsilon smallest positive number
26
00:03:15,120 --> 00:03:23,719
such that 1 plus epsilon is different from
1. I also said that there is an alternate
27
00:03:23,719 --> 00:03:36,849
definition. You can also look for the largest
positive number such that 1 plus epsilon equal
28
00:03:36,849 --> 00:03:44,769
to 1. Is that fine? So that is the possibility.
So, we have written the piece of symbol code
29
00:03:44,769 --> 00:03:47,060
for this. I had asked you to try this out.
30
00:03:47,060 --> 00:03:55,470
So you let epsilon in fact I think yesterday
I had used different symbol for this I had
31
00:03:55,470 --> 00:04:04,791
used that. Epsilon equal to 1 as a start and
you can say while 1 plus epsilon this is a
32
00:04:04,791 --> 00:04:11,590
candidate epsilon is greater than 1 it is
not equal to 1 or you can also say not equal
33
00:04:11,590 --> 00:04:22,051
to 1. Divide epsilon by 2. This is something
that I had suggest that you do try it out
34
00:04:22,051 --> 00:04:27,050
and you know if you have tried it out you
will see that you will have a variety of experiences
35
00:04:27,050 --> 00:04:30,080
that you guys would have had.
36
00:04:30,080 --> 00:04:40,340
Some of you possibly for float double and
long double. You may have got different answer
37
00:04:40,340 --> 00:04:46,061
for these, but depending on your experience
some of you may have got the same answer for
38
00:04:46,061 --> 00:04:52,889
both of them. So you have to ponder why epsilon
sometimes comes out the same for both of these
39
00:04:52,889 --> 00:04:56,830
and what does it mean with respect to? What
is the accuracy with which we can calculate
40
00:04:56,830 --> 00:05:03,840
make our calculations? Is that fine? So this
is single precision.
41
00:05:03,840 --> 00:05:09,160
You try to relate this to the size of the
mantissa that we have so that is what we are
42
00:05:09,160 --> 00:05:13,449
really measuring here when we do this epsilon
what we are essentially doing is we are asking
43
00:05:13,449 --> 00:05:19,020
the question with respect to 1 what can we
resolve and what we can resolve is given by
44
00:05:19,020 --> 00:05:24,750
the size of the mantissa. So you please check
the epsilon that you get and compare it to
45
00:05:24,750 --> 00:05:30,169
2 raise to the power minus 24 and I have explained
to you why it is 24 yesterday.
46
00:05:30,169 --> 00:05:38,270
And see what is the relationship between what
you have printed out and what you have got
47
00:05:38,270 --> 00:05:43,270
here. So what about what is the next deal?
So, before I go on with the discussions since
48
00:05:43,270 --> 00:05:53,130
I have got that up there. Let me just tell
you that there is a double which use a 64
49
00:05:53,130 --> 00:05:59,950
bits. This is double precision and FORTRAN
or real star 8 depending on what you are used
50
00:05:59,950 --> 00:06:05,240
to or you say REAL into 8 double precision
is much longer to type.
51
00:06:05,240 --> 00:06:11,470
So we would have liked it if the 32 bits that
you added here had been added directly to
52
00:06:11,470 --> 00:06:16,180
the mantissa unfortunately that has not happened.
So what happens in this standard is that you
53
00:06:16,180 --> 00:06:29,729
have the sign bit just like you had in the
single precision and the 11 bits 1 through
54
00:06:29,729 --> 00:06:39,979
11 are set aside for the exponent and the
remaining how many would there be 52 bits?
55
00:06:39,979 --> 00:06:50,810
The remaining 52 bits 12 to 63 are set aside
for the mantissa.
56
00:06:50,810 --> 00:06:56,090
So this would be double precision is that
fine. So now that I have told you this let
57
00:06:56,090 --> 00:07:02,610
step back and ask ourselves the question if
we are performing computations using single
58
00:07:02,610 --> 00:07:07,150
precision or double precision and associated
with it there is an epsilon what are we actually
59
00:07:07,150 --> 00:07:11,330
doing. What is the computation that we are
actually performing? So let us go back to
60
00:07:11,330 --> 00:07:17,620
the real line that we had yesterday and zoom
in on around what is that we are actually
61
00:07:17,620 --> 00:07:18,620
is doing.
62
00:07:18,620 --> 00:07:24,780
So this is 0.0, this is 1.0 well in fact I
will not indicate 0.0. 0.0 Or somewhere there
63
00:07:24,780 --> 00:07:32,909
I mean it is far off. I am going to really
zoom in and this is basically epsilon. So
64
00:07:32,909 --> 00:07:39,469
this is minus epsilon, 1 minus epsilon and
this is 1 plus epsilon and what we are essentially
65
00:07:39,469 --> 00:07:50,789
saying here is any number here basically maps
into 1 that is essentially what we are saying.
66
00:07:50,789 --> 00:07:55,289
That is if you give me an epsilon, if you
give me a sufficient epsilon if epsilon is
67
00:07:55,289 --> 00:08:00,689
sufficiently small any number that could actually
fit in here.
68
00:08:00,689 --> 00:08:05,040
Ends up being 1 that is essentially what it
says that when you say 1 plus epsilon is 1
69
00:08:05,040 --> 00:08:09,479
what you are effectively saying is you give
me this epsilon and it is going to turn out
70
00:08:09,479 --> 00:08:13,389
that when I added to 1 I am still going to
get 1. So any epsilon, this neighbourhood
71
00:08:13,389 --> 00:08:22,060
is actually it is like a mush factor that
I have mush area that I have here. The 1.0
72
00:08:22,060 --> 00:08:27,949
that I use on the computer suppose to 1 that
I use when I talk mathematics so 1.0 that
73
00:08:27,949 --> 00:08:32,380
I am talking about here actually represents
an interval.
74
00:08:32,380 --> 00:08:37,260
This (())(08:33) represents the idea of 1.
This (())(08:36) here represents the whole
75
00:08:37,260 --> 00:08:43,229
interval 1 minus epsilon to 1 plus epsilon.
So when we are adding 2 numbers together that
76
00:08:43,229 --> 00:08:52,440
is when we add say 2.0 plus 1.0. Actually
what we are doing is we adding 2 intervals.
77
00:08:52,440 --> 00:08:56,360
There is an interval associated with this
number 2. There is an interval associated
78
00:08:56,360 --> 00:09:02,200
with this number 1 and we are actually adding
these 2 numbers together, is that fine.
79
00:09:02,200 --> 00:09:07,160
So basically the arithmetic that we are doing
is not the standard mathematical arithmetic
80
00:09:07,160 --> 00:09:13,910
that we do, but what I would say is the interval
arithmetic. There is a lot of interest in
81
00:09:13,910 --> 00:09:29,230
this interval arithmetic. So you have to ask
the question if you have a, b plus c, d what
82
00:09:29,230 --> 00:09:33,399
would that turn out to be. If you had a, b
plus c, d what would that turn out to be?
83
00:09:33,399 --> 00:09:47,120
So a, b plus c, d will turn out to be a plus
c, b plus d. In a similar fashion, if I were
84
00:09:47,120 --> 00:09:50,670
going to go with the subtraction instead of
addition.
85
00:09:50,670 --> 00:09:56,430
So you try the mathematical operations. Please
try the operations subtraction, multiplication,
86
00:09:56,430 --> 00:10:04,010
and divsion. With intervals instead of actual
numbers and that gives you an ideas to what
87
00:10:04,010 --> 00:10:12,860
is the nature of the arithmetic that we are
doing. So if you say that if I have 1.0 you
88
00:10:12,860 --> 00:10:17,050
now have an uncertainty as to actually what
the original number was. You do not know whether
89
00:10:17,050 --> 00:10:25,910
it was 1 or something else that became 1.
So we now introduce for the first time an
90
00:10:25,910 --> 00:10:34,389
error associated with. We now introduce for
the first time the error associated with this
91
00:10:34,389 --> 00:10:35,389
representation.
92
00:10:35,389 --> 00:10:40,110
I will call the general error since we are
talking about representations on a computer.
93
00:10:40,110 --> 00:10:48,620
We will call the general error representation
error. The representation error is the difference
94
00:10:48,620 --> 00:10:54,900
between the mathematical entity and its representation
on the computer. So that is a very general
95
00:10:54,900 --> 00:10:58,350
expression. So if you have any mathematical
entity and you want to represent it on the
96
00:10:58,350 --> 00:11:00,740
computer the difference between the mathematical
entity.
97
00:11:00,740 --> 00:11:06,860
And its representation on the computer would
be representation error. So in this case if
98
00:11:06,860 --> 00:11:13,000
you had some number that was actually of the
order of 1 plus epsilon it would be represented
99
00:11:13,000 --> 00:11:18,050
by 1. That is what we are saying. It would
be represented by 1 and the error that you
100
00:11:18,050 --> 00:11:24,390
have it is of the order of epsilon is in fact
epsilon in this case if it were 1 plus epsilon.
101
00:11:24,390 --> 00:11:35,600
So this error for numbers is called round
off error. So it is a particular type of representation
102
00:11:35,600 --> 00:11:38,860
error called round off error.
103
00:11:38,860 --> 00:11:43,589
So round-off error is a problem that we have
seen. Now first we know when I say that I
104
00:11:43,589 --> 00:11:50,890
am representing numbers I am actually representing
intervals that when I perform arithmetic I
105
00:11:50,890 --> 00:11:56,220
am actually doing arithmetic of intervals
and if I say that I add 2 numbers a plus b
106
00:11:56,220 --> 00:12:02,259
to c plus d it is very likely that the result
is actually more uncertain possible more uncertain
107
00:12:02,259 --> 00:12:04,399
then what we started off with.
108
00:12:04,399 --> 00:12:10,670
So there is this uncertainty associated with
these numbers that we have and if I just take
109
00:12:10,670 --> 00:12:14,670
a number just represent the number then there
is an error associated with it which is a
110
00:12:14,670 --> 00:12:22,320
round off error and in last class I already
indicated that on the binary system even 1
111
00:12:22,320 --> 00:12:32,110
by 10 is recurring because 1 by 2 though it
can be represented exactly 1 by 10 has a problem
112
00:12:32,110 --> 00:12:38,870
because 1 by 5th is a recurring number and
if you truncate it to 23 bits in the mantissa.
113
00:12:38,870 --> 00:12:41,920
Then somewhere along the line you are going
to chop the end off. So we are going to end
114
00:12:41,920 --> 00:12:48,100
up with what is called round off error. So
I hope that is quite clear. So we have this
115
00:12:48,100 --> 00:12:54,470
thing now. So we have known that we cannot
represent the real line exactly and we know
116
00:12:54,470 --> 00:13:00,790
that we have made a selection or what are
the points on the real line that we are going
117
00:13:00,790 --> 00:13:09,850
to represent, however it seems that associated
with that decision there is a connected round
118
00:13:09,850 --> 00:13:10,850
off error.
119
00:13:10,850 --> 00:13:16,170
And we have to deal with that connected round
off error. So this is as far as representing
120
00:13:16,170 --> 00:13:20,690
numbers goes on the computer. Let us see what
else we can do. What are the mathematical
121
00:13:20,690 --> 00:13:24,160
entities we are interested. We are interested
in vectors for instances. So if you want to
122
00:13:24,160 --> 00:13:30,560
represent vectors as I said I am not going
to say much about computer architecture and
123
00:13:30,560 --> 00:13:36,279
so on however it is important for us to know
that computer memory in our mind the model
124
00:13:36,279 --> 00:13:42,380
that we have off computer memory is linear
that is.
125
00:13:42,380 --> 00:13:45,949
You have the zeroth locational memory, first
location, second location, third location.
126
00:13:45,949 --> 00:13:52,449
It is computer memory occurs in a linear fashion
it comes one after the other in a linear fashion.
127
00:13:52,449 --> 00:13:58,470
So if I wanted to store a vector, vectors
and matrices of course is what I told you
128
00:13:58,470 --> 00:14:04,779
that I would do in the beginning of yesterday's
class, but however vectors and matrices are
129
00:14:04,779 --> 00:14:09,079
associated with various operations and properties.
In reality what I am going to do is I am going
130
00:14:09,079 --> 00:14:15,040
to represent arrays, I will come them arrays
just to distinguish from vectors and matrices
131
00:14:15,040 --> 00:14:16,290
right.
132
00:14:16,290 --> 00:14:21,190
Though I promise vectors and matrices what
I am actually going to give you is an array
133
00:14:21,190 --> 00:14:27,339
and when I say a vector what I mean is a 1
dimensional array. So 1 dimensional array
134
00:14:27,339 --> 00:14:35,471
ai has 1 subscript so I do not care whether
it is a column or a row here right now, but
135
00:14:35,471 --> 00:14:43,009
because memory is linear what I will do is
I will represent, I will store on the computer
136
00:14:43,009 --> 00:14:45,810
we will store or our complier will store.
137
00:14:45,810 --> 00:14:52,199
The arrangement is made automatically so if
there are n of these since I am using the
138
00:14:52,199 --> 00:14:57,911
c notation of starting the count at 0, a 0
through an minus 1 will be stored in the computer
139
00:14:57,911 --> 00:15:07,269
memory linearly 1 after the other is that
fine. So that is the quick way of doing vectors.
140
00:15:07,269 --> 00:15:12,800
So but as I said there is an algebra associated
with it which has to be done by you it is
141
00:15:12,800 --> 00:15:17,529
not going to be something that is done automatically
on most computers.
142
00:15:17,529 --> 00:15:22,540
What about 2 dimensional arrays? So you want
matrices, but I will talk about 2D arrays.
143
00:15:22,540 --> 00:15:29,680
So how do we do 2D arrays? 2D arrays have
2 subscripts. So they have a I will say i,
144
00:15:29,680 --> 00:15:37,680
j just for or if you want a i,j so in a matrix
that would be row, column and the way you
145
00:15:37,680 --> 00:15:43,779
would store it as you would store it either
row wise or column wise in the linear memory
146
00:15:43,779 --> 00:15:54,029
what I mean by that is you would store a 0,0
a 0, 1 same that is the first row second column.
147
00:15:54,029 --> 00:16:07,110
And so on till a is 0 n minus 1 and then move
on the next row which is a 1 0, a 1,1 and
148
00:16:07,110 --> 00:16:12,660
so on. So the idea is that in the linear fashion
I will store the first row then I will store
149
00:16:12,660 --> 00:16:16,379
the second row and then I will go ahead and
store the third row. So the model that we
150
00:16:16,379 --> 00:16:23,680
have of the computer memory is linear and
what we will basically do is I will store
151
00:16:23,680 --> 00:16:30,690
the individual rows 1 after the other. This
process this is how arrays in c for example
152
00:16:30,690 --> 00:16:33,199
lot of languages are stored.
153
00:16:33,199 --> 00:16:41,970
This process is called a row major. That is
the standard and as one can see if you can
154
00:16:41,970 --> 00:16:50,490
store it row wise you can also store it column
wise so if you store it instead of the first
155
00:16:50,490 --> 00:16:55,079
row as we have done here and then go on to
the second row instead of which if you do
156
00:16:55,079 --> 00:17:02,879
the first column and then move on to the second
column you would get a column major operation
157
00:17:02,879 --> 00:17:03,879
is that fine.
158
00:17:03,879 --> 00:17:11,240
So that would be something like a 0, 0 a 1,
0 and you will notice that the column is kept
159
00:17:11,240 --> 00:17:21,780
fixed a 2, 0 and so on till you got to a n
minus 1, 0 and then you go to the next column
160
00:17:21,780 --> 00:17:28,870
a 0, 1, then you go to the next column and
you sweep through the next column you go column
161
00:17:28,870 --> 00:17:39,220
by column this is called column major. The
responsibility to implement either matrix
162
00:17:39,220 --> 00:17:44,220
algebra or vector algebra either lies with
you or somebody else has done it in the form
163
00:17:44,220 --> 00:17:45,220
of a library.
164
00:17:45,220 --> 00:17:49,700
And you should necessarily use those libraries
if you want the associated algebra. So what
165
00:17:49,700 --> 00:17:57,780
you have shown now is integers, fixed point,
floating point, floating point of various
166
00:17:57,780 --> 00:18:07,220
resolutions so to speak then we have arrays,
vectors supposedly, then we have matrices
167
00:18:07,220 --> 00:18:13,070
or 2-D arrays. If you have the associated
algebra you can do matrix algebra so the only
168
00:18:13,070 --> 00:18:16,549
thing that we have now is we have to look
at functions and how functions can be represented
169
00:18:16,549 --> 00:18:22,221
if possible. That is the deal. I am going
to put up a bunch of things now. You please
170
00:18:22,221 --> 00:18:29,610
see what they have in common.
171
00:18:29,610 --> 00:18:44,340
So I write a bunch of things 3 x square plus
1. I will put this up right 3 I plus 2 j plus
172
00:18:44,340 --> 00:19:02,460
k, 3 cos theta plus 2 sin theta plus 1, 3
plus 2 plus 1, what else can I add, 321, 3,
173
00:19:02,460 --> 00:19:15,010
2, 1 and just for the fun of it 3dx plus 2dy
plus dz or even 3 dou by doux I am not going
174
00:19:15,010 --> 00:19:19,380
to really talk about these, but I am just
doing it just for the fun of it so that you
175
00:19:19,380 --> 00:19:28,540
get an ideas to. So what do all these expressions
have in common? What is that they have in
176
00:19:28,540 --> 00:19:29,540
common? What is different?
177
00:19:29,540 --> 00:19:36,020
So you can look at this say that is a polynomial,
this seems to be a vector and this is possibly
178
00:19:36,020 --> 00:19:41,340
terms in a Fourier series I do not know that
may be a clue. This is just the addition I
179
00:19:41,340 --> 00:19:48,840
mean that is 6. So if you pay attention to
this except for this in all of these expressions
180
00:19:48,840 --> 00:19:52,740
that I have written here you think that I
am quite crazy if I actually added the 3 to
181
00:19:52,740 --> 00:19:59,080
the 2 so if you ask the question ask yourself
the question what role does the I here.
182
00:19:59,080 --> 00:20:04,030
Play your mathematics background will tell
you about the I is a unit vector that is along
183
00:20:04,030 --> 00:20:09,450
the x axis and so on, but in reality if you
ask the question here at this expression,
184
00:20:09,450 --> 00:20:13,470
this expression would add the 3 to 2. In this
expression you do not add the 3 to 2 simply
185
00:20:13,470 --> 00:20:18,470
because the I and j are there. So the i, j,
k here sort of prevent k from adding the 3
186
00:20:18,470 --> 00:20:28,600
to the 2 and that role is played as well by
3, 2, 1. So in that sense, these are quite
187
00:20:28,600 --> 00:20:36,110
similar and if I take the combinations.
188
00:20:36,110 --> 00:20:48,340
3 x square plus 2x plus 1 and I add to that
5 x square plus 3x plus 2 that really is no
189
00:20:48,340 --> 00:20:57,530
different from 3i plus 2j plus k and make
sure I get the same numbers 5i plus 3j plus
190
00:20:57,530 --> 00:21:06,090
2K. So if I add these up in deed I add these
respective components here so I will get 8x
191
00:21:06,090 --> 00:21:21,090
square plus 5x plus 3 whereas here I get 8i
plus 5j plus 3k. What is the difference? There
192
00:21:21,090 --> 00:21:28,529
is no difference. So basically the summation
seems to work just the same as this.
193
00:21:28,529 --> 00:21:34,820
So this looks like just like this is some
point in 3 dimensions you would easily identify
194
00:21:34,820 --> 00:21:40,570
this as a point in 3 dimensions. This looks
like similar to a point in 3 dimensions. So
195
00:21:40,570 --> 00:21:44,270
it looks like we can actually represent a
function deal with a function as though it
196
00:21:44,270 --> 00:21:49,260
is a point in space. Is that fine? So we can
deal with this function as though there are
197
00:21:49,260 --> 00:21:53,409
point in space. Of course, I should point
out that if x were equal to 1 coming back
198
00:21:53,409 --> 00:21:55,710
here if x square equal to 1.
199
00:21:55,710 --> 00:22:00,510
Then in deed you will get 3 plus 2 plus 1
and x square equal to 10 you would actually
200
00:22:00,510 --> 00:22:04,340
get 321. So there is a connection between
these 2. This is the reason why I have written
201
00:22:04,340 --> 00:22:09,059
this. I have already mentioned Fourier series
and you can as think about this and what it
202
00:22:09,059 --> 00:22:12,690
means? whether it makes any sense to you.
It is not something that I want to get into
203
00:22:12,690 --> 00:22:18,669
right now, but I just I thought just throw
that out there if you had a course in differential
204
00:22:18,669 --> 00:22:24,690
equations or linear algebra they make more
sensitive.
205
00:22:24,690 --> 00:22:31,320
So now we have a big thing. What it basically
says is that by representing and taking an
206
00:22:31,320 --> 00:22:35,070
array see this is the 1 dimensional array?
This is the big deal that we have done here.
207
00:22:35,070 --> 00:22:39,330
This is a 1 dimensional array so I can use
this 1 dimensional array to represent this
208
00:22:39,330 --> 00:22:44,760
vector or to represent this function or to
represent that function. So that is the great
209
00:22:44,760 --> 00:22:48,430
thing that we have achieved here. So it is
a simple comparison.
210
00:22:48,430 --> 00:22:54,929
But what it tells me is that it is possible
for me to assemble various components and
211
00:22:54,929 --> 00:23:01,650
it also looks like that if I take a function
now it is actually a point and some kind of
212
00:23:01,650 --> 00:23:08,150
a space, some kind of a function space. So
we are dealing with computers and of course
213
00:23:08,150 --> 00:23:11,840
even if you have to do a manipulation ourselves.
one of the things that we would like to do
214
00:23:11,840 --> 00:23:16,679
is we would like to organize any space that
we have in a systematic fashion so that we
215
00:23:16,679 --> 00:23:19,440
could do searches, comparisons and so on.
216
00:23:19,440 --> 00:23:29,580
So that is there we are headed that is our
objective. So let me then show you some systematic
217
00:23:29,580 --> 00:23:34,220
way by which we do it since I started off
with vector algebra, I will show you how we
218
00:23:34,220 --> 00:23:39,341
do it with vector algebra and then may be
in the next class it is possible we will start
219
00:23:39,341 --> 00:23:46,260
off with functions and how to represent functions.
That is fine. So how do we do vector algebra.
220
00:23:46,260 --> 00:23:50,490
Where does it starts? So how what was the
definition of a vector, the earliest definition
221
00:23:50,490 --> 00:23:51,880
of vector that you have seen.
222
00:23:51,880 --> 00:23:56,649
The earliest definition of vector that you
have seen is most likely a directed line segment.
223
00:23:56,649 --> 00:24:02,140
So if I have a vector A you most probably
saw the vector A as a directed line segment.
224
00:24:02,140 --> 00:24:07,289
So the arrow head indicates the direction.
The length of the line typically indicates
225
00:24:07,289 --> 00:24:14,620
the magnitude of the vector so it is a very
geometrical definition. So if I have 2 directed
226
00:24:14,620 --> 00:24:23,730
line segments A and B then we have defined
the sum of A and B using what you know already
227
00:24:23,730 --> 00:24:25,330
as a parallelogram law.
228
00:24:25,330 --> 00:24:37,730
So the resultant R, R equal to A plus B is
given by the parallelogram law. So that is
229
00:24:37,730 --> 00:24:42,029
all very nice. We can do the geometry, but
the whole point is to get to a some kind of
230
00:24:42,029 --> 00:24:46,919
an algebra so that we can do the manipulation
on paper rather than drawing figures and we
231
00:24:46,919 --> 00:24:50,549
will see how we do this. Then we can get to
manipulating things on the computers so that
232
00:24:50,549 --> 00:24:55,110
we do not have to draw for that, that is the
idea. So how do we get there?
233
00:24:55,110 --> 00:25:00,650
There is another critical thing that we define,
which is the dot product. A.B if you go back
234
00:25:00,650 --> 00:25:09,690
to your vector algebra the first time that
you learnt is magnitude A, this is definition
235
00:25:09,690 --> 00:25:20,080
magnitude B. cosine of the included cosine
of theta that angle is theta and incidentally
236
00:25:20,080 --> 00:25:28,890
this is equal to B.A if you just look at this
multiplication sorry about that B.A. So A.B
237
00:25:28,890 --> 00:25:36,730
is the same as B.A. How does this help? What
does this give up? Well this does something
238
00:25:36,730 --> 00:25:38,350
really (())(25:36).
239
00:25:38,350 --> 00:25:45,659
The first thing that I can do is, I can say
that I can ask a question what is A.A and
240
00:25:45,659 --> 00:25:54,960
A.A is magnitude A into magnitude A cos of
0 the angle between A and itself which is
241
00:25:54,960 --> 00:26:03,549
magnitude A square. So this is neat. Now what
we basically have is an expression for magnitude
242
00:26:03,549 --> 00:26:13,010
A, which is A.A square root. So previously
we were measuring lengths at some point we
243
00:26:13,010 --> 00:26:15,510
will actually have to measure length so you
have to get that magnitude somehow.
244
00:26:15,510 --> 00:26:20,590
But right now as I long as you had the (())(26:17)
say it is A in the magnitude of A. That is
245
00:26:20,590 --> 00:26:29,100
the algebra part is given by square root of
A.A and of the consequence there are need
246
00:26:29,100 --> 00:26:33,270
things that you can do. You can define a unit
vector when I use the cap to indicate that
247
00:26:33,270 --> 00:26:42,820
it is a unit vector as A divided by magnitude
A and as a consequence you can have something
248
00:26:42,820 --> 00:26:48,840
called a unit vector that is along A, but
has magnitude 1.
249
00:26:48,840 --> 00:26:58,840
So clearly magnitude of the unit vector, magnitude
of A equal to 1 is that fine. So what have
250
00:26:58,840 --> 00:27:04,070
we got so far? So using this dot product let
us try to interpret what is A.B. What happens
251
00:27:04,070 --> 00:27:13,169
if I take A. b hat where b hat is a unit vector
along b when that is magnitude A magnitude
252
00:27:13,169 --> 00:27:21,320
b cos of theta. This is all a repetition of
stuff that you guys know so which is magnitude
253
00:27:21,320 --> 00:27:27,149
A cos theta which is nothing but the projection
of A on to B.
254
00:27:27,149 --> 00:27:31,150
So this is a geometrical interpretation that
you are aware of, but what I really want to
255
00:27:31,150 --> 00:27:39,519
do and this is the great thing is if I can
start off with R equals A plus B I get R from
256
00:27:39,519 --> 00:27:46,210
A and B. is it possible for me given R to
write them in terms to write R in terms of
257
00:27:46,210 --> 00:27:51,530
A and B can I decompose it into A and B. Is
it possible for me to decompose it into components,
258
00:27:51,530 --> 00:27:56,740
just like we have done here? As I said this
is a (())(27:55) of all the vector algebra
259
00:27:56,740 --> 00:28:00,860
that you know. I am going through this process
simply because I propose to repeat this process
260
00:28:00,860 --> 00:28:05,340
for functions. So you just bare with me for
that.
261
00:28:05,340 --> 00:28:13,690
So the question is if I have R or if I have
a P, if I have R so is it possible for me
262
00:28:13,690 --> 00:28:28,480
to write R as some R sub A A plus R sub B
B. This is a component along A and this is
263
00:28:28,480 --> 00:28:34,220
a component along B fine or is it possible
for me to write it in terms of unit vectors.
264
00:28:34,220 --> 00:28:41,750
Note the case, this is lower case Raa plus
Rbb. So I will start with the second case
265
00:28:41,750 --> 00:28:48,539
first because that little easier. So what
do we do? The only operations that we have
266
00:28:48,539 --> 00:28:50,070
a vector sums and dot product.
267
00:28:50,070 --> 00:28:54,090
You have defined the dot product it is very
clear that you can take the dot product here.
268
00:28:54,090 --> 00:29:12,230
So let us take the dot product of R and A.
So R.A gives me Ra a.a plus Rb b.a and R.b
269
00:29:12,230 --> 00:29:31,929
I think the dot product with b gives me Rb
b.b. plus I am sorry I am going mad Ra a.b
270
00:29:31,929 --> 00:29:44,720
plus Rb b.b. So those of you have fluid mechanics
with me you will recognize a.a, b.a, a.b,
271
00:29:44,720 --> 00:29:48,220
b.b. as metric tensor for the rest of you
it does not really matter.
272
00:29:48,220 --> 00:29:54,549
So basically what we have had here is what
you have is if a.a is a unit vector this becomes
273
00:29:54,549 --> 00:30:00,600
1. If this, they are unit vectors, but we
do not know, what is the angle between them,
274
00:30:00,600 --> 00:30:12,890
so we are left with this. So in fact R. a
this can be rewritten as Ra plus Rb into b.a
275
00:30:12,890 --> 00:30:18,730
and please remember b.a and a.b are the same.
They are just said that as part of the definition
276
00:30:18,730 --> 00:30:28,460
so this is Ra into a.b or b.a it does not
matter plus Rb.
277
00:30:28,460 --> 00:30:33,470
So what we have is we have a system of equations
that we need to solve for Ra and Rb and once
278
00:30:33,470 --> 00:30:38,429
you solve that system of equation (())(30:35)
we can go back and do this representation.
279
00:30:38,429 --> 00:30:44,399
So that looks like a neat possibility, but
of course you know that there is 1 condition
280
00:30:44,399 --> 00:30:52,710
where a.b or b.a is 0 and that is when they
are orthogonal to each other. So if a and
281
00:30:52,710 --> 00:30:57,640
b are orthogonal to each other if you go back
to the definition I will write.
282
00:30:57,640 --> 00:31:06,710
If a is orthogonal to b and in fact they are
orthonormal if a is orthogonal to b. A.b equal
283
00:31:06,710 --> 00:31:23,289
to 0 so that it gives me R.a is Ra and R.b
is Rb which of course tells you why we spent
284
00:31:23,289 --> 00:31:27,110
so much time trying to get an orthogonal coordinate
system thus you get along in CFD you will
285
00:31:27,110 --> 00:31:31,530
see that it is done very often we desperately
try to get orthogonal coordinate systems.
286
00:31:31,530 --> 00:31:37,600
So that is fine. So you have a situation here
where a and b are orthogonal so it is Ra and
287
00:31:37,600 --> 00:31:43,380
Rb. What is they are not orthogonal what if
the initial set not orthogonal.
288
00:31:43,380 --> 00:31:51,730
So if we constrain ourselves to the board
and somebody gives us 2A and Bs which are
289
00:31:51,730 --> 00:31:57,590
in this fashion. They are not orthogonal to
each other that is you take A.B and you discover
290
00:31:57,590 --> 00:32:04,860
that A.B is not orthogonal is not 0 meaning
that A.B are not orthogonal. I and D are not
291
00:32:04,860 --> 00:32:13,100
orthogonal how what do we do. So clearly of
course they cannot be you do not want them
292
00:32:13,100 --> 00:32:18,809
to be collinear, but if they are not orthogonal
and you will see why you do not want them
293
00:32:18,809 --> 00:32:28,110
to collinear. What you can do is you can choose
the first vector so we can use P as we want.
294
00:32:28,110 --> 00:32:35,980
So I will use P hat 1. This is the first vector.
This vector is going to form the basis for
295
00:32:35,980 --> 00:32:42,280
my representation. So I want to look for an
orthogonal basis. So there if a and b are
296
00:32:42,280 --> 00:32:48,159
orthogonal a and b form an orthogonal basis
I want to try to get an orthogonal basis from
297
00:32:48,159 --> 00:32:55,929
here. So I will set P1 hat to in fact A by
mod A may be wondering why did not I just
298
00:32:55,929 --> 00:33:02,570
choose A hat, but I will show you why. What
do we do now?
299
00:33:02,570 --> 00:33:08,639
So how do I get if B is not orthogonal to
A how do I get something that is orthogonal
300
00:33:08,639 --> 00:33:16,320
to P1 hat. So what I need to do is from B
I need to take out the component that is along
301
00:33:16,320 --> 00:33:33,761
A. So if I find B.P1 the question is what
is B.P1 is the component along P1 of B. This
302
00:33:33,761 --> 00:33:40,320
multiplied by P1 gives me the component basically
in vector form. In fact this would be the
303
00:33:40,320 --> 00:33:50,059
component along P1 so this is in the vector
along P1 which is the part of B that is along
304
00:33:50,059 --> 00:33:51,539
P1.
305
00:33:51,539 --> 00:33:58,740
And if I subtract from B, if I subtract this
out right I knock this part out what I am
306
00:33:58,740 --> 00:34:11,240
left with is a P2 and this is a vector right
not a unit vector, a vector. So the question
307
00:34:11,240 --> 00:34:24,090
is what is P2.P1? If you look at P2.P1, P2.P1
gives me from here just take a look P2.P1
308
00:34:24,090 --> 00:34:37,090
gives me B.P1 minus B.P1, P1.P1 which is 1
and (())(34:35) these 2 will cancel giving
309
00:34:37,090 --> 00:34:46,850
me that P2 is in fact orthogonal to P1 hat.
Therefore my P2 hat is nothing but P2 by magnitude
310
00:34:46,850 --> 00:34:49,700
of P2 is that fine.
311
00:34:49,700 --> 00:34:54,910
So now given A and B that were not orthogonal
to start with what we have managed to do is
312
00:34:54,910 --> 00:35:00,660
find the P1 hat and P2 hat that are orthogonal
to each other and from here on we can ask
313
00:35:00,660 --> 00:35:08,820
the question given an R is it possible for
us to find an R1 along P1 because R2 along
314
00:35:08,820 --> 00:35:21,110
P2 so that R1P1 plus R2P2 equal to R, the
vector R. Is that okay? Right I think what
315
00:35:21,110 --> 00:35:27,760
we have done right now is we have come up
with the mechanism by which we are able to
316
00:35:27,760 --> 00:35:30,410
generate this in 2 dimensions.
317
00:35:30,410 --> 00:35:36,000
What do we do in 3 dimensions what if I add
1 more dimensions. Right what if I had a C
318
00:35:36,000 --> 00:35:41,810
that was not in the plane made up of A and
B that is not in the plane of a black board,
319
00:35:41,810 --> 00:35:48,920
but C actually comes out of the black board
so what is that we do in that case and it
320
00:35:48,920 --> 00:35:51,950
is not orthogonal to the black board. So what
I had.
321
00:35:51,950 --> 00:36:00,080
I have a B, A clearly not perpendicular to
each other and I have C that is not orthogonal
322
00:36:00,080 --> 00:36:05,400
to the black board, but that is a angle. So
what is that I am going to do in this case?
323
00:36:05,400 --> 00:36:15,700
So I already have I have got my P1 hat, I
have got my P2 hat so from C, I need to find
324
00:36:15,700 --> 00:36:19,960
out that component of C that is along P2 and
find out that component of C that is along
325
00:36:19,960 --> 00:36:31,610
P1 and subtract them out so it is the same
process. So I can take C.P1 hat plus C.P2
326
00:36:31,610 --> 00:36:35,320
hat.
327
00:36:35,320 --> 00:36:42,730
So this would be that part of C that is in
the plane. So if I have a vector that is sticking
328
00:36:42,730 --> 00:36:49,210
out of the board then C.P1 hat and C.P2 hat
is a shadow that is cast on the board. So
329
00:36:49,210 --> 00:36:56,240
this is the perpendicular part component that
is on the board. So this combination right
330
00:36:56,240 --> 00:37:04,200
if you call it P3, did I call it P3 last time,
what did I call it. I did not call it anything.
331
00:37:04,200 --> 00:37:09,960
So I will not call it anything. So I do not
want to make a mistake and if subtract this
332
00:37:09,960 --> 00:37:11,570
combination out of C.
333
00:37:11,570 --> 00:37:22,080
I will call this result P3 and you have to
ask ourselves the question what is P3.P1 hat
334
00:37:22,080 --> 00:37:31,610
and what is P3.P2 hat and if there in mind
that P1 hat and P2 hat are orthogonal to each
335
00:37:31,610 --> 00:37:37,600
other? So clearly if you go through this process
I will let you do it for yourselves clearly
336
00:37:37,600 --> 00:37:47,490
P1 hat and P2 hat are orthogonal to P3 and
from P3 now we can come up with the P3 hat
337
00:37:47,490 --> 00:37:57,630
which is P3 by modulus of P3 and you also
understand why it is that I have actually
338
00:37:57,630 --> 00:38:01,410
come up with numbers instead of alphabet.
339
00:38:01,410 --> 00:38:05,360
So it is actually possible for us that if
we have multiple dimensions. I have not restricted
340
00:38:05,360 --> 00:38:10,660
to 3 physical dimensions that we are talking
about, but if you have n multiple dimensions
341
00:38:10,660 --> 00:38:17,500
it is actually possible for us now to systematically
go through each one to get an orthogonal set.
342
00:38:17,500 --> 00:38:22,380
This is not really numerically if you are
dealing with actual vectors great way to do
343
00:38:22,380 --> 00:38:38,180
it, but this is called a
344
00:38:38,180 --> 00:38:41,580
Gram-Schmidt process and as I said so it does
not matter.
345
00:38:41,580 --> 00:38:44,940
It is not restricted to 2 dimensions or 3
dimensions. You can go to as many dimensions
346
00:38:44,940 --> 00:38:49,490
as you want. So clearly if you go to the fourth
one then you can knock out the components
347
00:38:49,490 --> 00:38:55,120
that would correspond to the first 3 and that
results in something that is orthogonal to
348
00:38:55,120 --> 00:39:03,390
each one of them so it a neat process. So
this now leads us to a situation where we
349
00:39:03,390 --> 00:39:23,870
are able to what should I say, we are able
to construct vectors of any kind so
350
00:39:23,870 --> 00:39:30,560
if you want what should I say.
351
00:39:30,560 --> 00:39:36,820
If you want something like 3x square plus
2x plus 1 like that earlier and we have 3i
352
00:39:36,820 --> 00:39:43,240
plus 2j plus k we just need to ask ourselves
a question well I have got I know how I have
353
00:39:43,240 --> 00:39:48,280
done it here, how is that we are going to
go about doing it here. So this systematic
354
00:39:48,280 --> 00:40:01,970
organization now I am going to do it for functions
we will go through a series of class of functions.
355
00:40:01,970 --> 00:40:11,780
In next class, I will basically start with
Box functions. So what I will do here is I
356
00:40:11,780 --> 00:40:19,390
will stop at this point and get back to Box
function and so on. So in the next class what
357
00:40:19,390 --> 00:40:24,290
we will do is we will try to represent these
functions as a we show representations of
358
00:40:24,290 --> 00:40:28,800
these functions of various kinds and what
is the relevant accuracy that goes with it?