1
00:00:00,120 --> 00:00:01,950
So now let's get to the numerical results.

2
00:00:02,310 --> 00:00:08,250
And since we want to compare this with the analytical results, let's first calculate the energy corresponding

3
00:00:08,250 --> 00:00:08,940
to this term.

4
00:00:09,810 --> 00:00:12,390
So this will be two of a five oops.

5
00:00:12,390 --> 00:00:13,140
Sorry typo.

6
00:00:13,380 --> 00:00:15,000
Two over five times.

7
00:00:15,000 --> 00:00:15,360
I'm.

8
00:00:17,320 --> 00:00:19,690
Times Radius Square.

9
00:00:20,320 --> 00:00:28,540
And then because it's the energy, we also have to multiply with one half and all mega square.

10
00:00:29,200 --> 00:00:36,040
So the result will be zero point two and this will be something we are now trying to restore using numerical

11
00:00:36,100 --> 00:00:36,730
methods.

12
00:00:37,870 --> 00:00:42,370
So here we once again will need something like a number of points.

13
00:00:43,270 --> 00:00:51,610
And the idea that I'm using here is I'm going to create basically a cube consisting out of equidistant

14
00:00:51,610 --> 00:00:52,150
points.

15
00:00:52,780 --> 00:00:59,710
And then I'm going to check if the points that describe the cube are inside the sphere are nuts.

16
00:01:00,520 --> 00:01:03,190
And if they are not inside the sphere, then they will be dropped.

17
00:01:03,550 --> 00:01:08,410
And only if they are inside a sphere, they will be considered and will contribute to the integral.

18
00:01:09,640 --> 00:01:15,040
So here you have to think a bit in advance and think of a reasonable approach.

19
00:01:16,120 --> 00:01:22,270
So of course, you could try to do it in a similar way, as we did for the line where we have created

20
00:01:22,270 --> 00:01:27,640
some list or some array of points with these explicit commands.

21
00:01:28,360 --> 00:01:37,930
And this is probably possible, but it's much faster and much easier to just to use some loops.

22
00:01:38,260 --> 00:01:44,920
So considering loops is sometimes considered bad fashion, this is because using loops can be very,

23
00:01:44,920 --> 00:01:45,610
very slow.

24
00:01:46,240 --> 00:01:51,610
But I think here it's totally reasonable because the whole calculation will not take such a long time

25
00:01:51,610 --> 00:01:52,120
anyway.

26
00:01:52,570 --> 00:01:57,250
And also, even if we would just work with arrays, we would still have to check.

27
00:01:57,730 --> 00:02:02,260
Every element wants to see if the element is inside the sphere.

28
00:02:02,410 --> 00:02:03,580
Not so.

29
00:02:03,580 --> 00:02:07,270
I think it's totally fine to go ahead with loops.

30
00:02:08,650 --> 00:02:15,610
So what we are going to need first is a MBTI or an empty coordinate list.

31
00:02:16,750 --> 00:02:19,900
So this is where we will store our coordinates.

32
00:02:20,680 --> 00:02:27,550
So basically, we will create a list or an array as we did before by using ample little space.

33
00:02:28,030 --> 00:02:33,280
But this time we will not use line space, but we will go through loops and add the points manually,

34
00:02:33,280 --> 00:02:33,850
basically.

35
00:02:34,870 --> 00:02:40,300
So we are going to loop and you could use different type of loops, but I'm going to use here a for

36
00:02:40,300 --> 00:02:42,100
loop for X.

37
00:02:42,220 --> 00:02:48,370
And now we must provide an array or a list for the values over which we want to.

38
00:02:48,370 --> 00:02:58,900
Loops are right for X and MP Lyn Space and I go from minus R to R, which is actually the capital R

39
00:02:58,900 --> 00:02:59,170
here.

40
00:02:59,980 --> 00:03:01,060
The actual radius.

41
00:03:04,230 --> 00:03:09,180
And now I have to provide how many points we want to use, so I use these no points, of course.

42
00:03:11,100 --> 00:03:16,800
And then we do something here, but I don't only want to loop over the X coordinates.

43
00:03:16,800 --> 00:03:23,760
I also want to loop over the Y coordinates, which have the same limits and also over the Z coordinates,

44
00:03:23,760 --> 00:03:25,530
which also have the same limits.

45
00:03:26,670 --> 00:03:29,670
And now we must use an if statement.

46
00:03:30,060 --> 00:03:41,940
So if here is not a condition, the condition will be if the if the point is inside the sphere or not,

47
00:03:42,840 --> 00:03:47,970
we can check this by writing and p dot within towards the North.

48
00:03:48,570 --> 00:03:53,490
So basically the length of the vector x y z.

49
00:03:54,390 --> 00:04:00,050
So this would be something like, yeah, square root of x squared plus y square to square.

50
00:04:00,070 --> 00:04:04,710
So it's the distance of this point that we are currently considering in the loop with respect to the

51
00:04:04,710 --> 00:04:05,730
center of the sphere.

