1
00:00:00,510 --> 00:00:04,080
So let's begin and let's implement these equations.

2
00:00:04,620 --> 00:00:07,650
And of course, first of all, we must implement all three of those.

3
00:00:08,700 --> 00:00:13,350
And we write death and then we can use the same method as before.

4
00:00:13,710 --> 00:00:17,280
So you see, this is pretty, pretty powerful and universal methods.

5
00:00:17,730 --> 00:00:19,840
And we just write everybody.

6
00:00:20,430 --> 00:00:24,900
And then we could have just roads T and R.

7
00:00:26,040 --> 00:00:31,620
And what I write then is just for simplicity.

8
00:00:31,620 --> 00:00:35,960
X y z is equal to ALM.

9
00:00:36,360 --> 00:00:41,160
So this means that three individual components will be stored in the variables called X, Y and Z.

10
00:00:41,880 --> 00:00:51,720
And the first derivative of X I call X one is equal to eight times Y means X and then Y one is equal

11
00:00:51,720 --> 00:01:05,730
to X times in brackets B minus C minus Y and z one is equal to x times y minus z c times z.

12
00:01:06,990 --> 00:01:14,760
And then we return everything and we return x1, y1, Z1.

13
00:01:15,600 --> 00:01:23,160
So you see, it's the same logic or the same methods or methodology behind it, where we return three

14
00:01:23,160 --> 00:01:26,280
individual values, which are the right hand side of these equations.

15
00:01:26,730 --> 00:01:31,470
And all of this is just to make it look nicer and to name these things.

16
00:01:31,470 --> 00:01:39,300
But we could have just wrote here, for example, here we could have written eight times our brackets,

17
00:01:39,300 --> 00:01:41,580
one minus our brackets zero.

18
00:01:41,850 --> 00:01:45,690
So we could have implemented this thing here in just a single line of code.

19
00:01:47,130 --> 00:01:48,390
And now we have this function.

20
00:01:49,350 --> 00:01:56,370
Sorry, first, I must run this and then this, and now we can look at some solutions.

21
00:01:56,970 --> 00:02:01,380
And as I told you, the system has chaotic and non chaotic solutions.

22
00:02:01,980 --> 00:02:05,060
And it turns out you can investigate this in more detail.

23
00:02:05,070 --> 00:02:11,730
It turns out that this constant be here is determining if it is chaotic or non chaotic.

24
00:02:11,790 --> 00:02:13,470
We will start with a chaotic solution.

25
00:02:14,730 --> 00:02:22,470
So let's continue and let's define the parameters for the function so we can right here.

26
00:02:22,470 --> 00:02:29,340
For example, a is equal to then a typical set of parameters would be 10.

27
00:02:32,800 --> 00:02:37,450
And then something larger than 24 Dot seven four.

28
00:02:38,050 --> 00:02:47,440
So, for example, 50 and see, I just used a typical value that is used everywhere in literature that

29
00:02:47,440 --> 00:02:50,740
gives a nice butterfly, which would be eight over three.

30
00:02:51,380 --> 00:02:55,750
But you can play it with the parameters here and now I want to show you a nice trick.

31
00:02:56,350 --> 00:02:59,560
So you see, we want to later on change these parameters.

32
00:02:59,570 --> 00:03:04,540
So this means later on we would have to change these values and then redefine the function.

33
00:03:05,260 --> 00:03:07,180
But we can also do it in a different way.

34
00:03:07,660 --> 00:03:19,840
So I paste them here and then we must right here a b c as parameters or as our input values here for

35
00:03:19,840 --> 00:03:20,800
the function itself.

36
00:03:21,790 --> 00:03:30,630
And then we just have to change one thing when we call the the command from this Typekit module dot

37
00:03:30,640 --> 00:03:31,300
integrate.

38
00:03:32,260 --> 00:03:33,760
So let me show you how this works.

39
00:03:34,360 --> 00:03:42,940
So we right solution is equal to and like before the right integrate thought, so underscore IVP.

40
00:03:43,660 --> 00:03:52,030
Then first the function, then the times which would be t start come off t end.

41
00:03:52,900 --> 00:04:00,940
So this would be t start equal to zero T and equal to 50, for example.

42
00:04:01,600 --> 00:04:07,270
Then we continue to rewrite x zero y zero zero.

43
00:04:07,780 --> 00:04:09,700
So this would be the starting positions.

44
00:04:10,330 --> 00:04:13,780
So let's just use some values here.

45
00:04:18,680 --> 00:04:20,300
And they made a typo here.

46
00:04:21,100 --> 00:04:21,310
Yup.

47
00:04:21,560 --> 00:04:22,700
So now it looks good.

48
00:04:23,300 --> 00:04:33,710
And the methods we want to use once again, the cutoff 45 methods, then we want to give it the time

49
00:04:33,710 --> 00:04:34,340
values.

50
00:04:34,850 --> 00:04:40,790
So of course, this is not really necessary to do, but to generate nice plots and to know everything

