1
00:00:00,510 --> 00:00:07,890
So we know that the solution for the eigenvalues of the Matrix eight are these three values here and

2
00:00:07,890 --> 00:00:13,050
now I will show you my solution and how we can program such a routine ourself.

3
00:00:14,460 --> 00:00:19,620
So if you want to first have a hint, you can look at these equations here.

4
00:00:19,620 --> 00:00:22,800
So this is actually how you would do it analytically.

5
00:00:23,460 --> 00:00:24,900
So we have to solve this equation.

6
00:00:24,900 --> 00:00:30,420
Zero is equal to the determinant of a minus lambda times the identity matrix.

7
00:00:30,960 --> 00:00:33,930
And so this means we have to solve this equation here.

8
00:00:34,920 --> 00:00:40,530
And first of all, you have to calculate the determinant of just three three make matrix, which is

9
00:00:40,620 --> 00:00:44,220
maybe not so easy if you don't remember how to do it from math.

10
00:00:45,150 --> 00:00:51,590
So there are several ways to do it, but one of them would be to take this factor here to mine has alarmed

11
00:00:51,600 --> 00:00:59,040
at times determinant of this matrix, which I've written down here, minus this factor here, minus

12
00:00:59,040 --> 00:01:06,150
one times two determinant of this matrix, which would be this one here and then plus zero times the

13
00:01:06,150 --> 00:01:07,410
determinant of this matrix.

14
00:01:07,410 --> 00:01:09,390
But since it's zero, we can leave it.

15
00:01:10,470 --> 00:01:15,930
And then you calculate these determinants, which would be this time this this minus those times.

16
00:01:15,930 --> 00:01:23,730
This so would be two minus lambda squared minus minus one squared.

17
00:01:23,910 --> 00:01:32,190
If we multiply it with two minus lambda, we get to minus the two the power of three minus one times

18
00:01:32,190 --> 00:01:33,000
two minus lambda.

19
00:01:33,540 --> 00:01:38,100
And from here we get minus minus one.

20
00:01:38,100 --> 00:01:44,820
That's +1, and then here minus one times two minus lambda, minus zero times minus one, which is zero.

21
00:01:44,820 --> 00:01:46,350
So we just get the single term.

22
00:01:46,980 --> 00:01:52,680
Then we have to calculate here the cube, which would be two to the power of three, which is eight.

23
00:01:53,640 --> 00:02:02,270
Then we have two squared times minus Lambda Times three, which is minus 12 lambda.

24
00:02:02,280 --> 00:02:11,250
Then we have three times two times lambda squared, which is this one here, six squared and we have

25
00:02:11,250 --> 00:02:13,770
minus lambda two the power of three, which is this one.

26
00:02:14,400 --> 00:02:17,100
And then we have here more terms.

27
00:02:18,990 --> 00:02:21,750
Yeah, basically these ones here that you see.

28
00:02:23,370 --> 00:02:29,640
And then we have to just cancel these terms and this will in the end, be the polynomial for which we

29
00:02:29,640 --> 00:02:32,010
have to calculate the roots, the zeros.

30
00:02:32,730 --> 00:02:34,290
So this is what you have to program.

31
00:02:34,650 --> 00:02:40,240
And now my solution would be first to find a function called determined.

32
00:02:40,800 --> 00:02:45,930
First of all, the Terminal three, hey, where is the matrix?

33
00:02:46,470 --> 00:03:00,750
And we have now, as I told you, the three terms term one is a zero zero times a 1:1, times a two

34
00:03:00,750 --> 00:03:07,170
to minus a one to a two one.

35
00:03:09,120 --> 00:03:14,400
So that would be a zero zero, and this would be the determinant of this matrix here.

36
00:03:14,700 --> 00:03:23,490
So it would be this times, this minus this times, this, then we have term two and this November,

37
00:03:23,510 --> 00:03:28,810
similar, of course, this would be a one zero times.

38
00:03:29,040 --> 00:03:31,530
Now let me copy this and just fixed the indices.

39
00:03:31,950 --> 00:03:36,750
So would be zero one two two zero two two one.

40
00:03:37,440 --> 00:03:42,240
And then now we can copy this one more time and fixed the indices.

