Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One exercise, hiding code cells #6

Merged
merged 3 commits into from Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
125 changes: 107 additions & 18 deletions notebooks/background/functions/00_basic_notation.ipynb
Expand Up @@ -79,29 +79,81 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The output of random_output(5) is 15\n",
"The output of random_output(5) is 15\n",
"The output of random_output(5) is 15\n",
"The output of random_output(5) is 15\n",
"The output of random_output(5) is 10\n",
"The output of random_output(5) is 15\n",
"The output of random_output(5) is 10\n",
"The output of random_output(5) is 15\n",
"The output of random_output(5) is 10\n",
"The output of random_output(5) is 10\n"
]
"data": {
"text/html": [
"<script>\n",
"code_show=true; \n",
"function code_toggle() {\n",
" if (code_show){\n",
" $('div.input').hide();\n",
" } else {\n",
" $('div.input').show();\n",
" }\n",
" code_show = !code_show\n",
"} \n",
"$( document ).ready(code_toggle);\n",
"</script>\n",
"The raw code for this IPython notebook is by default hidden for easier reading.\n",
"To toggle on/off the raw code, click <a href=\"javascript:code_toggle()\">here</a>."
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML('''<script>\n",
"code_show=true; \n",
"function code_toggle() {\n",
" if (code_show){\n",
" $('div.input').hide();\n",
" } else {\n",
" $('div.input').show();\n",
" }\n",
" code_show = !code_show\n",
"} \n",
"$( document ).ready(code_toggle);\n",
"</script>\n",
"The raw code for this IPython notebook is by default hidden for easier reading.\n",
"To toggle on/off the raw code, click <a href=\"javascript:code_toggle()\">here</a>.''')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6744cddd0eb543d28be2301c78e9e9c7",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(description='Click to run randomization', layout=Layout(height='80px', width='50%'), style=ButtonStyle(…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import random\n",
"import re\n",
"import ipywidgets\n",
"from ipywidgets import Button, Layout\n",
"\n",
"from IPython.display import display\n",
"\n",
"# a programming function that is not a mathematical function\n",
"def random_output(number):\n",
Expand All @@ -110,10 +162,22 @@
" return 2 * number\n",
" else:\n",
" return 3 * number\n",
" \n",
"\n",
"\n",
"# let's see what happens when we run the function multiple times\n",
"for _ in range(10):\n",
" print(\"The output of random_output({}) is {}\".format(5, random_output(5)))"
"#for _ in range(10):\n",
" #print(\"The output of random_output({}) is {}\".format(5, random_output(5)))\n",
" \n",
"b = ipywidgets.Button(description='Click to run randomization',\n",
" layout=Layout(width='50%', height='80px'))\n",
"display(b)\n",
"\n",
"def on_button_clicked(b):\n",
" for _ in range(10):\n",
" print(\"The output of random_output({}) is {}\".format(5, random_output(5)))\n",
" \n",
"b.on_click(on_button_clicked)"
]
},
{
Expand Down Expand Up @@ -153,9 +217,34 @@
"Notice the difference between $\\rightarrow$ and $\\mapsto$.\n",
"The first is used when specifying the domain and co-domain, whereas the latter indicates the concrete mapping from an argument to an output."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
124 changes: 111 additions & 13 deletions notebooks/background/functions/01_monotonicity.ipynb

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion notebooks/background/general/abbreviations.ipynb
Expand Up @@ -65,7 +65,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/general/big_operators.ipynb
Expand Up @@ -202,7 +202,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/general/max_min.ipynb
Expand Up @@ -89,7 +89,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/graphs/00_basics.ipynb
Expand Up @@ -166,7 +166,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/relations/00_notation.ipynb
Expand Up @@ -144,7 +144,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/relations/01_basic_orders.ipynb
Expand Up @@ -213,7 +213,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/relations/02_closure.ipynb
Expand Up @@ -84,7 +84,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
20 changes: 19 additions & 1 deletion notebooks/background/relations/03_advanced_orders.ipynb
Expand Up @@ -197,7 +197,25 @@
]
}
],
"metadata": {},
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}