add assignments
This commit is contained in:
commit
1f810ec1da
Binary file not shown.
@ -0,0 +1,154 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from scipy.integrate import quad\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"import PyCosmo"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'0.4.3'"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"PyCosmo.__version__"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 1. Age of the Universe\n",
|
||||
"\n",
|
||||
"We recall the Friedmann equation, which describes the evolution of the scale factor $a(t)$:\n",
|
||||
"\\begin{equation}\n",
|
||||
"H^2(t) = \\frac{8\\pi G}{3}\\left[ \\rho(t) + \\frac{\\rho_\\mathrm{crit} - \\rho_0}{a^2(t)} \\right],\n",
|
||||
"\\end{equation}\n",
|
||||
"where $H(t)\\equiv\\dot{a}/a$ is the Hubble rate, $G$ is Newton's constant, $\\rho(t)$ is the energy density in the unverse as a function of time with $\\rho_0$ being its value today. The critical density $\\rho_\\mathrm{crit}\\equiv\\frac{3H_0^2}{8\\pi G}$.\n",
|
||||
"1. Assume that the Universe is flat with matter and a cosmological constant, whose energy density remains constant with time. Re-write the Friedmann equation as\n",
|
||||
"\t\\begin{equation}\n",
|
||||
"\t\\mathrm{d}t = H_0^{-1}\\frac{\\mathrm{d}a}{a}\\left[ \\Omega_\\Lambda + \\frac{1 - \\Omega_\\Lambda}{a^3} \\right]^{-1/2},\n",
|
||||
"\t\\end{equation}\n",
|
||||
"\twhere $\\Omega_\\Lambda$ is the ratio of the energy density in the cosmological constant to the critical density.\n",
|
||||
"2. We can integrate this equation from $a=0$ (when $t=0$) until today ($a=1$) to get the age of the universe today. Compute the integral for the following cases:\n",
|
||||
"\t- a universe with only matter $\\Omega_\\Lambda = 0$ (analytically).\n",
|
||||
"\t- a universe dominated by dark energy $\\Omega_\\Lambda = 0.7$ (numerically).\n",
|
||||
"\t- For a fixed $H_0$, which universe is older?\n",
|
||||
"\t"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Integral: 0.50000\n",
|
||||
"Estimated Error: 0.00000\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Example on how to define functions and intergrate numerically\n",
|
||||
"\n",
|
||||
"# define a function\n",
|
||||
"f = lambda x: x\n",
|
||||
"\n",
|
||||
"# integrate from 0 to 1\n",
|
||||
"i, e = quad(f, 0, 1)\n",
|
||||
"\n",
|
||||
"# i contains the numerically integrated value\n",
|
||||
"# e contains the estimated error\n",
|
||||
"print(\"Integral: %.5f\" %(i))\n",
|
||||
"print(\"Estimated Error: %.5f\" %(e))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# TODO: calculate the age of the universe numerically\n",
|
||||
"# by following the example above.\n",
|
||||
"# Define the proper function and integrate it numerically"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2. Angular diameter distance\n",
|
||||
"\n",
|
||||
"Consider a galaxy of physical (visible) size of 5 kpc (1 pc $\\approx$ 3.26 light-years). What angle would the galaxy subtend if situated at redshift 0.1? Redshift 1.0?\n",
|
||||
"\n",
|
||||
"1. Do the calculation analytically in a flat universe, that contains only matter $\\Omega_M = 1.0$.\n",
|
||||
"\n",
|
||||
"2. Use PyCosmo and do the calculation numercally for a universe with the following parameters $\\Omega_M = 0.25$, $\\Omega_\\Lambda=0.7$ and $\\Omega_b=0.05$."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Define the Cosmology\n",
|
||||
"Cosmo = PyCosmo.build()\n",
|
||||
"#TODO: Set the parameters accordingle\n",
|
||||
"Cosmo.set(h=0.7, omega_b=, omega_m=, omega_l_in=\"flat\")\n",
|
||||
"\n",
|
||||
"# Function to calculate the angular diameter distance (returns result in Mpc)\n",
|
||||
"# uses the scaling parameter as input\n",
|
||||
"# dist_ang = Cosmo.background.dist_ang_a(a=...)\n",
|
||||
"\n",
|
||||
"# TODO: calculate the angle of the galaxy"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
BIN
problem-set-3/Cosmological_Probes___Problem_Sets___HS2023.pdf
Normal file
BIN
problem-set-3/Cosmological_Probes___Problem_Sets___HS2023.pdf
Normal file
Binary file not shown.
154
problem-set-3/Problem_Set_3_hints.ipynb
Normal file
154
problem-set-3/Problem_Set_3_hints.ipynb
Normal file
@ -0,0 +1,154 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from scipy.integrate import quad\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"import PyCosmo"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'0.4.3'"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"PyCosmo.__version__"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 1. Age of the Universe\n",
|
||||
"\n",
|
||||
"We recall the Friedmann equation, which describes the evolution of the scale factor $a(t)$:\n",
|
||||
"\\begin{equation}\n",
|
||||
"H^2(t) = \\frac{8\\pi G}{3}\\left[ \\rho(t) + \\frac{\\rho_\\mathrm{crit} - \\rho_0}{a^2(t)} \\right],\n",
|
||||
"\\end{equation}\n",
|
||||
"where $H(t)\\equiv\\dot{a}/a$ is the Hubble rate, $G$ is Newton's constant, $\\rho(t)$ is the energy density in the unverse as a function of time with $\\rho_0$ being its value today. The critical density $\\rho_\\mathrm{crit}\\equiv\\frac{3H_0^2}{8\\pi G}$.\n",
|
||||
"1. Assume that the Universe is flat with matter and a cosmological constant, whose energy density remains constant with time. Re-write the Friedmann equation as\n",
|
||||
"\t\\begin{equation}\n",
|
||||
"\t\\mathrm{d}t = H_0^{-1}\\frac{\\mathrm{d}a}{a}\\left[ \\Omega_\\Lambda + \\frac{1 - \\Omega_\\Lambda}{a^3} \\right]^{-1/2},\n",
|
||||
"\t\\end{equation}\n",
|
||||
"\twhere $\\Omega_\\Lambda$ is the ratio of the energy density in the cosmological constant to the critical density.\n",
|
||||
"2. We can integrate this equation from $a=0$ (when $t=0$) until today ($a=1$) to get the age of the universe today. Compute the integral for the following cases:\n",
|
||||
"\t- a universe with only matter $\\Omega_\\Lambda = 0$ (analytically).\n",
|
||||
"\t- a universe dominated by dark energy $\\Omega_\\Lambda = 0.7$ (numerically).\n",
|
||||
"\t- For a fixed $H_0$, which universe is older?\n",
|
||||
"\t"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Integral: 0.50000\n",
|
||||
"Estimated Error: 0.00000\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Example on how to define functions and intergrate numerically\n",
|
||||
"\n",
|
||||
"# define a function\n",
|
||||
"f = lambda x: x\n",
|
||||
"\n",
|
||||
"# integrate from 0 to 1\n",
|
||||
"i, e = quad(f, 0, 1)\n",
|
||||
"\n",
|
||||
"# i contains the numerically integrated value\n",
|
||||
"# e contains the estimated error\n",
|
||||
"print(\"Integral: %.5f\" %(i))\n",
|
||||
"print(\"Estimated Error: %.5f\" %(e))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# TODO: calculate the age of the universe numerically\n",
|
||||
"# by following the example above.\n",
|
||||
"# Define the proper function and integrate it numerically"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2. Angular diameter distance\n",
|
||||
"\n",
|
||||
"Consider a galaxy of physical (visible) size of 5 kpc (1 pc $\\approx$ 3.26 light-years). What angle would the galaxy subtend if situated at redshift 0.1? Redshift 1.0?\n",
|
||||
"\n",
|
||||
"1. Do the calculation analytically in a flat universe, that contains only matter $\\Omega_M = 1.0$.\n",
|
||||
"\n",
|
||||
"2. Use PyCosmo and do the calculation numercally for a universe with the following parameters $\\Omega_M = 0.25$, $\\Omega_\\Lambda=0.7$ and $\\Omega_b=0.05$."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Define the Cosmology\n",
|
||||
"Cosmo = PyCosmo.build()\n",
|
||||
"#TODO: Set the parameters accordingle\n",
|
||||
"Cosmo.set(h=0.7, omega_b=, omega_m=, omega_l_in=\"flat\")\n",
|
||||
"\n",
|
||||
"# Function to calculate the angular diameter distance (returns result in Mpc)\n",
|
||||
"# uses the scaling parameter as input\n",
|
||||
"# dist_ang = Cosmo.background.dist_ang_a(a=...)\n",
|
||||
"\n",
|
||||
"# TODO: calculate the angle of the galaxy"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from scipy.integrate import quad\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"import PyCosmo"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'2.1.1'"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"PyCosmo.__version__"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 1. Wavenumber at equality\n",
|
||||
"1. Assume that around equality the dominant components are matter and radiation. Use the first Friedmann equation i.e.: \n",
|
||||
"\n",
|
||||
"\t\\begin{equation}\n",
|
||||
"\tH^2 = H_0^2[\\sum_i \\Omega_i a^{-3(1+w)}],\n",
|
||||
"\t\\end{equation}\n",
|
||||
" \n",
|
||||
" to calculate $a_{eq}$, $H(a_{eq})$ and therefore $k_{eq}$.\n",
|
||||
" \n",
|
||||
" How might you identify $k_{eq}$ in a cosmological observable? Can you make a plot which includes this scale using PyCosmo? Do yout think this has been observed in data?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2. Growth factor\n",
|
||||
"\n",
|
||||
"Here compute the growth factor for various cosmologies. The basic command in PyCosmo is shown below"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "SyntaxError",
|
||||
"evalue": "invalid syntax (4003919975.py, line 4)",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;36m Cell \u001b[0;32mIn[10], line 4\u001b[0;36m\u001b[0m\n\u001b[0;31m Cosmo.set(h=0.7, omega_b=, omega_m=)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Define the Cosmology\n",
|
||||
"Cosmo = PyCosmo.build()\n",
|
||||
"#TODO: Set the parameters accordingly\n",
|
||||
"Cosmo.set(h=0.7, omega_b=, omega_m=)\n",
|
||||
"\n",
|
||||
"# Function to calculate the growth factor\n",
|
||||
"# uses the scaling parameter as input\n",
|
||||
"growth_factor = Cosmo.lin_pert.growth_a(a=...)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
BIN
problem-set-4/Cosmological_Probes___Problem_Sets___HS2023.pdf
Normal file
BIN
problem-set-4/Cosmological_Probes___Problem_Sets___HS2023.pdf
Normal file
Binary file not shown.
116
problem-set-4/Problem_Set_4_hints.ipynb
Normal file
116
problem-set-4/Problem_Set_4_hints.ipynb
Normal file
@ -0,0 +1,116 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from scipy.integrate import quad\n",
|
||||
"\n",
|
||||
"import numpy as np\n",
|
||||
"\n",
|
||||
"import PyCosmo"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'2.1.1'"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"PyCosmo.__version__"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 1. Wavenumber at equality\n",
|
||||
"1. Assume that around equality the dominant components are matter and radiation. Use the first Friedmann equation i.e.: \n",
|
||||
"\n",
|
||||
"\t\\begin{equation}\n",
|
||||
"\tH^2 = H_0^2[\\sum_i \\Omega_i a^{-3(1+w)}],\n",
|
||||
"\t\\end{equation}\n",
|
||||
" \n",
|
||||
" to calculate $a_{eq}$, $H(a_{eq})$ and therefore $k_{eq}$.\n",
|
||||
" \n",
|
||||
" How might you identify $k_{eq}$ in a cosmological observable? Can you make a plot which includes this scale using PyCosmo? Do yout think this has been observed in data?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2. Growth factor\n",
|
||||
"\n",
|
||||
"Here compute the growth factor for various cosmologies. The basic command in PyCosmo is shown below"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "SyntaxError",
|
||||
"evalue": "invalid syntax (4003919975.py, line 4)",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;36m Cell \u001b[0;32mIn[10], line 4\u001b[0;36m\u001b[0m\n\u001b[0;31m Cosmo.set(h=0.7, omega_b=, omega_m=)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Define the Cosmology\n",
|
||||
"Cosmo = PyCosmo.build()\n",
|
||||
"#TODO: Set the parameters accordingly\n",
|
||||
"Cosmo.set(h=0.7, omega_b=, omega_m=)\n",
|
||||
"\n",
|
||||
"# Function to calculate the growth factor\n",
|
||||
"# uses the scaling parameter as input\n",
|
||||
"growth_factor = Cosmo.lin_pert.growth_a(a=...)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.8"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user