41
00:03:42,960 --> 00:03:47,580
And of course, now we have here eight to zero, which would be this element.

42
00:03:47,610 --> 00:03:50,130
So in our case, this would not contribute.

43
00:03:50,130 --> 00:03:56,040
But of course, we will program it anyway because we want to want it to be correct for all other matrices

44
00:03:56,040 --> 00:03:56,430
as well.

45
00:03:57,180 --> 00:04:00,120
So we fixed the indices and I think.

46
00:04:02,400 --> 00:04:03,840
This is what we have now.

47
00:04:04,410 --> 00:04:04,710
Yeah.

48
00:04:06,240 --> 00:04:06,660
OK.

49
00:04:07,620 --> 00:04:09,300
So I hope this is correct.

50
00:04:09,330 --> 00:04:12,690
Maybe I have a typo, but yeah, I think it looks good.

51
00:04:13,950 --> 00:04:14,190
Yeah.

52
00:04:14,880 --> 00:04:17,970
Let's see if it gets the correct value because we know that this is correct.

53
00:04:17,980 --> 00:04:21,959
So in the end, if it gives the correct value, then probably we did everything right.

54
00:04:23,130 --> 00:04:30,390
So now we must define the so-called characteristic polynomial, which would be this one.

55
00:04:31,230 --> 00:04:36,000
So I just write a definition characteristic

56
00:04:37,260 --> 00:04:45,770
polynomial x would be return determinant.

57
00:04:45,870 --> 00:04:54,960
Three of a minus x times and P taught identity.

58
00:04:55,860 --> 00:04:56,280
Three.

59
00:04:57,280 --> 00:05:03,270
So this would now be the determinant of a minus lambda times one matrix, which should give us this

60
00:05:03,270 --> 00:05:03,720
one here.

61
00:05:04,920 --> 00:05:10,890
Just one more thing I see I forgot to write the return, which is, of course, then term one minus

62
00:05:10,890 --> 00:05:11,500
term two.

63
00:05:11,520 --> 00:05:13,610
This is how the determinant is calculated.

64
00:05:13,620 --> 00:05:15,660
Plus term three.

65
00:05:17,520 --> 00:05:17,910
OK.

66
00:05:18,150 --> 00:05:19,830
So redefine it.

67
00:05:19,990 --> 00:05:21,000
Define this one.

68
00:05:21,210 --> 00:05:24,000
And now we can try to find the root.

69
00:05:24,150 --> 00:05:26,690
First of all, let me see if we get any arrows.

70
00:05:26,690 --> 00:05:33,180
So let's just hold this for some random value X gives us minus one.

71
00:05:33,450 --> 00:05:35,910
And by the way, we know what the correct solutions are.

72
00:05:35,940 --> 00:05:39,630
For example, two is one of the solutions, so it should give us zero now.

73
00:05:40,510 --> 00:05:41,880
Yes, it goes zero.

74
00:05:41,880 --> 00:05:43,140
So it seems to be correct.

75
00:05:43,140 --> 00:05:54,000
And we can also test the other one, which is looks like two plus square root of two to parse and Peter's

76
00:05:54,150 --> 00:05:55,230
Square root of two.

77
00:05:56,370 --> 00:05:56,970
OK, yeah.

78
00:05:56,980 --> 00:05:57,960
Gives also zero.

79
00:05:57,970 --> 00:05:59,850
So it seems as we are on the right track.

80
00:06:00,930 --> 00:06:03,930
Of course, this is a bit cheating to compare it with the correct results.

81
00:06:03,930 --> 00:06:06,480
But yeah, it's just a practice.

82
00:06:07,140 --> 00:06:10,260
And now we can define another routine to find the root.

83
00:06:11,850 --> 00:06:17,550
And here we need, of course, our function, which will be characteristic polynomial.

84
00:06:18,270 --> 00:06:21,240
Then we need the number of routes.

85
00:06:22,320 --> 00:06:28,790
Since it's a polynomial, it has three routes which could be imaginary or complex, but here they are

86
00:06:28,800 --> 00:06:29,220
real.

87
00:06:29,220 --> 00:06:32,330
So we don't have to be that careful here.

88
00:06:32,340 --> 00:06:36,990
So yeah, we will just do it in a bit of a quick and dirty way here.

