{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2020-06-09T20:58:00.136549Z", "iopub.status.busy": "2020-06-09T20:58:00.135499Z", "iopub.status.idle": "2020-06-09T20:58:01.000390Z", "shell.execute_reply": "2020-06-09T20:58:01.000658Z" }, "init_cell": true, "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "pd.set_option('display.latex.repr', True)\n", "import sympy as sym\n", "sym.init_printing(use_latex=True)\n", "import numpy as np\n", "from IPython.display import Image, Latex" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "# Markdown" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "## General" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "Some markdown text.\n", "\n", "A list:\n", "\n", "- something\n", "- something else\n", "\n", "A numbered list\n", "\n", "1. something\n", "2. something else\n", "\n", "non-ascii characters TODO" ] }, { "cell_type": "markdown", "metadata": { "ipub": {} }, "source": [ "This is a long section of text, which we only want in a document (not a presentation)\n", "some text\n", "some more text\n", "some more text\n", "some more text\n", "some more text\n", "some more text\n", "some more text\n", "some more text\n", "some more text\n" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true, "slideonly": true } }, "source": [ "This is an abbreviated section of the document text, which we only want in a presentation\n", "\n", "- summary of document text" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "## References and Citations" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "References to \\cref{fig:example}, \\cref{tbl:example}, =@eqn:example_sympy and \\cref{code:example_mpl}.\n", "\n", "A latex citation.\\cite{zelenyak_molecular_2016}\n", "\n", "A html citation.(Kirkeminde, 2012) " ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "## Todo notes" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "slide": true } }, "source": [ "\\todo[inline]{an inline todo}\n", "\n", "Some text.\\todo{a todo in the margins}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Text Output" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2020-06-09T20:58:01.003529Z", "iopub.status.busy": "2020-06-09T20:58:01.003122Z", "iopub.status.idle": "2020-06-09T20:58:01.005552Z", "shell.execute_reply": "2020-06-09T20:58:01.005184Z" }, "ipub": { "text": { "format": { "backgroundcolor": "\\color{blue!10}" } } } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "This is some printed text,\n", "with a nicely formatted output.\n", "\n" ] } ], "source": [ "print(\"\"\"\n", "This is some printed text,\n", "with a nicely formatted output.\n", "\"\"\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Images and Figures" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Displaying a plot with its code" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "caption": "fig:example_mpl" } }, "source": [ "A matplotlib figure, with the caption set in the markdowncell above the figure." ] }, { "cell_type": "markdown", "metadata": { "ipub": { "caption": "code:example_mpl" } }, "source": [ "The plotting code for a matplotlib figure (\\cref{fig:example_mpl})." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Tables (with pandas)" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "caption": "code:example_pd" } }, "source": [ "The plotting code for a pandas Dataframe table (\\cref{tbl:example})." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2020-06-09T20:58:01.010731Z", "iopub.status.busy": "2020-06-09T20:58:01.010410Z", "iopub.status.idle": "2020-06-09T20:58:01.021093Z", "shell.execute_reply": "2020-06-09T20:58:01.020829Z" }, "ipub": { "code": { "asfloat": true, "caption": "", "label": "code:example_pd", "placement": "H", "widefigure": false }, "table": { "alternate": "gray!20", "caption": "An example of a table created with pandas dataframe.", "label": "tbl:example", "placement": "H" } } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
abcd
0$\\delta$l0.6030.545
1xm0.4380.892
2yn0.7920.529
\n", "
" ], "text/latex": [ "\\begin{tabular}{lllrr}\n", "\\toprule\n", "{} & a & b & c & d \\\\\n", "\\midrule\n", "0 & \\$\\textbackslash delta\\$ & l & 0.603 & 0.545 \\\\\n", "1 & x & m & 0.438 & 0.892 \\\\\n", "2 & y & n & 0.792 & 0.529 \\\\\n", "\\bottomrule\n", "\\end{tabular}\n" ], "text/plain": [ " a b c d\n", "0 $\\delta$ l 0.603 0.545\n", "1 x m 0.438 0.892\n", "2 y n 0.792 0.529" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.random.seed(0) \n", "df = pd.DataFrame(np.random.rand(3,4),columns=['a','b','c','d'])\n", "df.a = ['$\\delta$','x','y']\n", "df.b = ['l','m','n']\n", "df.set_index(['a','b'])\n", "df.round(3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Equations (with ipython or sympy)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2020-06-09T20:58:01.024117Z", "iopub.status.busy": "2020-06-09T20:58:01.023659Z", "iopub.status.idle": "2020-06-09T20:58:01.026242Z", "shell.execute_reply": "2020-06-09T20:58:01.025992Z" }, "ipub": { "equation": { "label": "eqn:example_ipy" } } }, "outputs": [ { "data": { "text/latex": [ "$$ a = b+c $$" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Latex('$$ a = b+c $$')" ] }, { "cell_type": "markdown", "metadata": { "ipub": { "caption": "code:example_sym" } }, "source": [ "The plotting code for a sympy equation (=@eqn:example_sympy)." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2020-06-09T20:58:01.040077Z", "iopub.status.busy": "2020-06-09T20:58:01.039754Z", "iopub.status.idle": "2020-06-09T20:58:01.681565Z", "shell.execute_reply": "2020-06-09T20:58:01.681305Z" }, "ipub": { "code": { "asfloat": true, "caption": "", "label": "code:example_sym", "placement": "H", "widefigure": false }, "equation": { "environment": "equation", "label": "eqn:example_sympy" } } }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAb0AAAAeCAYAAAC40cCwAAAABHNCSVQICAgIfAhkiAAACc1JREFUeJztnXusHUUdxz+9vdAKtVBfNOLjFos8JNDQlohiOVWkNharaDU+0DUaY2IhikYFi68YX9iAGqEEgqBSRRIgKZY/QDAtjaiEVklaFZEjITwCEtqirUpb//jN5p7u3cfM7G939t4zn+Tm3OzO/OZ3Zn7fc2bndSASiUQikQgA00M7kEMbPs1ooYxItzg0tAMldFGHWjT93qKWh5NCPY+UZBoBzvco7IDyX5blwHwPv2w5BzijQfvDwuE0GwfaLADe1kI5rvjqUIOmtQzN6jlqWY82YkETLz1/CzjRMc9C4JOuBTkyDfgxcGQDtk8Arm3A7rDRRhw0wVrglNBOZPDRoQZttWFTeo5a1mMo9PxGk8GVLwOv9MjnyiLgh8o2R4B7gLnKdoeRtuJAmyOALXRnONFXhxq02Ybaeo5a1mUo9LwJ6Sm5co1HHl/+AIwp2vso8AtFe8NMm3GgzVXAx0I7YfDVoQZtt6GmnqOWdZnyel4G/N7D+FHANzzy+fJZ9BpjGvBX4Gwle8NM23GgzWnAo8DMwH746lCDEG2opeeoZV2GQs83At/1MJ4Ab/DI58tiYDdwmIKtpcBeYFTB1rCT0G4cNME/gfcG9sFXhxoktN+GWnqOWtYlYYrreTqwE3i/h+ErKV8Nqs1M4Hlk9VceC4FfA3uAvwFLkDe+JSftj5DhlUh92o6DJrgT+GXA8uvoUIMQbVim56jlcEw5PWffzEnAbOCPjkYPAfYB+2u5VsyFyDLXDwxc24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I7PMAE5EKmhwb8ks5LeyVluU7cImZEggb//PO80fjC8jP53xieWngc+Z/6eZtL/l4CNvPoIcuZNO4F6Q40Mfv8nqOtTxK2QcFNVznfKOBl5O/jaYEFTpUIOQbQjN6LlpLUM39VzXp1Cx0ISWwVPPq0rujVnaOBP4OXJ00LPIePtTwB3I/omiOYuFyDd4dr/I2cjJDE3wUuTRO+vTVylfVdUfSLvYXLvQ0cYB4Dc6b8OJun6NWZajHQdF9VynvJ8gYqpLgs6TXkqZDjUYs0yn3YbQnJ6b1LKNHV89J/jHjoZPY5ZlacZCE1oGPT1PeY4H3loj/zeRBpyn406kAO16zh5sHJn8RC1PDpqo56hnR+qsmNuB+9LiiDva9dzkKslIOKKWu08T9Rz1HIlEIpFIJBKJRCKRSCQSiUQikUgkEolMUv4PPtcLAlHH2usAAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle \\left(\\sqrt{5} i\\right)^{\\alpha} \\left(\\frac{1}{2} - \\frac{2 \\sqrt{5} i}{5}\\right) + \\left(- \\sqrt{5} i\\right)^{\\alpha} \\left(\\frac{1}{2} + \\frac{2 \\sqrt{5} i}{5}\\right)$" ], "text/plain": [ " \\alpha ⎛1 2⋅√5⋅ⅈ⎞ \\alpha ⎛1 2⋅√5⋅ⅈ⎞\n", "(√5⋅ⅈ) ⋅⎜─ - ──────⎟ + (-√5⋅ⅈ) ⋅⎜─ + ──────⎟\n", " ⎝2 5 ⎠ ⎝2 5 ⎠" ] }, "execution_count": 5, "metadata": { "filenames": { "image/png": "/tmp/pytest-of-choldgraf/pytest-170/test_complex_outputs_unrun_nbc0/source/_build/jupyter_execute/complex_outputs_unrun_22_0.png" } }, "output_type": "execute_result" } ], "source": [ "y = sym.Function('y')\n", "n = sym.symbols(r'\\alpha')\n", "f = y(n)-2*y(n-1/sym.pi)-5*y(n-2)\n", "sym.rsolve(f,y(n),[1,4])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Interactive outputs\n", "\n", "## ipywidgets" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2020-06-09T20:58:01.684186Z", "iopub.status.busy": "2020-06-09T20:58:01.683879Z", "iopub.status.idle": "2020-06-09T20:58:01.707915Z", "shell.execute_reply": "2020-06-09T20:58:01.708169Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "1337h4x0R", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Layout()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import ipywidgets as widgets\n", "widgets.Layout(model_id=\"1337h4x0R\")" ] } ], "metadata": { "celltoolbar": "Edit Metadata", "hide_input": false, "ipub": { "bibliography": "example.bib", "biboptions": [ "super", "sort" ], "bibstyle": "unsrtnat", "language": "portuges", "listcode": true, "listfigures": true, "listtables": true, "pandoc": { "at_notation": true, "use_numref": true }, "sphinx": { "bib_title": "My Bibliography" }, "titlepage": { "author": "Authors Name", "email": "authors@email.com", "institution": [ "Institution1", "Institution2" ], "logo": "logo_example.png", "subtitle": "Sub-Title", "supervisors": [ "First Supervisor", "Second Supervisor" ], "tagline": "A tagline for the report.", "title": "Main-Title" }, "toc": { "depth": 2 } }, "jupytext": { "notebook_metadata_filter": "ipub" }, "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.7.3" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autocomplete": true, "bibliofile": "example.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": true }, "nav_menu": {}, "toc": { "colors": { "hover_highlight": "#DAA520", "navigate_num": "#000000", "navigate_text": "#333333", "running_highlight": "#FF0000", "selected_highlight": "#FFD700", "sidebar_border": "#EEEEEE", "wrapper_background": "#FFFFFF" }, "moveMenuLeft": true, "nav_menu": { "height": "161px", "width": "252px" }, "navigate_menu": true, "number_sections": true, "sideBar": true, "threshold": 4, "toc_cell": false, "toc_section_display": "block", "toc_window_display": true, "widenNotebook": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "1337h4x0R": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }