1
00:00:03,150 --> 00:00:07,550
Hello, bonjour, dia duit, hei,

2
00:00:08,580 --> 00:00:14,190
Welcome to the fourth week of Statistical Mechanics: Algorithms and Computations,

3
00:00:14,190 --> 00:00:17,940
from the Physics Department of Ecole Normale supérieure.

4
00:00:19,440 --> 00:00:24,800
This week we will advance our understanding along two directions

5
00:00:26,220 --> 00:00:33,580
from the physical point of view, we have so far thoroughly studied the first pillar

6
00:00:33,580 --> 00:00:37,580
of statistical mechanics: the equiprobability principle.

7
00:00:38,930 --> 00:00:43,090
Time has come to consider the second pillar

8
00:00:43,780 --> 00:00:51,900
which comes from the Maxwell distribution of velocities and gives the Boltzmann distribution of energy.

9
00:00:54,420 --> 00:01:01,660
This second pillar will allow us to heal the dissimmetry between

10
00:01:01,660 --> 00:01:05,290
the molecular dynamics simulations

11
00:01:05,290 --> 00:01:09,290
that is the solution of Newton's equations of motion

12
00:01:10,140 --> 00:01:13,290
and the Monte Carlo approach.

13
00:01:13,290 --> 00:01:16,890
So far, the molecular dynamics

14
00:01:16,890 --> 00:01:23,560
had velocities and positions, whereas the Monte Carlo only had the positions.

15
00:01:24,480 --> 00:01:27,550
What we learn today will allow us

16
00:01:27,550 --> 00:01:31,550
to overcome the dissimmetry

17
00:01:31,550 --> 00:01:34,890
between molecular dynamics and Monte Carlo.

18
00:01:35,300 --> 00:01:39,510
To get there, we must deepen our understanding of sampling

19
00:01:40,260 --> 00:01:44,990
and this is the second direction along which we will advance this week.

20
00:01:45,830 --> 00:01:50,590
So far, sampling meant that we threw pebbles,

21
00:01:50,590 --> 00:01:55,060
placed disks, or fixed clothes-pins

22
00:01:55,060 --> 00:01:56,550
on a washing line.

23
00:01:57,910 --> 00:02:01,230
Now, we will connect this sampling problem

24
00:02:01,230 --> 00:02:05,230
with the underlying process of integration.

25
00:02:05,230 --> 00:02:11,630
The sampling problem will accompany us also in this week's tutorial, tutorial 4.

26
00:02:12,670 --> 00:02:17,200
We will start with a very simple Saturday night problem

27
00:02:18,330 --> 00:02:24,870
on your free evening you have many options and you can give them probabilities

28
00:02:26,350 --> 00:02:29,760
you can go out with friend, see your family,

29
00:02:29,760 --> 00:02:33,760
do homework, do sports.

30
00:02:33,760 --> 00:02:37,760
All of these options have statistical weights

31
00:02:37,760 --> 00:02:45,950
and you may think at first sight that the problem is writing down these statistical weights

32
00:02:45,950 --> 00:02:51,720
but it isn't. The difficult part is doing the sampling.

33
00:02:52,870 --> 00:02:58,100
In tutorial 4, you will learn how to sample this distribution

34
00:02:58,100 --> 00:03:00,900
along different approaches,

35
00:03:02,180 --> 00:03:06,250
and how to do it if you not only have 4 or 5 options,

36
00:03:06,250 --> 00:03:10,250
but thousand, millions, or billions,

37
00:03:10,250 --> 00:03:14,250
how to sample such a discrete distribution

38
00:03:14,250 --> 00:03:18,250
efficiently, or event optimally

39
00:03:18,250 --> 00:03:22,250
and how to take the continuum limit.

40
00:03:22,250 --> 00:03:26,250
All of these are central subjects

41
00:03:26,250 --> 00:03:30,250
of daily life at work or study

42
00:03:30,250 --> 00:03:34,250
but - as you see - also for the night life.

43
00:03:35,250 --> 00:03:39,200
In this week's homework, homework session 4,

44
00:03:39,430 --> 00:03:43,530
you will be concerned again with the connection between sampling

45
00:03:43,530 --> 00:03:44,740
and integration.

46
00:03:46,080 --> 00:03:49,410
In fact, you will compute the volume of the sphere

