{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from math import sin, cos, factorial\n", "\n", "\n", "def f_sin(x, p):\n", " if p == 0:\n", " return sin(x)\n", "\n", " return x\n", " if p % 4 == 1:\n", " return cos(x)\n", "\n", " if p % 4 == 2:\n", " return -sin(x)\n", "\n", " if p % 4 == 3:\n", " return -cos(x)\n", "\n", " return sin(x)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def taylor(df, x, a, n):\n", "\n", " f = 0.0\n", "\n", " for i in range(n+1):\n", " term = df(a, i) * (x - a)**i / factorial(i)\n", " f += term\n", "\n", " return f" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/png": [ "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEACAYAAAC08h1NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n", "AAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYFNW5x/HvOyyKoiwubIMgqyguiEGUiAMiIipI4kaM\n", "SzQJmhhzzdW4Jc6M1xu3xIV4TYxbNCYuSYxBWQdlVIKiKLsMi7LLJiAiiGzv/aMKMxl7hp7unq6e\n", "qd/neerpru7Tdd4p8denT1V1m7sjIiLxkRd1ASIikl0KfhGRmFHwi4jEjIJfRCRmFPwiIjGj4BcR\n", "iZm0gt/M2prZJDOba2ZzzOzaStqNNLOFZjbTzHqk06eIiKSnfpqv3wFc5+4zzKwx8J6Zlbj7vD0N\n", "zGww0MndO5vZicDvgN5p9isiIilKa8Tv7qvdfUZ4/3NgHtC6QrMhwFNhm6lAUzNrkU6/IiKSuozN\n", "8ZtZe6AHMLXCU22A5eXWVwD5mepXRESqJyPBH07z/A34aTjy/1qTCuv6nggRkYikO8ePmTUA/g48\n", "4+4vJWiyEmhbbj0/fKzidvRmICKSAnevOLje6wtSX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RrH3StR\n", "AAAAAElFTkSuQmCC\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "from IPython.html.widgets import interact, interactive, fixed\n", "from IPython.html.widgets import FloatSliderWidget as fWidget\n", "from IPython.html.widgets import IntSliderWidget as iWidget\n", "\n", "x = 0.1\n", "a = 0.8\n", "n = 1\n", "\n", "def plot_data(a, n):\n", " xs = np.linspace(-2, 2, 50)\n", " ts = [taylor(f_sin, i, a, n) for i in xs]\n", "\n", " plt.plot(xs, np.sin(xs))\n", " plt.plot(xs, ts)\n", " plt.xlim(-2,2)\n", " plt.ylim(-2,2)\n", " plt.axvline(a)\n", " plt.show()\n", " \n", "interact(plot_data, \n", " a = fWidget(value=0.8, min=-1.9, max=1.9),\n", " n = iWidget(value=2, min=1, max=8))" ] } ], "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.4.1" } }, "nbformat": 4, "nbformat_minor": 0 }