1
00:00:00,450 --> 00:00:06,150
So in the previous lectures, we have spent a lot of time with solving this particular example of considering

2
00:00:06,150 --> 00:00:12,810
three harmonic oscillators that are couples, and it turned out that the numerical solution was quite

3
00:00:13,020 --> 00:00:13,620
difficult.

4
00:00:13,650 --> 00:00:18,390
So at first we could just say, OK, this is the solution, but we don't really know what it means.

5
00:00:19,140 --> 00:00:25,830
But then we established the eigenvalue problem and solved the equation for the eigenvalues, which told

6
00:00:25,830 --> 00:00:27,900
us the ion frequencies.

7
00:00:28,560 --> 00:00:33,690
And we've seen that we can rediscover his ion frequencies in the four you transform.

8
00:00:34,560 --> 00:00:42,030
And even we can take these characteristic frequencies and build harmonic functions and then superimpose

9
00:00:42,030 --> 00:00:43,260
these three functions.

10
00:00:43,660 --> 00:00:50,070
We've seen that when we fit the parameters, then we can even restore the numerical solution.

11
00:00:50,910 --> 00:00:55,830
So everything, everything makes total sense and everything agrees well with each other.

12
00:00:55,830 --> 00:01:01,350
And we have practiced here a lot of the previous topics that we have discussed early on.

13
00:01:02,790 --> 00:01:09,360
So a bonus lecture that I want to show you here is that we can generalize the whole thing not only for

14
00:01:09,360 --> 00:01:13,050
this system with three oscillators, but four and oscillators.

15
00:01:13,680 --> 00:01:15,600
And here I want to show you this.

16
00:01:16,110 --> 00:01:17,840
So we will solve it numerically.

17
00:01:17,850 --> 00:01:21,810
We will calculate the ion frequencies and we will calculate the full year transform.

18
00:01:22,710 --> 00:01:26,280
And the nice thing is we don't really have to change any of the code.

19
00:01:26,730 --> 00:01:28,890
So just really tiny changes.

20
00:01:29,310 --> 00:01:36,000
And the only thing that we really have to change here is the definition, of course, of the equations

21
00:01:36,000 --> 00:01:36,600
of motion.

22
00:01:37,020 --> 00:01:38,320
So there's a we will do first.

23
00:01:38,340 --> 00:01:43,680
So I will write Def F and see if I would have written down here.

24
00:01:43,680 --> 00:01:45,690
Three O C, we wouldn't have to change anything.

25
00:01:46,350 --> 00:01:48,750
But I want to keep the old results.

26
00:01:48,750 --> 00:01:56,640
So please make sure that whenever we wrote three and a c right note and or C, and the other thing that

27
00:01:56,640 --> 00:02:00,570
we have to change for the eigen frequency is the definition of a.

28
00:02:01,590 --> 00:02:07,140
So this is what I will do first and then we can just run the whole thing and see if this works also

29
00:02:07,140 --> 00:02:09,120
for a general revised version.

30
00:02:09,750 --> 00:02:17,010
And as an example, I will choose here already quite a difficult set up here with 20 oscillators.

31
00:02:18,120 --> 00:02:22,080
So function will, of course, again have the arguments T and Y.

32
00:02:22,620 --> 00:02:25,470
And now we have to think, how can we generalize this?

33
00:02:26,340 --> 00:02:32,940
First of all, since we have now so many equations, I will write our is equal to y from zero to end

34
00:02:34,320 --> 00:02:45,030
and then the value will be y from end to to end.

35
00:02:47,570 --> 00:02:54,360
And the equations will I will, of course, not define explicitly because we don't know how many equations

36
00:02:54,360 --> 00:03:03,030
we will have, this depends on the value of and so I will start with and p zero of 10 so that we start

37
00:03:03,030 --> 00:03:04,470
with some blank equations.

38
00:03:04,980 --> 00:03:16,620
And then I will write equation the second until the second last equation will be equal to minus our.

39
00:03:20,270 --> 00:03:29,900
The first equation until the minus two, so basically leave out the last two and plus two times are

40
00:03:30,920 --> 00:03:33,920
one to minus one and then minus.

41
00:03:35,610 --> 00:03:39,510
Are two to the last one.

42
00:03:41,490 --> 00:03:50,130
So this is what we have also seen in The Matrix, basically all the entries, except for the first and