47
00:03:50,160 --> 00:03:52,880
not in three dimensions, like here,

48
00:03:52,880 --> 00:03:56,310
but in 100 or 200 dimensions

49
00:03:56,830 --> 00:04:00,650
this is what Monte Carlo methods are really good for.

50
00:04:02,440 --> 00:04:09,680
You will learn for yourself how the sampling approach really goes at top speed in high dimensions

51
00:04:09,680 --> 00:04:14,120
and how you can evaluate an integral there.

52
00:04:15,230 --> 00:04:21,150
You see, there are lots of exciting developments in week 4 of our course,

53
00:04:21,150 --> 00:04:24,070
so let's get started.

54
00:04:29,390 --> 00:04:36,050
As we just mentioned, time has come to connect sampling to integration,

55
00:04:36,900 --> 00:04:40,050
let us look back at the children's game:

56
00:04:41,800 --> 00:04:50,030
pi/4 came out as the ratio of the volume of the circle to the volume of the square.

57
00:04:51,500 --> 00:04:58,610
More precisely, we find that the number of hits divided by the number of trials

58
00:04:58,610 --> 00:05:03,450
is approximately equal to the ratio of two integrals.

59
00:05:04,630 --> 00:05:09,500
The integral over dx and dy on the square

60
00:05:09,500 --> 00:05:13,940
of O(x,y) pi(x,y)

61
00:05:13,940 --> 00:05:19,590
divided by the integral over the square of pi(x,y).

62
00:05:19,590 --> 00:05:28,170
In this equation O(x,y) is a function, an observable

63
00:05:28,170 --> 00:05:33,650
and it is 1 inside the circle and 0 outside,

64
00:05:34,400 --> 00:05:42,000
and pi(x,y) is the uniform probability distribution on the square.

65
00:05:42,670 --> 00:05:48,960
By throwing pebbles, we in fact compute the integral in dx dy

66
00:05:48,960 --> 00:05:51,620
pi(x,y).

67
00:05:52,190 --> 00:06:00,890
But notice: on the left side the probability distribution pi(x,y) is absent

68
00:06:01,460 --> 00:06:06,990
it is the samples that are drawn from this distribution.

69
00:06:08,550 --> 00:06:16,300
Furthermore the dimension of the integral (the fact that the integral on the right is in two dimensions)

70
00:06:16,300 --> 00:06:18,890
does not appear on the left:

71
00:06:19,760 --> 00:06:22,890
there are no multiple sums along all dimensions.

72
00:06:23,560 --> 00:06:31,210
This explains why Monte Carlo sampling methods excel in high dimensions.

73
00:06:32,090 --> 00:06:38,400
For integrals, we have substitution rules: changes of variables.

74
00:06:38,400 --> 00:06:43,460
And we we'll next see how these changes of variables

75
00:06:43,460 --> 00:06:46,720
relate to the sampling approach.

76
00:06:47,300 --> 00:06:51,180
Our example will be the Gaussian integral

77
00:06:51,180 --> 00:06:56,140
integral from (-infinity) to infinity in dx

78
00:06:56,140 --> 00:07:01,670
over sqrt(2 pi) exp(- x^2 / 2).

79
00:07:02,700 --> 00:07:06,680
The value of the integral is I=1.

80
00:07:06,680 --> 00:07:14,690
And to show it, generations of students have learned to square the integral

81
00:07:16,330 --> 00:07:23,600
so we write I^2 = (integral in x) times (integral in y)

82
00:07:24,920 --> 00:07:28,570
Now let's do a first substitution

83
00:07:29,170 --> 00:07:33,630
we go from x and y to r and phi.

84
00:07:33,630 --> 00:07:37,630
x = r cos(phi),

85
00:07:37,630 --> 00:07:42,240
and y = r sin(phi)

86
00:07:44,610 --> 00:07:46,460
This gives the following integral.

87
00:07:47,310 --> 00:07:53,830
Now, we do a second substitution from r to psi

88
00:07:56,050 --> 00:08:02,680
and then finally we do a substitution from exp(-psi)

89
00:08:02,680 --> 00:08:05,400
to Upsilon,

90
00:08:06,190 --> 00:08:16,220
and we arrive at the formula I^2 = integral from 0 to 2pi dphi over 2pi

91
00:08:16,760 --> 00:08:20,850
times the integral from 0 to 1 dUpsilon.

92
00:08:22,630 --> 00:08:34,120
We can do these two integrals, and confirms that I^2=1, which means that I=1. We have computed the Gaussian integral.

93
00:08:35,680 --> 00:08:40,060
But in fact we don't care about the value of this integral

94
00:08:40,060 --> 00:08:46,600
what we do is to use our relationship between integration and sampling.

95
00:08:47,660 --> 00:08:55,640
So we can see that phi in fact is a random number between 0 and (2 pi)

96
00:08:56,730 --> 00:09:01,690
and Upsilon is a random number between 0 and 1.

97
00:09:03,410 --> 00:09:07,870
So now let's take a little crab's walk back

98
00:09:07,870 --> 00:09:10,690
from the variables

99
00:09:10,690 --> 00:09:16,150
phi and Upsilon (the samples phi and Upsilon)

100
00:09:16,150 --> 00:09:21,660
back to x and y. So the samples phi and Upsilon

101
00:09:21,660 --> 00:09:25,660
give samples phi and psi

102
00:09:26,620 --> 00:09:32,800
phi and r, and finally x and y.

103
00:09:32,800 --> 00:09:38,750
Let us discuss as what it really is, namely an algorithm

104
00:09:38,750 --> 00:09:41,210
gauss_test.py

105
00:09:42,220 --> 00:09:46,620
Its graphic version (gauss_test_movie.py)

106
00:09:46,620 --> 00:09:48,830
allows you to see

107
00:09:48,830 --> 00:09:54,420
that the flat input distributions of phi and Upsilon

108
00:09:55,210 --> 00:10:01,860
get transformed into distributions of x and y that are Gaussians.

109
00:10:02,730 --> 00:10:11,860
So we have a distribution exp(-x^2/2) and a distribution exp(-y^2/2) and the two are independent.

110
00:10:13,410 --> 00:10:16,710
So what you see here allows you to understand

111
00:10:16,710 --> 00:10:23,070
that the substitution rules (the changes of variables in integrals)

112
00:10:23,070 --> 00:10:26,090
also apply to the samples.

113
00:10:27,000 --> 00:10:34,230
Before going on, please take a moment to download, run and modify the programs we just discussed.

114
00:10:35,270 --> 00:10:39,520
On the Coursera website, you'll find the program gauss_test.py.

115
00:10:40,340 --> 00:10:46,940
Understand that phi and Upsilon are numbers, samples,

116
00:10:46,940 --> 00:10:54,190
and that these samples are transformed into numbers, samples of x and y

117
00:10:54,550 --> 00:10:57,040
taken from a Gaussian distribution.

118
00:10:58,040 --> 00:11:01,040
Take the program apart

119
00:11:02,040 --> 00:11:05,040
in the graphic version of gauss_test.py

120
00:11:06,220 --> 00:11:09,040
you see the variable Upsilon:

121
00:11:09,040 --> 00:11:15,630
it's a uniform between 0 and 1. Check that this is actually uniform.

122
00:11:16,580 --> 00:11:20,030
Then there is an intermediate variable psi

123
00:11:20,700 --> 00:11:25,640
- log(Upsilon). What is its distribution?

124
00:11:25,640 --> 00:11:33,910
Check it out, and compare it to the analytical calculation we did a few minutes ago.

125
00:11:39,550 --> 00:11:45,310
Now let us consider vectors or lists of Gaussians

126
00:11:45,310 --> 00:11:47,920
not just a single one.

127
00:11:48,960 --> 00:11:55,190
We start in two dimensions, with x and y two independent Gaussians.

128
00:11:55,830 --> 00:11:59,790
This is shown here in this program, and note

129
00:11:59,790 --> 00:12:05,250
that we have gone from our home-grown version of gauss_test.py

130
00:12:05,250 --> 00:12:10,020
to the Python version random.gauss.

131
00:12:10,320 --> 00:12:16,010
It uses basically the same algorithm, called the Box-Muller method.

132
00:12:18,200 --> 00:12:25,110
Output of gauss_2d_movie.py is shown here.

133
00:12:25,670 --> 00:12:30,930
You see a first sample, a second sample, a third sample, and so on.

134
00:12:32,070 --> 00:12:45,650
What you see is a cloud of points. Each point is an independent Gaussian in x and an independent Gaussian in y.

