1
00:00:00,060 --> 00:00:05,970
So now we can finally start programming in the previous lecture, we have talked about the system and

2
00:00:05,970 --> 00:00:08,189
have figured out the equation of motion.

3
00:00:08,880 --> 00:00:13,650
And I think it's pretty important that we figure it out this matrix here because later on, we will

4
00:00:13,650 --> 00:00:17,940
calculate its eigenvalues and then discuss the meaning of these eigenvalues.

5
00:00:17,940 --> 00:00:22,710
And then you will understand why we can call this also an eigenvalue problem.

6
00:00:23,610 --> 00:00:26,700
But actually, you may say now, why should we do this?

7
00:00:27,000 --> 00:00:31,890
These are just couple differential equations, and we have learned already in the previous lectures

8
00:00:32,159 --> 00:00:33,300
how we can solve these.

9
00:00:33,840 --> 00:00:35,580
And this is, of course, totally true.

10
00:00:35,970 --> 00:00:42,420
And for this reason, we will now, in this particular lecture, solve these equations as we did before

11
00:00:42,660 --> 00:00:44,940
using our standard routines.

12
00:00:45,600 --> 00:00:51,870
So don't worry, I will not bore you with another whole section about these differential equations.

13
00:00:51,900 --> 00:00:56,400
This will just be a single lecture where we will just practice what we've learned before, and I will

14
00:00:56,400 --> 00:00:59,220
show you that we can pretty easily solve these.

15
00:00:59,370 --> 00:01:05,129
Now that we know how it's done, so we shouldn't lose any time, let's go ahead and find, first of

16
00:01:05,129 --> 00:01:08,670
all, the constants case equal to one am as equal to one.

17
00:01:09,150 --> 00:01:12,930
And then we must, of course, define the system of two differential equations.

18
00:01:13,260 --> 00:01:18,690
So I call the function f underscore three oscillators and parameters.

19
00:01:18,690 --> 00:01:26,760
Artie, which does not explicitly enter here, but you remember the integrated solve IBP routine requires

20
00:01:26,760 --> 00:01:29,640
two time argument and then the coordinate argument.

21
00:01:29,850 --> 00:01:32,910
So this is how we always did it and we will do it here as well.

22
00:01:34,110 --> 00:01:37,320
So now we must return some function.

23
00:01:37,920 --> 00:01:44,520
And of course, we want to return here to equate to the right and side of these equations.

24
00:01:44,550 --> 00:01:51,450
So basically these three equations here, but hopefully you also remember that it's not so easy if you

25
00:01:51,450 --> 00:01:53,400
have a second order differential equation.

26
00:01:53,640 --> 00:01:57,900
So we have here a second order time derivative and not the first order one.

27
00:01:58,680 --> 00:02:07,290
This means we must not only return to three right and side of the equation, but we must introduce another

28
00:02:07,290 --> 00:02:10,199
variable first, which would be the first derivative of art.

29
00:02:10,830 --> 00:02:12,240
And this is, of course, the velocity.

30
00:02:12,360 --> 00:02:21,120
So we will return the velocity of the first oscillator, which I will call like this b zero.

31
00:02:21,720 --> 00:02:31,200
Then we have we won and we have the two and then we have here the three right and sides of these equations.

32
00:02:32,640 --> 00:02:39,850
So to make this more clear, I will first of all, remind you that our variable here and why.

33
00:02:40,270 --> 00:02:46,650
We could also call it R or whatever we want is just the right insights of these equations.

34
00:02:46,650 --> 00:02:52,320
But now we do not only have three of these, but we have six of these because we have to consider the

35
00:02:52,320 --> 00:02:55,200
first order time derivative and the second order.

36
00:02:55,950 --> 00:03:07,260
So I write R is equal to Y and then the first three entries and V the velocity is equal to Y and then

37
00:03:07,260 --> 00:03:08,220
the other entries.

38
00:03:08,610 --> 00:03:09,840
So three to six.

39
00:03:10,650 --> 00:03:18,390
So remember, this means start from zero and go to two zero one two and here three four five.

40
00:03:19,680 --> 00:03:20,090
All right.

41
00:03:20,100 --> 00:03:28,200
And now I write Equation one is equal to no, I will write this one here minus R one.

42
00:03:29,010 --> 00:03:33,750
So in our python indices, this would be our with the index zero.