43
00:03:50,130 --> 00:03:54,030
last one, will have to form minus one to minus one.

44
00:03:54,150 --> 00:03:59,220
And then many zeros, if we have more of these oscillators than we get when we go to the next one,

45
00:03:59,220 --> 00:04:01,500
we shift these three numbers wants to the right.

46
00:04:02,530 --> 00:04:05,700
And this is what we have programmed here, exactly.

47
00:04:06,510 --> 00:04:11,670
So for every one of the middle equations, which means everyone except the first and the last one,

48
00:04:12,240 --> 00:04:13,800
the equation will look like this.

49
00:04:14,700 --> 00:04:20,579
And then we have to explicitly define the first and the last one, which will be equation zero, because

50
00:04:20,579 --> 00:04:21,930
here it will be a bit different.

51
00:04:22,320 --> 00:04:28,500
So there will be two times are zero minus are of one.

52
00:04:29,340 --> 00:04:40,320
And then for the last one equation and minus one will be minus are off and minus two to the left neighbor.

53
00:04:40,950 --> 00:04:47,550
And then the two later itself will be two times out of and minus one.

54
00:04:48,870 --> 00:04:51,240
And then we have no right neighbors, so that's it.

55
00:04:52,030 --> 00:04:53,160
But then we must return.

56
00:04:54,120 --> 00:05:02,390
First of all, the values and then the equations, and we are missing still the factor.

57
00:05:02,400 --> 00:05:05,880
So I wrote here minus K over m times equations.

58
00:05:07,110 --> 00:05:11,250
So since these are lists and these are lists, we have to merge these lists.

59
00:05:11,250 --> 00:05:14,790
So I write here and p dot concatenate.

60
00:05:15,330 --> 00:05:17,160
And then it should work, I think.

61
00:05:17,670 --> 00:05:21,120
But of course, here we are missing the brackets.

62
00:05:21,360 --> 00:05:27,700
OK, now let's run it and you see we get a nice solution.

63
00:05:27,720 --> 00:05:33,810
We have now 20 oscillators, and you see this motion looks very difficult.

64
00:05:34,350 --> 00:05:39,300
But we also know that we could calculate the eigen frequencies, which we will do next.

65
00:05:39,780 --> 00:05:47,910
And so we could recover each of these 20 oscillators by just superimposing of 20 harmonic functions

66
00:05:47,910 --> 00:05:49,680
with the 20 eigen frequencies.

67
00:05:50,640 --> 00:05:55,620
So let's go ahead and program the matrix and then calculate the EIGEN frequencies.

68
00:05:56,370 --> 00:05:59,360
So a would be it.

69
00:05:59,380 --> 00:06:03,000
That's something we will also encounter in a different lecture.

70
00:06:03,330 --> 00:06:11,100
There's always a nice trick when you have such and such matrices that almost the zero and only have

71
00:06:11,100 --> 00:06:16,380
values on the diagonal and then on the other diagonal right next to it.

72
00:06:17,580 --> 00:06:21,660
So basically, we will just define this diagonal, this diagonal on this one.

73
00:06:22,050 --> 00:06:32,070
And then we will use a command that is called and pitot diak and here will show you how this works.

74
00:06:33,100 --> 00:06:38,070
He write, for example, minus one times.

75
00:06:40,750 --> 00:06:41,710
And minus one.

76
00:06:42,490 --> 00:06:48,610
So this would be just by itself, a list of minus one.

77
00:06:48,700 --> 00:06:53,680
And this whole thing 19 times in this case, this would be not the main diagonal, but the one the right

78
00:06:53,680 --> 00:06:54,280
next to it.

79
00:06:54,820 --> 00:07:00,160
And since it's not the main diagonal, we right k is equal to one.

80
00:07:01,180 --> 00:07:11,230
So if I call this, you see we have here these this vector here, not on the main diagonal, but on

81
00:07:11,230 --> 00:07:12,670
the one right next to it.

82
00:07:13,690 --> 00:07:15,250
Then we can add another one.

83
00:07:16,270 --> 00:07:20,490
Copy this and now our right here, plus two times.

84
00:07:20,560 --> 00:07:26,140
And because this is not a main diagonal, so it has and trees and key is equal to zero, this is to