135
00:12:46,920 --> 00:12:50,600
And note that the distribution (the cloud)

136
00:12:50,600 --> 00:12:56,880
is isotropic, it is invariant under rotations.

137
00:12:57,600 --> 00:13:03,170
This situation is unique, there's only Gaussians that can do it.

138
00:13:03,170 --> 00:13:08,290
Remember that we already had distributions of x and y,

139
00:13:08,290 --> 00:13:15,370
in the children's game it was a square and it changed shape when it was rotated.

140
00:13:16,240 --> 00:13:24,380
To understand why this distribution is isotropic, let's look at the old program gauss_test.py

141
00:13:25,170 --> 00:13:31,960
you see that there is a variable phi which is uniform between 0 and (2pi)

142
00:13:32,730 --> 00:13:38,650
and the point x,y is oriented along this axis.

143
00:13:39,670 --> 00:13:48,740
Another of choice of phi would simply rotate the point x,y along the origin.

144
00:13:50,020 --> 00:13:57,570
You can directly check this also in out little crab walk we took a few minutes ago.

145
00:13:58,890 --> 00:14:04,300
You see we arrived from independent distributions x and y

146
00:14:04,300 --> 00:14:13,110
at a distribution integral from 0 to (2 pi) dphi over (2 pi), times an integral in r

147
00:14:13,110 --> 00:14:20,850
There is no function depending on phi, which means that the variable phi is independent.

148
00:14:21,910 --> 00:14:28,210
We will considerably deepen and generalize this for higher dimensions in a few minutes.

149
00:14:28,760 --> 00:14:39,470
Gaussians are unique in that independent distributions in x and y give an isotropic distribution in two dimensions.

150
00:14:40,380 --> 00:14:44,740
This property is general for Gaussians in any dimensions.

151
00:14:46,420 --> 00:14:51,430
The 3D case is shown here in gauss_3d.py

152
00:14:52,620 --> 00:14:59,330
each point is a vector x,y,z, and all three are independent Gaussians.

153
00:15:00,950 --> 00:15:08,350
So output of the movie version is shown here: one point, two points, three points, and so on..

154
00:15:08,350 --> 00:15:12,350
You see that the distribution is isotropic.

155
00:15:13,730 --> 00:15:20,640
And in the movie version we can even turn around the distribution and look at it from all angles.

156
00:15:22,360 --> 00:15:24,640
Does this make more adventurous?

157
00:15:25,450 --> 00:15:29,510
Yes of course, let's give this distribution a haircut.

158
00:15:29,510 --> 00:15:33,510
Let's take each point x,y,z

159
00:15:33,510 --> 00:15:36,160
and renormalize it to one.

160
00:15:37,100 --> 00:15:43,470
So we take x,y,z independent Gaussians, and divide this vector

161
00:15:43,470 --> 00:15:50,300
by the square root of (x^2 + y^2 + z^2).

162
00:15:51,450 --> 00:15:56,060
So now we have random points on the unit sphere.

163
00:15:57,720 --> 00:16:02,310
And as the distribution initially was isotropic,

164
00:16:02,310 --> 00:16:06,310
it remains isotropic on the unit sphere.

165
00:16:07,830 --> 00:16:16,010
So we found an algorithm to put random pebbles onto the surface of the sphere.

166
00:16:16,730 --> 00:16:23,150
Understand that isotropy does not simply mean that the points are on the surface of the sphere

167
00:16:23,150 --> 00:16:26,230
they are so by construction

168
00:16:26,230 --> 00:16:30,230
because we renormalized each point x,y,z

169
00:16:30,230 --> 00:16:31,880
to have a radius = 1.

170
00:16:31,880 --> 00:16:37,330
Isotropy means that the distribution of points (the probability distribution)

171
00:16:37,330 --> 00:16:40,700
is uniform on the surface of the sphere.

172
00:16:41,480 --> 00:16:48,300
So here is the program direct_surface.py in general dimensions.

173
00:16:48,300 --> 00:16:57,500
It puts points randomly with a uniform distribution on the surface of the hypersphere in d dimensions.

174
00:16:57,500 --> 00:17:01,500
Now, let us follow mathematically what is going on.

175
00:17:02,240 --> 00:17:06,240
We have to use the concept of sample transformation.