43
00:03:34,890 --> 00:03:36,090
And then we have.

44
00:03:38,510 --> 00:03:44,900
Actually, we have this twice, as you can see here, so I have to ride two times are zero and then

45
00:03:44,900 --> 00:03:48,050
minus one times are one.

46
00:03:49,670 --> 00:04:04,070
And then, for example, I could write in brackets times minus K over M, and then we do a similar thing

47
00:04:04,070 --> 00:04:04,850
for the other ones.

48
00:04:04,850 --> 00:04:08,930
But I will, of course, now paste these here.

49
00:04:08,930 --> 00:04:14,000
Equation with one equation two, Equation three and Equation two and three will, of course, look pretty

50
00:04:14,000 --> 00:04:14,660
similarly.

51
00:04:15,080 --> 00:04:22,610
So two and three and the two will be, as you can see here, minus.

52
00:04:25,330 --> 00:04:35,890
Our zero plus two times our one minus her two and then the last one is, of course, also very easy.

53
00:04:36,250 --> 00:04:41,560
So the only thing that you have to take care of is that you get the indices right because here in Python,

54
00:04:41,560 --> 00:04:44,890
we count from zero one two and here we have one two three.

55
00:04:45,460 --> 00:04:47,380
So please don't be fooled here.

56
00:04:49,060 --> 00:04:50,260
And then everything will be good.

57
00:04:51,670 --> 00:04:53,750
OK, I think it should work like this.

58
00:04:53,770 --> 00:04:54,670
Let's run it.

59
00:04:55,090 --> 00:04:55,990
OK, no error.

60
00:04:56,000 --> 00:04:57,190
That's always a good thing.

61
00:04:57,770 --> 00:05:06,250
And now we can continue and write T start is equal to zero and T and is equal to 100.

62
00:05:08,350 --> 00:05:15,670
Then I will say the starting values for white would be also a six component vector.

63
00:05:15,680 --> 00:05:24,400
And maybe we should specify now know of some specific numbers, but we can also go ahead and just simulate

64
00:05:24,400 --> 00:05:26,820
some random oscillations.

65
00:05:26,830 --> 00:05:35,260
For example, we could write some amplitude or some some magnitude of the variation, and then we generate

66
00:05:35,260 --> 00:05:38,380
six random numbers in the range minus one to plus one.

67
00:05:38,950 --> 00:05:42,320
So this would be minus notes.

68
00:05:42,610 --> 00:05:45,010
It would be two times the random number.

69
00:05:45,460 --> 00:05:51,340
So and people do random dot rounds six and then minus one.

70
00:05:52,540 --> 00:05:57,490
So here it is, would mean now from minus 0.5 to plus 0.5.

71
00:05:57,940 --> 00:06:04,990
This would mean from minus one to plus one, and this would mean from minus 0.3 to plus zero point three.

72
00:06:06,250 --> 00:06:13,440
And then we'll also multiply this by our value a, which we had here, which is basically the year the

73
00:06:13,450 --> 00:06:14,740
equilibrium position.

74
00:06:14,740 --> 00:06:20,710
Or you could also see the letters constant here to the standard or in equilibrium, the distance between

75
00:06:20,710 --> 00:06:21,670
two oscillators.

76
00:06:22,930 --> 00:06:24,900
So we have to define it, of course, as well.

77
00:06:24,910 --> 00:06:27,040
So like, let's say it's equal to one.

78
00:06:27,820 --> 00:06:31,090
And now we have our starting conditions and hard times.

79
00:06:32,650 --> 00:06:37,870
So this means we can now call our routine and stored solution.

80
00:06:39,460 --> 00:06:50,680
And as previously we write, integrate dots, solve, underscore IVP, then we must specify the function.

81
00:06:50,950 --> 00:06:52,670
So really, this is nothing new to this.

82
00:06:52,690 --> 00:06:55,720
Exactly, as we have learned, isn't how we practice it.

83
00:06:56,860 --> 00:07:03,640
Then from T start to T and his starting parameters would be why start?

84
00:07:04,630 --> 00:07:17,980
The method would be R.K. forty five and this would already work, but I want to get a equally spaced

85
00:07:18,160 --> 00:07:21,430
output for added time values or right here.

86
00:07:21,670 --> 00:07:27,100
T sorry typo t evolve is equal to and point in space.