51
00:04:40,790 --> 00:04:43,910
about the intermediate time between zero and 50.

52
00:04:44,300 --> 00:04:56,150
It's always helpful to have this trial in space from teh start to T and then the number of steps, for

53
00:04:56,150 --> 00:04:56,960
example, like this.

54
00:04:57,500 --> 00:04:58,820
And now comes the difference.

55
00:04:59,990 --> 00:05:06,290
So if it would run this now, it would not work because in our function, we have to find several inputs

56
00:05:06,290 --> 00:05:06,590
here.

57
00:05:06,590 --> 00:05:13,900
And the integrated solve underscore IVP only knows how to handle functions with the arguments T.

58
00:05:14,300 --> 00:05:16,830
And then here are our can be in the right.

59
00:05:16,850 --> 00:05:24,470
But then it doesn't know what is ABC, so we must specify that ABC are parametres that do not change.

60
00:05:25,010 --> 00:05:25,730
So we write.

61
00:05:27,180 --> 00:05:32,580
This arcs is equal to in brackets, a comma, become a C.

62
00:05:33,630 --> 00:05:43,260
No, it uses these values that we have to find here and treats them as arguments in the function f o

63
00:05:43,260 --> 00:05:43,680
d e.

64
00:05:44,190 --> 00:05:46,800
And of course, they have to be called exactly like here.

65
00:05:47,880 --> 00:05:59,310
So now if I run this and if I run this, oh no, I get a problem here because I made a typo and T and

66
00:06:00,390 --> 00:06:01,190
not a typo.

67
00:06:01,200 --> 00:06:01,600
Yes.

68
00:06:01,620 --> 00:06:02,370
No, it works.

69
00:06:02,490 --> 00:06:07,230
Sorry for the two typos, and then we can continue and plot the trajectory.

70
00:06:08,550 --> 00:06:15,990
So the right plot trajectory, this will be the name of our plot peel dot axes.

71
00:06:17,440 --> 00:06:26,250
And first of all, since it's three dimensional system, we must activate the 3D option and then we

72
00:06:26,250 --> 00:06:31,650
can go ahead and write plot trajectory

73
00:06:33,870 --> 00:06:34,950
is equal to.

74
00:06:35,370 --> 00:06:36,720
No, that's not correct.

75
00:06:36,810 --> 00:06:45,270
Plot trajectory dot plot three and then we must adhere the X, Y and Z coordinates.

76
00:06:45,630 --> 00:06:47,490
So this will be a solution.

77
00:06:49,660 --> 00:07:03,520
Thought why X component will be the first component with the index zero one two, and then we can change

78
00:07:03,520 --> 00:07:07,510
into line with to make this plot look a bit nicer.

79
00:07:09,930 --> 00:07:10,800
For example, like this.

80
00:07:12,720 --> 00:07:14,760
So you see here is our butterfly.

81
00:07:15,450 --> 00:07:24,390
We start from this particular point, which I think corresponds to one zero zero, and then it moves

82
00:07:24,390 --> 00:07:26,500
around these two points in space.

83
00:07:26,520 --> 00:07:30,180
And I've written already before here, that's too repulsive.

84
00:07:30,180 --> 00:07:31,110
Points exist.

85
00:07:31,260 --> 00:07:33,240
And so these are here, these centers.

86
00:07:34,410 --> 00:07:41,580
So the trajectory of the particle will move on a trajectory around these around these repulsive points.

87
00:07:42,090 --> 00:07:47,430
And now we want to check if this is really a chaotic solution.

88
00:07:48,510 --> 00:07:51,630
So let me add here.

89
00:07:54,590 --> 00:08:02,030
Another calculation was I just copied this line of code and call it solution two, and I would just

90
00:08:02,030 --> 00:08:07,670
briefly change the starting conditions, so just multiply the X zero by 1.1

91
00:08:09,800 --> 00:08:13,580
and oops, sorry, 1.1 times x zero.

92
00:08:14,030 --> 00:08:25,970
And now we can add here and other plots so we can just copy and write solution to solution two, solution

93
00:08:25,970 --> 00:08:26,420
two.

94
00:08:27,560 --> 00:08:31,400
And now we see here two of these trajectories on top of each other.

95
00:08:31,400 --> 00:08:38,059
And you see at the starting position you see really hit blue and an orange line almost perfectly on

96
00:08:38,059 --> 00:08:38,990
top of each other.

97
00:08:39,590 --> 00:08:44,630
And then at a later point of time, you see here these two lines, they don't agree with each other

98
00:08:44,630 --> 00:08:51,560
anymore, and the position at the end of time is then totally different, of course.

99
00:08:51,740 --> 00:09:03,110
So we can compare just by writing solution dots y and then all of the coordinates at the last point

100
00:09:03,110 --> 00:09:08,900
of time that we have calculated would be this one and would be this one.

101
00:09:10,070 --> 00:09:17,420
So you see quite different, even though in the beginning they were just positioned at one zero zero