176
00:17:06,910 --> 00:17:18,450
Remember: sample transformation means that the changes of variables in the integral apply directly to the samples.

177
00:17:18,450 --> 00:17:27,490
So the integral that we are concerned with is the integral dx_0, dx_1, .., dx_(d-1)

178
00:17:27,490 --> 00:17:36,390
exp(-x_0^2) exp(-x_1^2) .. exp(-x_(d-1)^2)

179
00:17:38,030 --> 00:17:41,430
Now let's do a change of variables

180
00:17:41,430 --> 00:17:46,710
from x_0, .., x_(d-1)

181
00:17:46,710 --> 00:17:50,710
to r, the radius variable

182
00:17:50,710 --> 00:17:53,380
and an angular variable Omega,

183
00:17:53,380 --> 00:17:55,360
the solid angle.

184
00:17:57,080 --> 00:18:05,620
Integrated over the whole space, dOmega gives (2 pi) in two dimensions

185
00:18:05,620 --> 00:18:08,410
and (4 pi) in three dimensions.

186
00:18:10,370 --> 00:18:13,000
So now see that the integrand

187
00:18:14,140 --> 00:18:20,720
depends only on r, it is equal to exp(-r^2 /2)

188
00:18:21,840 --> 00:18:28,190
and the differential dx_0 dx_1 .. dx_(d-1)

189
00:18:28,190 --> 00:18:32,770
yields r^(d-1) dOmega dr.

190
00:18:34,430 --> 00:18:41,590
So, for our d Gaussians, we end up with a distribution

191
00:18:41,590 --> 00:18:46,970
integral dr r^(d-1)

192
00:18:47,780 --> 00:18:52,360
exp(-r^2 / 2) integral over dOmega.

193
00:18:53,610 --> 00:18:57,220
It is two independent integrals

194
00:18:58,170 --> 00:19:03,400
one in r, one in Omega. There's no function depending on Omega,

195
00:19:03,400 --> 00:19:11,930
which shows that we are isotropic in angles on the surface of the sphere in d dimensions.

196
00:19:13,200 --> 00:19:15,930
Finally, let's do a trick

197
00:19:15,930 --> 00:19:23,400
let's renormalize the radius r to be on a surface: r=1

198
00:19:23,400 --> 00:19:35,040
and then blow it up again to have a distribution pi(r) = r^(d-1) between 0 and 1

199
00:19:35,040 --> 00:19:42,150
rather than r^(d-1) exp(-r^2/2) from 0 to infinity.

200
00:19:43,850 --> 00:19:50,770
What you obtain is written in this program: direct_sphere_3d.py

201
00:19:50,770 --> 00:19:56,660
and it is a random point inside the three dimensional unit sphere.

202
00:19:57,290 --> 00:20:01,140
So output is shown here: one point, two points, three points, ..

203
00:20:02,570 --> 00:20:09,140
and we can turn it around and we have a random point inside the surface of the three dimensional sphere.

204
00:20:10,200 --> 00:20:18,440
There's also a general program that allows you to sample a random point inside the d-dimensional hypersphere.

205
00:20:18,440 --> 00:20:21,760
Before continuing, please take a moment

206
00:20:21,760 --> 00:20:26,310
to download, run and modify the programs we discussed in this section

207
00:20:26,310 --> 00:20:30,640
that means: take them apart and put them back together.

208
00:20:31,590 --> 00:20:40,570
On the Coursera website, you'll find the programs direct_sphere_3d.py and direct_surface_3d.py

209
00:20:41,710 --> 00:20:46,960
These short and sweet programs are marvelous

210
00:20:46,960 --> 00:20:51,580
and they should have their place in the national museums all over the world.

211
00:20:57,200 --> 00:21:03,030
Molecular dynamics concerns positions and velocities,

212
00:21:03,030 --> 00:21:08,640
whereas the Monte Carlo method considers only the positions.

213
00:21:10,460 --> 00:21:21,880
Why the velocities disappear from our Monte Carlo program and how we can make them come back deserves a most thorough answer.

214
00:21:24,060 --> 00:21:32,930
To incorporate velocities into statistical mechanics, we again use the equiprobability principle.

215
00:21:35,170 --> 00:21:37,770
For hard-disks in a box,

216
00:21:38,970 --> 00:21:48,080
during an event-driven molecular dynamics simulation, the energy is equal to the kinetic energy