85
00:07:26,140 --> 00:07:26,650
shift.

86
00:07:27,700 --> 00:07:31,060
And so now we have on the main diagonal a lot of twos.

87
00:07:31,600 --> 00:07:33,400
And so only one thing is left.

88
00:07:33,770 --> 00:07:39,340
This is the other one of those minus one.

89
00:07:40,960 --> 00:07:43,480
And now it works.

90
00:07:43,480 --> 00:07:48,610
Yeah, because here in the second line, we start with minus one to minus one.

91
00:07:49,180 --> 00:07:54,940
And then it shifts the indices zero minus one to minus one until in the last line, we have a lot of

92
00:07:54,940 --> 00:07:56,740
zeros and then minus one and two.

93
00:07:57,580 --> 00:08:03,340
And we know that we get our ion frequencies by just calculating the square root of the eigenvalues and

94
00:08:03,340 --> 00:08:06,220
multiplying by square root of K over them.

95
00:08:07,420 --> 00:08:10,870
So you see, we have a whole lot of eigenvalues here.

96
00:08:13,200 --> 00:08:16,020
Now we can continue and calculate the Fourier transform.

97
00:08:16,470 --> 00:08:23,670
So here you only have to be careful because you have to change the solution three o c to solution and

98
00:08:23,670 --> 00:08:28,860
our C because this is what we have named it, and then we can just go ahead.

99
00:08:31,190 --> 00:08:36,450
And look at the frequencies, so here I've plotted several different things.

100
00:08:36,470 --> 00:08:43,760
The first one would be the four you transform only of the first oscillator, which has the peaks, which

101
00:08:43,760 --> 00:08:48,080
should correspond to these values that we have here.

102
00:08:48,680 --> 00:08:54,980
For example, we can check we have here several values below zero at zero point one five zero point

103
00:08:54,980 --> 00:08:57,800
three zero point four four five.

104
00:08:58,370 --> 00:09:04,400
And this one here, for example, would be 0.3 zero point one five zero point four five.

105
00:09:04,850 --> 00:09:07,940
The next one would be slightly above zero point five.

106
00:09:08,570 --> 00:09:10,230
This would probably be this one.

107
00:09:10,310 --> 00:09:14,900
So you see each of these eigen frequencies is indeed in the four you transform.

108
00:09:16,070 --> 00:09:22,800
And then the second plot for the second plot I've used here a loop where I loop over all of these oscillators.

109
00:09:22,850 --> 00:09:28,700
So here you see the different colors to different oscillators, and you see they have peaks at the same

110
00:09:28,700 --> 00:09:32,690
frequencies, of course, but the amplitudes can be a bit different.

111
00:09:33,020 --> 00:09:40,790
And this we have also seen already for the three example case and maybe even some of the some of the

112
00:09:40,910 --> 00:09:43,720
coefficients of the eigenvectors on zero.

113
00:09:43,730 --> 00:09:47,690
So then in this case, there would be no peak for this particular oscillator.

114
00:09:49,220 --> 00:09:55,940
And then the last thing would be the same thing as here, but zoomed in, and you can really see that

115
00:09:55,940 --> 00:10:02,690
we have these peaks at zero point fifteen zero point three zero point forty five and then another one

116
00:10:02,690 --> 00:10:10,040
here at zero point five eight, which are exactly these eigen frequencies that we see here.

117
00:10:11,240 --> 00:10:16,250
So you see the with the tools that we have, we can very quickly solve new problems.

118
00:10:16,580 --> 00:10:22,820
And you see, we have not generalized the problem to 20 oscillators, which is, of course, if you

119
00:10:22,820 --> 00:10:28,460
would want to solve it analytically by hand would be impossible to do.

120
00:10:29,180 --> 00:10:31,730
But with our methods that we have established, it's very easy.

121
00:10:31,730 --> 00:10:34,700
And you see, still, everything agrees very well.

122
00:10:35,180 --> 00:10:36,800
We have the miracle solution.

123
00:10:37,250 --> 00:10:38,660
We have the eigen frequencies.

124
00:10:38,660 --> 00:10:41,920
We have to fully transform and we could even do to fit.

125
00:10:41,930 --> 00:10:48,590
But I want I don't want to do this now because this was just be a time consuming and we know that it

126
00:10:48,590 --> 00:10:49,490
would work, of course.