102
00:09:17,420 --> 00:09:19,580
and 1.1 zero zero.

103
00:09:20,450 --> 00:09:27,950
And this is what is meant when people say that this is a chaotic system and that a butterfly effect

104
00:09:27,950 --> 00:09:35,570
exists where if you don't exactly and precisely know the starting conditions, you don't anymore know

105
00:09:35,570 --> 00:09:41,000
about the end positions, even though the system is of course, deterministic and it's not a quantum

106
00:09:41,000 --> 00:09:45,710
system, it's really a classical, deterministic system, but it behaves chaotic.

107
00:09:47,150 --> 00:09:51,710
So now I just want to analyze this in a bit more detail.

108
00:09:52,070 --> 00:09:56,990
The first thing is that we have here such a bad resolution, so it's really hard to see anything.

109
00:09:57,710 --> 00:09:59,690
So what we can do is we can save it.

110
00:09:59,960 --> 00:10:04,660
So let's safe fig and then we give it a name.

111
00:10:05,000 --> 00:10:16,730
For example, Lauren's trying to read thoughts PMG and to increase the resolution.

112
00:10:17,090 --> 00:10:17,330
Oops.

113
00:10:17,330 --> 00:10:17,750
Sorry.

114
00:10:18,380 --> 00:10:19,070
You're right.

115
00:10:19,330 --> 00:10:24,410
DPI dots per inch and then quite a high number, for example, three hundreds.

116
00:10:25,370 --> 00:10:27,410
And now I can open this.

117
00:10:28,100 --> 00:10:30,170
So file open.

118
00:10:30,620 --> 00:10:33,140
And here it is.

119
00:10:35,400 --> 00:10:40,770
So you see here, you can really much better see, you know, the trajectory, and at the beginning,

120
00:10:41,100 --> 00:10:44,520
the two lines orange and blue are really on top of each other.

121
00:10:44,910 --> 00:10:47,220
And then the keep on top of each other.

122
00:10:47,220 --> 00:10:52,020
But then it's, of course, a bit hard to see here because you cannot follow all of the trajectory.

123
00:10:52,470 --> 00:10:58,830
But, you know, at some point, the two trajectories will be independent of each other.

124
00:10:58,830 --> 00:11:06,120
And then the really just the chaotic behavior winds over the over the deterministic behavior.

125
00:11:07,470 --> 00:11:07,980
All right.

126
00:11:08,760 --> 00:11:09,270
So

127
00:11:12,030 --> 00:11:16,680
we have also figured this out by looking at the coordinates that are here totally different, especially

128
00:11:16,680 --> 00:11:17,490
X and Y.

129
00:11:17,970 --> 00:11:21,420
And this is really the indication of this chaotic behavior.

130
00:11:22,470 --> 00:11:31,680
The last thing that we can do is before I will zoom in on the last thing that we can do is analyzing

131
00:11:31,680 --> 00:11:33,090
the coordinates.

132
00:11:33,840 --> 00:11:46,740
And for this, we can just write Peel T dot plot and then we plot the solution dots T versus just one

133
00:11:46,740 --> 00:11:51,600
of the coordinates, for example, the X coordinate like this.

134
00:11:52,920 --> 00:11:56,910
And so you see how there are so many sign changes here.

135
00:11:57,090 --> 00:12:02,850
So the X coordinate over time changes from negative to positive over and over again.

136
00:12:03,240 --> 00:12:09,030
And this is whenever a particle is closer to this one or to this one.

137
00:12:09,420 --> 00:12:14,310
Of course, we could also analyze hit y coordinate, and it's the same thing, basically.

138
00:12:15,170 --> 00:12:20,220
And for the Z coordinate, it's different because you see both of the wings of this butterfly, they

139
00:12:20,220 --> 00:12:21,930
are at positive values.

140
00:12:22,620 --> 00:12:28,590
So it really makes more sense to use here X or Y as the coordinates that we want to analyze.

141
00:12:29,970 --> 00:12:30,420
All right.

142
00:12:30,450 --> 00:12:37,020
So we have now figured out what this chaotic behavior means, and we have seen that we can really propagate

143
00:12:37,920 --> 00:12:44,790
this differential equation and that we can solve such differential equations in three dimensions that

144
00:12:44,970 --> 00:12:46,050
depend on each other.

145
00:12:46,080 --> 00:12:51,600
So here the coordinates X, Y and Z are not independent of each other as before.

146
00:12:51,870 --> 00:12:55,170
But here really, we have three couples differential equations.

147
00:12:55,350 --> 00:12:58,050
But still, it was no problem we could have.

148
00:12:58,080 --> 00:13:05,940
We could use the same methods, which is to find a function, return the three right hand sides of the

149
00:13:05,940 --> 00:13:06,690
equations.

150
00:13:07,290 --> 00:13:14,820
And then we just call, integrate, dot, solve, underscore IVP and then plot the solution and analyze

151
00:13:14,820 --> 00:13:14,970
it.