89
00:06:37,590 --> 00:06:44,730
Then we should specify some range in which the program is looking for the zeros and we have to go in

90
00:06:44,730 --> 00:06:45,350
steps.

91
00:06:45,360 --> 00:06:48,240
So I will add here parameter for the step, size.

92
00:06:49,140 --> 00:07:01,350
And yeah, let's just name these function than we have and number of.

93
00:07:04,220 --> 00:07:12,260
Roots than we have explained to S-Max is the range in.

94
00:07:13,050 --> 00:07:17,790
Which the roots are expected to be.

95
00:07:18,330 --> 00:07:28,950
And then we have start step, you know, starting value for the step size.

96
00:07:30,070 --> 00:07:35,780
Okay, so the idea of this routine is to basically scan through the range.

97
00:07:35,790 --> 00:07:43,830
So we start from examine and then we go in steps, which will in the beginning be step size two x max.

98
00:07:44,520 --> 00:07:48,600
And then we look if the function F has changed at the sign.

99
00:07:49,710 --> 00:07:53,640
So what we specify is a starting value for X.

100
00:07:54,570 --> 00:07:55,830
This will, of course, be X-Men.

101
00:07:56,430 --> 00:08:01,140
And also we will change the accuracy.

102
00:08:01,140 --> 00:08:08,010
So of course, we could just say whenever the function changes that sign, then one of the two values

103
00:08:08,010 --> 00:08:10,360
where it changes design is the route.

104
00:08:10,860 --> 00:08:13,980
This would be reasonable, but the accuracy would be kind of bad.

105
00:08:14,310 --> 00:08:21,030
So we will tune the step size during this routine during this process.

106
00:08:21,450 --> 00:08:26,820
So in the beginning, it will just be start step, but later on it can be adapted.

107
00:08:28,050 --> 00:08:32,020
So of course, in your solution, you don't have to do it exactly as I did.

108
00:08:32,039 --> 00:08:35,020
As long as you get the correct result, it's just fine.

109
00:08:35,020 --> 00:08:39,840
This is just my suggestion on how I would do it in a bit of a quick and dirty way.

110
00:08:41,309 --> 00:08:46,830
So then I told you that we will always compare to neighboring points and we will compare designs.

111
00:08:47,310 --> 00:08:57,900
So we need something like sign and sign B. And Sign A would be and P Dot sign off half of X.

112
00:08:58,410 --> 00:09:01,380
And in the beginning, sign of me will be the same thing.

113
00:09:01,380 --> 00:09:05,280
But we will, of course, then always go to the next point.

114
00:09:06,000 --> 00:09:08,460
So this is just like a starting value for this.

115
00:09:09,360 --> 00:09:12,290
And then we must also store the roots somewhere.

116
00:09:12,300 --> 00:09:14,820
So I make just an empty list for the roots.

117
00:09:15,900 --> 00:09:18,660
And now we will just make a loop.

118
00:09:19,290 --> 00:09:25,080
And first of all, we will, of course, loop until we have found three routes.

119
00:09:25,560 --> 00:09:27,990
But this is something we could add later on.

120
00:09:27,990 --> 00:09:32,340
Or maybe let me let me just write it here that we don't forget it.

121
00:09:32,700 --> 00:09:39,750
So while the length of route is still smaller than and so this means if we didn't have found already

122
00:09:39,750 --> 00:09:44,460
all three routes that we will specify here, then we will keep on looping.

123
00:09:45,060 --> 00:09:49,530
And so basically, this will loop three times until we have found all of the routes.

124
00:09:49,870 --> 00:09:51,390
And now comes the actual code.

125
00:09:51,910 --> 00:09:53,910
We will find each of these loops.

126
00:09:54,420 --> 00:09:59,430
So this would be while the accuracy is still large.

127
00:10:01,890 --> 00:10:04,140
So here we have to define just some small value.

128
00:10:05,250 --> 00:10:09,150
The smaller the value, the better the accuracy, but also the longer it will take.

129
00:10:09,750 --> 00:10:19,230
So maybe, for example, we could do this one, and now we will compare the sign of neighboring points.

130
00:10:20,460 --> 00:10:21,450
So here we will, right.