217
00:21:48,080 --> 00:21:50,440
and it is fixed.

218
00:21:51,430 --> 00:21:58,490
Kinetic energy is equal to 1/2 m sum over the velocities square

219
00:21:58,490 --> 00:22:04,540
v_0^2 + .. + v_(N-1)^2

220
00:22:05,400 --> 00:22:11,220
In this equation, each velocity has two components

221
00:22:11,220 --> 00:22:16,590
v_0 = v_0x, v_0y

222
00:22:17,280 --> 00:22:29,530
So that the square v_0^2 is equal to v_0x ^2 + v_0y ^2

223
00:22:32,130 --> 00:22:38,060
In this equation you see that the sum over the squares is fixed

224
00:22:38,710 --> 00:22:43,730
just like on a circle, or on a surface of a sphere.

225
00:22:43,730 --> 00:22:49,660
Only in higher dimensions, any legal set of velocities

226
00:22:49,660 --> 00:22:55,930
is a point on the 2N-dimensional hypersphere

227
00:22:55,930 --> 00:23:03,350
of radius sqrt(2 E_kin / m)

228
00:23:03,350 --> 00:23:10,400
for 4 particles in a box, this forms a vector

229
00:23:10,400 --> 00:23:17,140
of 8 components (an 8-dimensional vector) on the surface of the 8-dimensional hypersphere.

230
00:23:19,060 --> 00:23:36,450
The equiprobability principle applied to these velocities means that the statistical weight pi(v_0, v_1, .., v_(N-1)) must be a constant if

231
00:23:36,450 --> 00:23:45,230
the vector (v_0.. v_(N-1)) is on the surface of these hypersphere, and 0 otherwise.

232
00:23:47,150 --> 00:23:51,410
This means that the set of velocities

233
00:23:51,410 --> 00:23:57,400
is a random vector on the surface of the 2N-dimensional hypersphere.

234
00:23:58,170 --> 00:24:07,070
Fortunately, we just became expert in the subject of sampling a random point on the surface of a hypersphere,

235
00:24:07,720 --> 00:24:12,850
using 2N independent Gaussian random numbers.

236
00:24:14,160 --> 00:24:22,140
Remember that the algorithm direct_surface.py involves a rescaling of velocities.

237
00:24:23,110 --> 00:24:33,550
but that this rescaling became unnecessary in high dimension if the variance of the Gaussian was chosen correctly.

238
00:24:34,700 --> 00:24:41,670
In our case, we have to choose each component v_x or v_y

239
00:24:41,670 --> 00:24:52,090
according to a probability pi(v_x) proportional to exp(-v_x^2 / (2 sigma^2))

240
00:24:53,490 --> 00:25:03,390
where sigma = sqrt((2/m) (Ekin / 2 N)) 

241
00:25:03,390 --> 00:25:16,700
or more generally in d dimensions rather than two dimensions: sqrt((2/m) (Ekin / dN) )

242
00:25:17,410 --> 00:25:28,020
Look here, at the distribution of the radius r in the algorithm direct_surface.py before rescaling

243
00:25:29,180 --> 00:25:36,710
and see that it becomes sharper and sharper with increasing particle number right at the correct value

244
00:25:37,710 --> 00:25:45,460
this means that each velocity component is a Gaussian random number.

245
00:25:46,690 --> 00:25:56,040
This is the Maxwell distribution. It is really famous, yet we have derived it by ourselves.

246
00:25:58,570 --> 00:26:08,550
The total kinetic energy divided by d N is the mean energy per degree of freedom

247
00:26:09,360 --> 00:26:13,500
and it is equal to one half kB times T

248
00:26:13,500 --> 00:26:18,410
where T is the temperature in Kelvin

249
00:26:18,410 --> 00:26:22,410
and kB is the famous Boltzmann constant.

250
00:26:22,410 --> 00:26:32,680
We find that the variance sigma^2 of the Gaussians describing the velocity distribution in our system

251
00:26:32,680 --> 00:26:39,470
is given by sigma^2 = kB T / m

252
00:26:39,470 --> 00:26:44,530
And we finally arrived at the probability distribution

253
00:26:44,530 --> 00:26:55,010
of each velocity component of each particle, pi(v) proportional to exp(-v^2)

254
00:26:56,360 --> 00:27:04,890
Now remember that the velocity of each particle was given as v = vx,vy

255
00:27:06,050 --> 00:27:13,360
so the velocity distribution of the absolute value of the velocity

256
00:27:13,360 --> 00:27:24,010
is given by pi(v) proportional to v exp(-v^2)

257
00:27:24,740 --> 00:27:33,420
because the volume element dvx dvy can be written as 2 pi v dv

258
00:27:35,330 --> 00:27:43,360
In three dimensions, we do the same thing with vx,vy,vz

259
00:27:44,570 --> 00:27:51,400
the probability distribution for each component is unchanged: it is a Gaussian

260
00:27:51,880 --> 00:28:03,640
but the probability distribution of the absolute value of the velocity is now proportional to v^2 exp(-v^2), as shown here

261
00:28:05,050 --> 00:28:09,860
We can compare the Maxwell distribution that we just derived

262
00:28:09,860 --> 00:28:17,960
with the simulation results obtained by event_disk_box.py in the second week

263
00:28:17,960 --> 00:28:27,550
and check that the histogram of each velocity component of an individual particle is a Gaussian

264
00:28:27,550 --> 00:28:31,550
The probability distribution is like exp(-v^2)

265
00:28:33,040 --> 00:28:43,300
Furthermore, we can check that the probability distribution of the absolute value of the velocity of each particle

266
00:28:43,300 --> 00:28:49,490
is also given by a Gaussian: v exp(-v^2)

267
00:28:49,490 --> 00:28:57,740
So we find that in order to introduce velocities into the Monte Carlo scheme

268
00:28:57,740 --> 00:29:07,700
we have to sample independently from the particle positions the velocities from a Gaussian with some rescaling

269
00:29:08,200 --> 00:29:19,550
We thus established the complete symmetry between the molecular dynamics approach and the Monte Carlo sampling approach.

270
00:29:24,290 --> 00:29:28,550
So finally let us look again at the Maxwell distribution

271
00:29:28,550 --> 00:29:34,940
which has the form exp(- energy / kB T)

272
00:29:34,940 --> 00:29:39,220
this is for one particle and one component

273
00:29:39,220 --> 00:29:47,530
but it also applies to a subsystem of particles inside a larger simulation box,

274
00:29:47,530 --> 00:29:55,470
for example cut-off by boxes that allow exchange of energy and momentum.

275
00:29:56,710 --> 00:30:11,710
Such a subsystem has energy E that may vary and the probability distribution pi(E) is proportional to exp(-E / kB T)

276
00:30:13,030 --> 00:30:23,880
We have arrived at the Boltzmann distribution, the second pillar of statistical mechanics, and we have done it all by ourselves.

277
00:30:28,430 --> 00:30:36,300
In conclusion we have studied in this fourth lecture of Statistical Mechanics: Algorithms and Computations

278
00:30:36,300 --> 00:30:41,830
the intricate relationship between sampling and integration

279
00:30:43,160 --> 00:30:50,670
the change of variables in integration was mirrored in the process of sample transformation

280
00:30:52,440 --> 00:31:01,350
The most important such change of variable or the most important sample transformation

281
00:31:01,350 --> 00:31:09,060
appeared in multi-dimensions from Gaussians to an isotropic distribution

282
00:31:09,060 --> 00:31:17,850
This magnificent relationship between Gaussians and isotropic distributions

283
00:31:17,850 --> 00:31:22,560
was very well understood by the founders of statistical mechanics

284
00:31:22,560 --> 00:31:29,660
and it produced the Maxwell distribution, and by generalization the Boltzmann distribution

285
00:31:29,660 --> 00:31:36,760
It is now time for you to study the simple programs that come with this lecture

286
00:31:36,760 --> 00:31:42,730
the math is simple and the concepts are clear

287
00:31:42,730 --> 00:31:46,730
yet the implications are far-reaching.

288
00:31:48,500 --> 00:31:56,420
What we discussed here will be considerably deepened in this week's tutorial and homework sessions.

289
00:31:58,390 --> 00:32:08,080
Next week we'll take out first steps into the field of quantum physics and quantum statistical mechanics.

290
00:32:09,430 --> 00:32:15,590
In the meantime, have fun with tutorial 4 and homework session 4.

291
00:32:16,260 --> 00:32:22,300
And see you again next week at Statistical Mechanics: Algorithms and Computations.