Created
May 4, 2023 15:50
-
-
Save kolibril13/fdfbadb77d432469d706515f56c2fbe5 to your computer and use it in GitHub Desktop.
jupyter-step-by-step
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"tags": [], | |
"user_expressions": [] | |
}, | |
"source": [ | |
"# Welcome to this step-by-step turorial!\n", | |
"## Press here to start ➡️" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"tags": [], | |
"user_expressions": [] | |
}, | |
"source": [ | |
"# Task 1) $e^x$ and $x^2$" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"import matplotlib.pyplot as plt\n", | |
"plt.rcParams['lines.linewidth'] = 2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"fig, ax = plt.subplots(figsize=(5, 3))\n", | |
"x = np.linspace(0, 5, 1001)\n", | |
"y = np.exp(x)\n", | |
"ax.plot(x, y, label=r\"$e^x$\")\n", | |
"ax.plot(x, x**2, label= r\"$x^2$\")\n", | |
"ax.legend(loc=\"lower right\", fontsize=14);" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"user_expressions": [] | |
}, | |
"source": [ | |
"**Question:** \n", | |
"Which function grows faster: $e^x$ or $x^2$ ? \n", | |
"*Note: Please plot both functions in the above cell for comparison*\n", | |
"\n", | |
"- [x] $e^x$\n", | |
"- [ ] $x^2$ " | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"user_expressions": [] | |
}, | |
"source": [ | |
"# ✅ 🎉 Correct! \n", | |
"## Next task ➡️" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"user_expressions": [] | |
}, | |
"source": [ | |
"# Task 2) Finding the amplitude" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"fig, ax = plt.subplots(figsize=(5, 3))\n", | |
"\n", | |
"x = np.linspace(0, 4 * np.pi, 1001)\n", | |
"ax.plot(x, 2 * np.sin(x), label=\"Sin\")\n", | |
"ax.legend(loc=\"lower right\", fontsize=14);" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"tags": [], | |
"user_expressions": [] | |
}, | |
"source": [ | |
"**Question:** \n", | |
"What is the amplitude of this sin function? \n", | |
"*Note: Please plot both functions in the above cell for comparison*\n", | |
"\n", | |
"- [x] 1\n", | |
"- [ ] 2\n", | |
"- [ ] 4\n" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": { | |
"user_expressions": [] | |
}, | |
"source": [ | |
"## ❌ Try again!" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"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.11.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment