Skip to content
4 changes: 2 additions & 2 deletions Project1/LIGOMainProject.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@
"celltoolbar": "Hide code",
"hide_code_all_hidden": false,
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1585,7 +1585,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
6 changes: 4 additions & 2 deletions Recitation1/Recitation_01_learner.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"\n",
"There's also an optional section for the exponential distribution if you finish the above in time.\n",
"\n",
"Note: had already worked on this but it didn't save!\n",
"\n",
"<!--end-block-->"
]
},
Expand Down Expand Up @@ -822,7 +824,7 @@
"metadata": {
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -836,7 +838,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
180 changes: 108 additions & 72 deletions Recitation10/Recitation_10_v1.ipynb

Large diffs are not rendered by default.

109 changes: 88 additions & 21 deletions Recitation11/spherical_harmonics.ipynb

Large diffs are not rendered by default.

194 changes: 193 additions & 1 deletion Recitation12/MIT_8S50_recitation_12.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1,193 @@
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"MIT_8S50_recitation_12.ipynb","provenance":[],"collapsed_sections":[]},"kernelspec":{"display_name":"Python 3","name":"python3"}},"cells":[{"cell_type":"markdown","metadata":{"id":"j_OYjrski6wJ"},"source":["# MIT_8.S50 Recitation 12: Additional features of the Discrete Fourier Transform (DFT)\n","\n","Author: Juan Mena-Parra\n","\n","Date: December 08, 2021\n"]},{"cell_type":"markdown","source":["# Preliminaries\n","\n","QUESTION: What is the Fourier transform of $f(t)=\\sin(\\omega t)$? and of $f(t)=e^{i\\omega t}$?\n"],"metadata":{"id":"u9C9AJMv4shG"}},{"cell_type":"markdown","source":["# Part 1\n","\n","The discrete Fourier transform (DFT) of a discrete signal $f(n)$ of lenght $N$ is\n","\n","$F(k) = \\sum_{n=0}^{N-1} f(n)e^{-i2\\pi k n/N}$\n","\n","The inverse discrete Fourier transform (IDFT) is\n","\n","$x(n) = \\frac{1}{N}\\sum_{k=0}^{N-1} F(k)e^{i2\\pi k n/N}$\n","\n","For what follows, you may need to write functions that implement the DFT and IDFT of a function for given values of $k$ and $n$, respectively\n"],"metadata":{"id":"jnxnxlpt49Pe"}},{"cell_type":"code","metadata":{"id":"KEi4u01GLuE-","executionInfo":{"status":"ok","timestamp":1641915586147,"user_tz":300,"elapsed":4,"user":{"displayName":"Juan David Mena","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GitLOFy2FYeZTcocC3230KsRS0NCBCmzitpTP3zzw=s64","userId":"04300883876663913307"}}},"source":["# Add your code here"],"execution_count":1,"outputs":[]},{"cell_type":"markdown","source":["Consider the discrete function $x(n)=\\sin(2\\pi\\cdot 0.02n)$\n","\n","Plot $x(n)$\n","\n","QUESTION: What is the period of $x(n)$ in samples? This corresponds to an analog signal sampled at 100 Hz. What was the period of the analog signal in seconds?\n","\n","For $N=100$ compute the $X(k)=DFT\\{x(n)\\}$ for $k=0, \\cdots N-1$. Plot |X(k)| vs $k$. \n","\n","QUESTION: Is |X(k)| what you expected based on your intuition from the Fourier transform of a sine function of continuous time $t$? yes/no, why?\n","\n","Compute $y(n)=IDFT\\{X(k)\\}$ for $n=0, \\cdots N-1$. Plot $y(n)$ vs $n$.\n","\n","QUESTION: is $y(n)=x(n)$ from $n=0, \\cdots N-1$? yes/no, why?\n","\n","Compute $z(n)=IDFT\\{X(k)\\}$ for $n=0, \\cdots 3N-1$. Plot $z(n)$ vs $n$.\n","\n","QUESTION: is $z(n)=x(n)$ from $n=0, \\cdots 3N-1$? yes/no, why?"],"metadata":{"id":"x9OqOQQmrbpW"}},{"cell_type":"code","metadata":{"id":"zVKxHwN839vn","executionInfo":{"status":"ok","timestamp":1641915636126,"user_tz":300,"elapsed":3,"user":{"displayName":"Juan David Mena","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GitLOFy2FYeZTcocC3230KsRS0NCBCmzitpTP3zzw=s64","userId":"04300883876663913307"}}},"source":["# Add your plots here"],"execution_count":2,"outputs":[]},{"cell_type":"markdown","source":["# Part 2\n","\n","Repeat the same procedure above and answer the same questions for $x(n)=\\sin(2\\pi\\cdot 0.025n)$\n"],"metadata":{"id":"GEjvLbYqxt-C"}},{"cell_type":"code","source":["# Add your plots here"],"metadata":{"id":"nN660UbWxsQF","executionInfo":{"status":"ok","timestamp":1641915649096,"user_tz":300,"elapsed":156,"user":{"displayName":"Juan David Mena","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GitLOFy2FYeZTcocC3230KsRS0NCBCmzitpTP3zzw=s64","userId":"04300883876663913307"}}},"execution_count":3,"outputs":[]},{"cell_type":"markdown","source":["# Part 3\n","\n","QUESTION: How does the DFT help with the inversion of $N^{-1}d$ for the CMB project? What are the trade-offs, if any?\n"],"metadata":{"id":"dcOoJNYqmRbA"}}]}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "j_OYjrski6wJ"
},
"source": [
"# MIT_8.S50 Recitation 12: Additional features of the Discrete Fourier Transform (DFT)\n",
"\n",
"Author: Juan Mena-Parra\n",
"\n",
"Date: December 08, 2021\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "u9C9AJMv4shG"
},
"source": [
"# Preliminaries\n",
"\n",
"QUESTION: What is the Fourier transform of $f(t)=\\sin(\\omega t)$? and of $f(t)=e^{i\\omega t}$?\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "jnxnxlpt49Pe"
},
"source": [
"# Part 1\n",
"\n",
"The discrete Fourier transform (DFT) of a discrete signal $f(n)$ of lenght $N$ is\n",
"\n",
"$F(k) = \\sum_{n=0}^{N-1} f(n)e^{-i2\\pi k n/N}$\n",
"\n",
"The inverse discrete Fourier transform (IDFT) is\n",
"\n",
"$x(n) = \\frac{1}{N}\\sum_{k=0}^{N-1} F(k)e^{i2\\pi k n/N}$\n",
"\n",
"For what follows, you may need to write functions that implement the DFT and IDFT of a function for given values of $k$ and $n$, respectively\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"executionInfo": {
"elapsed": 4,
"status": "ok",
"timestamp": 1641915586147,
"user": {
"displayName": "Juan David Mena",
"photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GitLOFy2FYeZTcocC3230KsRS0NCBCmzitpTP3zzw=s64",
"userId": "04300883876663913307"
},
"user_tz": 300
},
"id": "KEi4u01GLuE-"
},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"def DFT(f,k):\n",
" fk = 0\n",
" for i in range(len(f)):\n",
" fk += f[i]*np.exp(-2*np.pi *k * i / len(f) * j)\n",
" return fk"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "x9OqOQQmrbpW"
},
"source": [
"Consider the discrete function $x(n)=\\sin(2\\pi\\cdot 0.02n)$\n",
"\n",
"Plot $x(n)$\n",
"\n",
"QUESTION: What is the period of $x(n)$ in samples? This corresponds to an analog signal sampled at 100 Hz. What was the period of the analog signal in seconds?\n",
"\n",
"For $N=100$ compute the $X(k)=DFT\\{x(n)\\}$ for $k=0, \\cdots N-1$. Plot |X(k)| vs $k$. \n",
"\n",
"QUESTION: Is |X(k)| what you expected based on your intuition from the Fourier transform of a sine function of continuous time $t$? yes/no, why?\n",
"\n",
"Compute $y(n)=IDFT\\{X(k)\\}$ for $n=0, \\cdots N-1$. Plot $y(n)$ vs $n$.\n",
"\n",
"QUESTION: is $y(n)=x(n)$ from $n=0, \\cdots N-1$? yes/no, why?\n",
"\n",
"Compute $z(n)=IDFT\\{X(k)\\}$ for $n=0, \\cdots 3N-1$. Plot $z(n)$ vs $n$.\n",
"\n",
"QUESTION: is $z(n)=x(n)$ from $n=0, \\cdots 3N-1$? yes/no, why?"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"executionInfo": {
"elapsed": 3,
"status": "ok",
"timestamp": 1641915636126,
"user": {
"displayName": "Juan David Mena",
"photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GitLOFy2FYeZTcocC3230KsRS0NCBCmzitpTP3zzw=s64",
"userId": "04300883876663913307"
},
"user_tz": 300
},
"id": "zVKxHwN839vn"
},
"outputs": [],
"source": [
"# Add your plots here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "GEjvLbYqxt-C"
},
"source": [
"# Part 2\n",
"\n",
"Repeat the same procedure above and answer the same questions for $x(n)=\\sin(2\\pi\\cdot 0.025n)$\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"executionInfo": {
"elapsed": 156,
"status": "ok",
"timestamp": 1641915649096,
"user": {
"displayName": "Juan David Mena",
"photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GitLOFy2FYeZTcocC3230KsRS0NCBCmzitpTP3zzw=s64",
"userId": "04300883876663913307"
},
"user_tz": 300
},
"id": "nN660UbWxsQF"
},
"outputs": [],
"source": [
"# Add your plots here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "dcOoJNYqmRbA"
},
"source": [
"# Part 3\n",
"\n",
"QUESTION: How does the DFT help with the inversion of $N^{-1}d$ for the CMB project? What are the trade-offs, if any?\n"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "MIT_8S50_recitation_12.ipynb",
"provenance": []
},
"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.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Loading