{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# My first widget\n", "\n", "This is a test.\n", "\n", "$$x_{1,2} = \\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}$$" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e3677fd37e4f472da105f4003aa474b9", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(interactive(children=(IntSlider(value=5, description='mean', max=10), FloatSlider(value=1.0, de…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "import nbinteract as nbi\n", "\n", "def normal(mean, sd):\n", " '''Returns 1000 points drawn at random fron N(mean, sd)'''\n", " return np.random.normal(mean, sd, 1000)\n", "\n", "# Pass in the ‘normal‘ function and let user change mean and sd.\n", "# Whenever the user interacts with the sliders, the\n", "# ‘normal‘ function is called and the returned data are plotted.\n", "nbi.hist(normal, mean=(0, 10), sd=(0, 2.0))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.4" } }, "nbformat": 4, "nbformat_minor": 2 }