131
00:10:21,900 --> 00:10:24,780
While the sign of a.

132
00:10:27,640 --> 00:10:36,040
Is equal to the sign of peace, then we will keep looping them, basically, nothing happens because

133
00:10:36,040 --> 00:10:41,050
this means one sign off and sign off, be two neighboring points is still the same.

134
00:10:41,380 --> 00:10:44,860
Then we didn't encounter any route.

135
00:10:46,330 --> 00:10:50,080
So then we will basically do nothing and just go to the next point.

136
00:10:50,530 --> 00:10:58,870
So we will do the following sign eight is equal to sign B. Then we will make the Step X is X plus D

137
00:10:59,350 --> 00:11:07,270
and sign B will then be recalculated will be the and P dot sign of the new point.

138
00:11:08,500 --> 00:11:11,290
So now you see, in the beginning, both of them are the same.

139
00:11:11,290 --> 00:11:13,930
So this one gives us a true.

140
00:11:13,960 --> 00:11:18,190
So we will now enter this loop and we will keep on looping here.

141
00:11:18,760 --> 00:11:24,490
And what will happen then is we will basically go to the next point and calculate the sign.

142
00:11:24,580 --> 00:11:29,110
Now we have two different values for A and B, and now it keeps looping.

143
00:11:31,060 --> 00:11:35,350
So here it will always compare is to sign of a equal to be.

144
00:11:35,950 --> 00:11:41,860
If yes, then basically you go to the next point and shift the sign and sign B..

145
00:11:43,240 --> 00:11:48,520
OK, and when it's false, does means sign and sign B are different.

146
00:11:48,520 --> 00:11:53,680
This means a route must be between these two values of X and X plus d.

147
00:11:54,460 --> 00:12:07,540
So we will then decrease D whenever the sign changes until the desired accuracy is breached.

148
00:12:10,040 --> 00:12:15,560
So what we will do then, is when this is true, then we know that that between these two points X and

149
00:12:15,560 --> 00:12:18,530
X plus d must be a zero must be a root.

150
00:12:19,220 --> 00:12:22,220
So we go one step back and one step back.

151
00:12:24,200 --> 00:12:26,150
So we will decrease by D.

152
00:12:26,780 --> 00:12:38,210
Then we will reset, sign and sign P to the previous value and people to sign f off X minus D and sign

153
00:12:38,210 --> 00:12:39,260
B will be.

154
00:12:39,530 --> 00:12:43,010
And P dot sign f x.

155
00:12:44,750 --> 00:12:46,370
And we will decrease the value of D.

156
00:12:46,790 --> 00:12:52,970
For example, we could divide it by two or we could also just decrease it by one order of magnitude.

157
00:12:54,560 --> 00:12:59,660
Of course, it has differences in terms of performance, but yeah, I think it doesn't really matter

158
00:12:59,660 --> 00:13:00,140
that much.

159
00:13:01,190 --> 00:13:05,480
By the way, I just noticed that I forgot to make here a tab, so we have to fix.

160
00:13:05,630 --> 00:13:09,830
Of course, all of this now, otherwise it's not really in the loop.

161
00:13:11,030 --> 00:13:11,520
OK.

162
00:13:11,540 --> 00:13:12,050
Like this?

163
00:13:12,710 --> 00:13:16,010
And so this means now this is true.

164
00:13:16,190 --> 00:13:18,710
So we still loop.

165
00:13:18,710 --> 00:13:20,540
And then at one point, it will be false.

166
00:13:21,110 --> 00:13:24,530
So then the loop will end and then we will do this one here.

167
00:13:25,340 --> 00:13:34,820
And so then we will decrease the D value, which is in the beginning, start step and then we will basically

168
00:13:35,510 --> 00:13:36,380
loop here.

169
00:13:36,800 --> 00:13:43,460
So we will repeat this process until we have done this, maybe like two or three or four times.

170
00:13:43,790 --> 00:13:46,100
And then the D value is pretty, pretty small.

171
00:13:47,390 --> 00:13:53,780
So basically, we have encountered here arranged between X and X plus d where the route is.

172
00:13:54,170 --> 00:14:02,240
Then we go back to X minus D and decrease the accuracy and then search into small range once again with