52
00:04:06,300 --> 00:04:13,860
And if this one is smaller or equal to the radius of the sphere down, it's inside and this will be

53
00:04:13,860 --> 00:04:17,370
good because then we are going to consider this point.

54
00:04:17,670 --> 00:04:23,730
So now we are going to write what happens then and what happens is we are adding this point to the coordinate

55
00:04:23,730 --> 00:04:32,190
list by writing quote list dot append and we are adding the point X, Y and Z.

56
00:04:33,510 --> 00:04:36,810
So let me run this, but actually both of these lines.

57
00:04:37,740 --> 00:04:47,550
And let me look at the output code list is a list of three coordinates.

58
00:04:47,610 --> 00:04:52,740
So X, Y Z and all of these points are inside of the sphere.

59
00:04:52,740 --> 00:04:54,240
So there are many of these points.

60
00:04:56,760 --> 00:05:00,060
So this is, of course, not the only thing that we want to have.

61
00:05:00,330 --> 00:05:07,170
I would say we would also add a counter to see how many points do we have because we will need this

62
00:05:07,170 --> 00:05:10,140
to calculate the total mass of the object later on.

63
00:05:10,760 --> 00:05:14,700
And so every time this is true, we increase the counter by one.

64
00:05:15,330 --> 00:05:21,600
And then also we will look at the actual contribution to the integral.

65
00:05:23,430 --> 00:05:25,230
So the contribution will be

66
00:05:28,140 --> 00:05:31,190
will be added up every time this is true.

67
00:05:31,200 --> 00:05:41,370
So we add up, so we increase it basically contribution as a contribution plus and now we are basically

68
00:05:41,370 --> 00:05:44,040
adding up the value our square.

69
00:05:45,090 --> 00:05:47,220
But please don't be confused here.

70
00:05:48,240 --> 00:05:55,650
This is again, this are here, which is the distance of the point that we are considering to the z

71
00:05:55,650 --> 00:05:56,100
axis.

72
00:05:57,120 --> 00:05:58,890
So this is really important.

73
00:05:59,610 --> 00:06:02,760
And P Dodds, Lynn Arc Dot know.

74
00:06:05,360 --> 00:06:08,120
Of X y coma zero.

75
00:06:08,990 --> 00:06:11,960
Because when you see X, this is our rotation axis.

76
00:06:12,380 --> 00:06:18,500
Then the distance will just be square root of x squared plus y square and the Z component doesn't play

77
00:06:18,530 --> 00:06:19,340
a role at all.

78
00:06:20,810 --> 00:06:25,550
And the equation we had are square, so we right here also squared.

79
00:06:27,740 --> 00:06:32,150
So here is oh yeah, like this.

80
00:06:32,340 --> 00:06:33,560
Now the arrows gone.

81
00:06:34,460 --> 00:06:39,200
And just to comment, this one here is actually just for plotting.

82
00:06:40,130 --> 00:06:41,000
It's not really needed.

83
00:06:41,510 --> 00:06:43,850
And of course, the same thing goes for this command here.

84
00:06:44,720 --> 00:06:48,380
So if you don't want to plot anything, then you don't need these two commands.

85
00:06:48,710 --> 00:06:54,020
And actually, it's pretty good to actually not use them because they are the most demanding things

86
00:06:54,020 --> 00:06:57,230
because it will always append these points to the list.

87
00:06:58,100 --> 00:07:01,020
But here we want to have a nice and beautiful result.

88
00:07:01,040 --> 00:07:07,850
So of course, I'm going to save them and I'm going to use them to plot the sphere later on so we can

89
00:07:08,060 --> 00:07:16,070
look at our results counter out of all the thirty times, thirty times.

90
00:07:16,070 --> 00:07:21,920
Thirty points, which are twenty seven thousand twelve thousand seven hundred twelve, are inside the

91
00:07:21,920 --> 00:07:22,370
sphere.

92
00:07:24,150 --> 00:07:35,520
And what I want to do next is I want to generate the coordinates list for the plot, and maybe you remember

93
00:07:35,520 --> 00:07:36,690
this from the crash course.

94
00:07:37,260 --> 00:07:43,140
We do not need to have the syntax as we have it right now, where we have for every point such a bracket

95
00:07:43,140 --> 00:07:44,310
of X, Y and Z.

96
00:07:44,700 --> 00:07:51,330
But we must have three individual arrays corresponding to all the X coordinates, all the Y coordinates

97
00:07:51,330 --> 00:07:52,890
and all the Z coordinates.

98
00:07:53,670 --> 00:07:59,580
So we have to restructure this array and we can do this by writing NP Dot transpose.

99
00:08:00,540 --> 00:08:06,750
So this leaves the data the same, but just reorder them and changes the brackets.

100
00:08:07,230 --> 00:08:12,510
So basically, if you think of it as a matrix, it transposes the matrix.

101
00:08:13,530 --> 00:08:20,490
So you see, now we have updated this, so we have overwritten the old coordinates list.