87
00:07:30,420 --> 00:07:40,770
And it goes from tee start to tee and in steps of, let's say, zero point one.

88
00:07:40,890 --> 00:07:42,480
So maybe like this.

89
00:07:44,340 --> 00:07:49,980
OK, so I run this and once again, no error, which is even better.

90
00:07:49,980 --> 00:07:59,190
And now we can plot its so we have a plot with an ex label for X or the x axis indicates the time and

91
00:07:59,520 --> 00:08:05,220
the Y label indicates the coordinates of the three oscillators.

92
00:08:06,750 --> 00:08:09,870
And now we can go ahead and plot pal t dot plot

93
00:08:12,540 --> 00:08:14,730
and for the X values, we take the time.

94
00:08:14,730 --> 00:08:19,980
So this would be a solution and a scroll and a go three or a C dot T.

95
00:08:20,520 --> 00:08:29,280
And for the Y coordinates, we have a solution underscore three O C, Dot Y and then the zero index.

96
00:08:30,990 --> 00:08:34,710
So let's try it and we see some wild oscillation.

97
00:08:35,370 --> 00:08:37,710
So let's add the other two oscillators.

98
00:08:38,640 --> 00:08:46,350
This would be one and two, and we see they are now on top of each other and it oscillates quickly.

99
00:08:48,180 --> 00:08:55,350
Maybe it's good to shift them by their equilibrium position.

100
00:08:56,250 --> 00:09:04,020
So basically, what we what we see now here is the solution for our transformed variables, which would

101
00:09:04,020 --> 00:09:05,850
be these ones here.

102
00:09:06,540 --> 00:09:10,620
So this would be the coordinate with respect to the equilibrium position.

103
00:09:10,950 --> 00:09:18,360
But if you want to transform back to this one here, we have to add a two hour one to a two hour two

104
00:09:18,360 --> 00:09:19,940
and three a two or three.

105
00:09:19,950 --> 00:09:22,500
Then we are back in our old coordinate system.

106
00:09:23,310 --> 00:09:25,700
So this is what I did here and I'll run it.

107
00:09:25,710 --> 00:09:29,070
And you see, now they are oscillating apart from each other.

108
00:09:29,460 --> 00:09:35,430
You see, the first one oscillates around one, the second one around to the third one, around three

109
00:09:35,880 --> 00:09:37,080
one to three.

110
00:09:38,790 --> 00:09:44,550
So of course, since I have chosen the starting conditions to be random for you, the solution will

111
00:09:44,550 --> 00:09:45,810
probably look different.

112
00:09:46,320 --> 00:09:52,260
So also, when I restart and run ourselves, we will get now a bit of a different solution.

113
00:09:52,770 --> 00:10:00,180
But in all cases, we have here some oscillation, and you see, it's not really just a cosine oscillation.

114
00:10:01,200 --> 00:10:07,170
So even though we have simple harmonic oscillators for each of these springs.

115
00:10:07,650 --> 00:10:12,270
So for example, if we would leave out this whole part here and just consider this oscillator with this

116
00:10:12,270 --> 00:10:19,380
spring, we would get a harmonic oscillator and as a solution, we would get some cosine or sine function.

117
00:10:20,400 --> 00:10:25,650
However, here we see that there is some oscillation, but it's not harmonic.

118
00:10:26,090 --> 00:10:33,930
This is because the system becomes very sensible or very, very unstable, you could even say.

119
00:10:34,380 --> 00:10:40,620
And if you change the starting conditions, and this will pretty much affect also all of the other oscillators,

120
00:10:40,620 --> 00:10:44,250
and they will oscillate in a pretty funny way.

121
00:10:45,330 --> 00:10:47,520
However, it was no problem to solve this.

122
00:10:47,520 --> 00:10:55,710
Using our standard routine solve dot, integrate dot solve underscore IBP as we did before, and now

123
00:10:55,710 --> 00:10:57,930
we have our numerical solution.

124
00:10:58,680 --> 00:11:04,860
So now in the next lecture, we can go ahead and analyze this equation of motion once again and solve

125
00:11:04,860 --> 00:11:07,470
the problem with a different method.

126
00:11:07,470 --> 00:11:08,790
And this will be something new.

127
00:11:09,030 --> 00:11:12,450
So please stay tuned, and I hope you are excited for the next lecture.

