1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
{
"metadata": {
"name": "",
"signature": "sha256:3790a3d51914dcd136e5ca3ce886512d33fbd8ae15c97de507356c2c79104f21"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 16: Cosmology and Modern Astrophysics - The Beginning and the End"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.1, Page 581"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"H0 = 22; # Value of Hubble constant, km/s per million ly\n",
"parsec = 3.26; # The value of 1 parsec, light years\n",
"\n",
"#Calculations&Result\n",
"print \"The value of Hubble constant = %d km/s per Mpc\"%math.ceil(H0*parsec)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The value of Hubble constant = 72 km/s per Mpc\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.2, Page 583"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"M = 1; # Let the current mass of the universe be unity\n",
"m_u = 1; # Mass equivalent of 1 amu, u\n",
"N_n = 2; # Number of neutrons in helium\n",
"N_p = 2; # Number of protons in helium\n",
"\n",
"#Calculations\n",
"M_p = 0.75*M*m_u; # Total mass of protons\n",
"M_He = 0.25*M*m_u; # Total mass of helium\n",
"N_fp = M_p/M_He*(N_n + N_p); # Total number of free protons for every He-4\n",
"N_P = N_fp + N_p; # Total number of protons per He-4\n",
"ratio = N_P/N_n; # Current ratio of protons to the neutrons in the universe\n",
"\n",
"#Result\n",
"print \"The current ratio of protons to the neutrons in the universe = %d\"%ratio"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current ratio of protons to the neutrons in the universe = 7\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.3, Page 607"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"m_n = 939.566; # Rest mass of the neutron, MeV/c^2\n",
"m_p = 938.272; # Rest mass of the proton, MeV/c^2\n",
"e = 1.6e-019; # Energy equivalent of 1 eV, J\n",
"c = 1; # For simplicity assume speed of light of light to be unity\n",
"T = 1e+010; # Temperature of the universe, K\n",
"\n",
"#Calculations\n",
"delta_m = m_n - m_p; # Mass difference between a proton and a neutron, MeV/c^2\n",
"k = 1.38e-023; # Boltzmann constant, J/k\n",
"# As from Maxwell-Boltzmann distribution from thermodynamics, N = exp(-m*c^2/(k*T)), so\n",
"ratio = math.exp(delta_m*c**2*1e+006*e/(k*T)); # Ratio of protons to neutrons in the universe at 10 billion kelvin\n",
"\n",
"#Result\n",
"print \"The ratio of protons to neutrons in the universe at 10 billion kelvin = %3.1f\"%ratio"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The ratio of protons to neutrons in the universe at 10 billion kelvin = 4.5\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.4, Page 589"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"M = 1.99e+030; # Mass of the sun, kg\n",
"G = 6.67e-011; # Universal gravitational constant, N-Sq.m/kg^2\n",
"k = 1.38e-023; # Boltzmann constant, J/K\n",
"R = 6.96e+008; # Radius of the sun, m\n",
"m = 1.67e-027; # Rest mass of the proton, kg\n",
"\n",
"#Calculations\n",
"PE = 3./5*(G*M**2/R); # Self potential energy of the sun, J\n",
"# As KE = 1./3*(M/m_p)*m_p*v**2, solving for v\n",
"v = math.sqrt(2*PE/M); # Velocity of a proton inside the sun, m/s\n",
"# From kinetic theory of gases, v = sqrt(3*k*T/m), solving for T\n",
"T = m*v**2/(3*k); # The mean temperature of the sun, K\n",
"\n",
"#Result\n",
"print \"The mean temperature of the sun = %1.0e K\"%T"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The mean temperature of the sun = 9e+06 K\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.5, Page 590"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"M_sun = 1.99e+030; # Mass of the sun, kg\n",
"m_n = 1.675e-027; # Rest mass of the neutron, kg\n",
"h = 6.62e-034; # Planck's constant, Js\n",
"\n",
"#Calculations\n",
"h_bar = h/(2*math.pi); # Planck's constant, Js\n",
"G = 6.67e-011; # Universal gravitational constant, N-Sq.m/kg^2\n",
"N = 2*M_sun/m_n; # Number of neutrons in the neutron star\n",
"V = (6.5*h_bar**2/(N**(1./3)*m_n**3*G))**3; # Volume of the neutron star, metre cube\n",
"R = (3./(4*math.pi)*V)**(1./3); # The radius of neutron star, m\n",
"\n",
"#Result\n",
"print \"The radius of the neutron star of 2 solar masses = %d km\"%math.ceil(R/1e+003)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The radius of the neutron star of 2 solar masses = 11 km\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.7, Page 598"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"c = 1; # For simplicity assume speed of light to be unity, m/s\n",
"d = 1.6e+005; # Distance of the supernova 1987A from the earth, ly\n",
"m = 16; # Mass of heavier neutrino, eV/c^2;\n",
"E = 20e+006; # Energy of the neutrino, eV\n",
"\n",
"#Calculations\n",
"delta_t = d/(2*c)*(m/E)**2; # Difference between the travel times of the lighter and the massive neutrinos, y\n",
"\n",
"#Result\n",
"print \"The difference between the travel times of the lighter and the massive neutrinos = %3.1f s\"%(delta_t*(365.25*24*60*60))"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The difference between the travel times of the lighter and the massive neutrinos = 1.6 s\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.8, Page 602"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"c = 3.00e+008; # Speed of light, m/s\n",
"H = 22; # Hubble constant, km/s per million ly\n",
"G = 6.67e-011; # Universal gravitational constant, N-Sq.m/kg^2\n",
"\n",
"#Calculations\n",
"rho_c = 3/(8*math.pi)*H**2/G*1e+003/(c*365.25*24*60*60*1e+006)**2; # The critical density of the universe, g/cc\n",
"\n",
"#Result\n",
"print \"The critical density of the universe = %3.1e g/cc\"%rho_c"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The critical density of the universe = 9.7e-30 g/cc\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 16.9, Page 604"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"H0 = 71; # Hubble constant, km/s per Mpc\n",
"\n",
"#Calculations\n",
"tau = 1./H0*1e+006*3.26*9.46e+012/3.16e+007; # The upper limit of the age of the universe, y\n",
"\n",
"#Result\n",
"print \"The upper limit of the age of the universe = %4.2e y\"%tau"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The upper limit of the age of the universe = 1.37e+10 y\n"
]
}
],
"prompt_number": 8
}
],
"metadata": {}
}
]
}
|