173
00:14:02,240 --> 00:14:03,350
much smaller steps.

174
00:14:03,530 --> 00:14:10,160
And then we repeat this over and over until we have approximated the route by such an accuracy here.

175
00:14:11,390 --> 00:14:17,450
So now, if all of these loops have ended, we have found our route and we will then of course, store

176
00:14:17,450 --> 00:14:17,840
the route.

177
00:14:17,960 --> 00:14:22,490
So Store X in route.

178
00:14:23,900 --> 00:14:34,490
So it will just be route dots append x, then we will reset D to find the next route.

179
00:14:34,790 --> 00:14:48,980
So we will to D is equal to start step and then we will go to the next X and reset the signs.

180
00:14:49,820 --> 00:14:59,990
So X will be X plus de Signy will be around p dot sign f of X.

181
00:15:02,150 --> 00:15:03,840
And the same for same beat.

182
00:15:03,860 --> 00:15:06,650
So it is essentially the same as here.

183
00:15:08,690 --> 00:15:13,340
And then the last thing will, of course, be return the route.

184
00:15:14,270 --> 00:15:16,000
So last thing here is pretty easy.

185
00:15:16,010 --> 00:15:18,980
This is just after we have found a route.

186
00:15:18,980 --> 00:15:19,940
We will store it.

187
00:15:20,300 --> 00:15:23,370
Then we would go just a step here to the right.

188
00:15:23,420 --> 00:15:27,500
Reset the D sign a of is basically the same thing is here.

189
00:15:28,040 --> 00:15:32,030
And then we repeat the process until we have found all of the routes.

190
00:15:34,190 --> 00:15:36,670
Now I have a syntax arrow because I forgot.

191
00:15:36,680 --> 00:15:37,280
Here it is.

192
00:15:37,280 --> 00:15:38,030
Two dots.

193
00:15:38,960 --> 00:15:39,830
Let's see again.

194
00:15:40,100 --> 00:15:44,510
OK, now looks good and now we can test what we find.

195
00:15:44,900 --> 00:15:47,990
So I write find route.

196
00:15:50,230 --> 00:16:03,040
Car wreck terrorists take polynomial, MR Function, then we want to have three routes, then we know

197
00:16:03,040 --> 00:16:10,660
already the range for our routes would be this one here, so we will search it in the range of zero

198
00:16:10,660 --> 00:16:15,100
to four and then our starting step size.

199
00:16:15,100 --> 00:16:15,910
I don't know yet.

200
00:16:16,090 --> 00:16:17,530
We could try to follow it.

201
00:16:20,890 --> 00:16:28,420
And now we get an error because here I have a typo here.

202
00:16:32,070 --> 00:16:33,340
And now we run it again.

203
00:16:33,990 --> 00:16:43,860
And these are the solutions that we get, we get zero point five eight five seven, which is this one

204
00:16:44,190 --> 00:16:49,950
that we get to two and then we get three points for one, for just this one.

205
00:16:49,980 --> 00:16:50,220
Yeah.

206
00:16:50,730 --> 00:16:52,330
So you see, it really works.

207
00:16:52,350 --> 00:16:58,410
And of course, we could increase the accuracy by we could also cut this one.

208
00:16:58,410 --> 00:17:02,550
Here is another parameter which we could call goal accuracy.

209
00:17:03,660 --> 00:17:09,690
So, for example, if they adhere to zeros, then the accuracy will be even better.

210
00:17:11,069 --> 00:17:18,359
OK, so this was just a nice exercise, I think, for thinking about the routines.

211
00:17:18,359 --> 00:17:25,710
How could you find a loop and then also programming these functions here and how to calculate the determinant?

212
00:17:26,190 --> 00:17:32,760
So I hope you like this practice, even though it was, of course, a bit difficult in a technical sense.

213
00:17:33,210 --> 00:17:40,560
But I think, yeah, it wasn't really that difficult from the physical point of view, because in the

214
00:17:40,560 --> 00:17:45,840
end, it was just math and calculating routes and calculating determinants.

215
00:17:46,770 --> 00:17:54,180
So now after this exercise, we can finally continue and talk more about physics and what these eigenvalues

216
00:17:54,180 --> 00:17:54,930
actually mean.