102
00:08:21,030 --> 00:08:24,480
And now the coordinates list looks like this.

103
00:08:25,410 --> 00:08:28,800
We have now a three individual arrays in this area.

104
00:08:29,160 --> 00:08:31,050
And here we have all the X coordinates.

105
00:08:31,050 --> 00:08:34,500
Here we have all the Y coordinates and here we have all the Z coordinates.

106
00:08:35,190 --> 00:08:40,440
So we can, for example, write this and then this will just be the array of all the X coordinates.

107
00:08:41,610 --> 00:08:44,140
And this is actually exactly what we are going to need next.

108
00:08:44,159 --> 00:08:49,950
We are going to make a three day plot by writing pelted ot axes.

109
00:08:50,430 --> 00:08:59,460
And as always, when we do three plots, we have to first enable the 3D option and we have to give it

110
00:08:59,460 --> 00:09:01,830
a name Pulte 3D.

111
00:09:03,570 --> 00:09:06,980
And now we can use this to make the plots.

112
00:09:06,980 --> 00:09:08,760
So we writes Pulte 3D.

113
00:09:09,360 --> 00:09:12,660
Can I use your eyes, get a 3D plot?

114
00:09:13,490 --> 00:09:20,760
Now we must provide the three individual lists x coordinate, y coordinate and do z coordinate.

115
00:09:22,910 --> 00:09:25,070
And I think this should work already.

116
00:09:25,820 --> 00:09:27,570
Yeah, so here is our sphere.

117
00:09:28,490 --> 00:09:32,630
So of course, we can now add labels for this.

118
00:09:32,630 --> 00:09:39,260
I will scroll up because we have done it already so we can just copy the code from here, for example.

119
00:09:42,250 --> 00:09:52,540
So we go here and we add to the coordinates, which in this case will be the actual Z coordinate.

120
00:09:52,930 --> 00:10:01,120
So like this, and since this looks like just blue blob, I want to make the individual points a bit

121
00:10:01,120 --> 00:10:04,810
smaller, which you can do by writing as is equal to some number.

122
00:10:06,290 --> 00:10:07,580
Oh yeah, that looks better.

123
00:10:07,580 --> 00:10:08,590
Or maybe even smaller.

124
00:10:11,250 --> 00:10:14,040
No, I wanted zero for one.

125
00:10:15,120 --> 00:10:15,480
Yes.

126
00:10:15,510 --> 00:10:16,350
This looks really good.

127
00:10:17,370 --> 00:10:24,600
So you see, now we started from an array or basically we looped over a cube.

128
00:10:25,170 --> 00:10:31,320
And we have considered only the points that are inside the sphere, whose radius is smaller than the

129
00:10:31,320 --> 00:10:32,370
radius of the sphere.

130
00:10:33,000 --> 00:10:37,710
And so all of the points that we are considering are these that are plotted here.

131
00:10:38,880 --> 00:10:42,070
And the contribution is already added up.

132
00:10:42,090 --> 00:10:48,510
We have added up always the distance to the Z X squared, which is exactly what we need for the equation

133
00:10:49,590 --> 00:10:54,900
because the equation was, um, let me scroll up.

134
00:10:54,900 --> 00:10:56,250
We have this in the very beginning.

135
00:10:56,250 --> 00:10:59,340
I think, yeah, here it is.

136
00:11:00,120 --> 00:11:07,860
So the equation was the rotational energy is I of a two omega square with IBM, and this is the contribution

137
00:11:07,860 --> 00:11:16,050
that we have just calculated, which means we have to now multiply this with the total mass and we have

138
00:11:16,050 --> 00:11:20,100
to then, you know, also consider these other terms for the rotational energy.

139
00:11:21,150 --> 00:11:23,400
So let's scroll down and do it.

140
00:11:24,870 --> 00:11:32,370
So as I just said, what we have to do is we have to multiply with the mass.

141
00:11:33,060 --> 00:11:40,650
And for this, we will use the total mass divided by the number of points that we have considered and

142
00:11:40,920 --> 00:11:43,290
then we have 40.

143
00:11:44,480 --> 00:11:46,380
You have to have the contribution.

144
00:11:49,010 --> 00:11:55,220
So this would be the eye, but simply want to have the energy to kinetic energy.

145
00:11:55,610 --> 00:12:00,980
We have to divide by two and have to multiply by omega square.

146
00:12:03,060 --> 00:12:08,690
And the result is 0.1 99, something which is basically.

147
00:12:09,910 --> 00:12:17,080
What we have from the analytical result, which was so difficult and so long to calculate, and here

148
00:12:17,080 --> 00:12:23,350
it was actually pretty simple, we just had to use three four loops to loop over a cube.

149
00:12:23,770 --> 00:12:28,120
And then we had to think about the condition, which was just a radius condition.

150
00:12:28,120 --> 00:12:34,360
And then we just add up the contributions and in the end normalized the contribution to get the correct

151
00:12:34,360 --> 00:12:34,870
results.

