{"nbformat_minor": 0, "nbformat": 3, "worksheets": [{"metadata": {}, "cells": [{"cell_type": "markdown", "source": ["# Interpolation Error"], "metadata": {}}, {"outputs": [], "language": "python", "collapsed": false, "cell_type": "code", "input": ["import numpy as np\n", "import numpy.linalg as la\n", "import matplotlib.pyplot as pt"], "prompt_number": 1, "metadata": {}}, {"cell_type": "markdown", "source": ["Let's fix a function to interpolate:"], "metadata": {}}, {"outputs": [], "language": "python", "collapsed": false, "cell_type": "code", "input": ["\n", "if 1:\n", " def f(x):\n", " return np.exp(1.5*x)\n", "elif 0:\n", " def f(x):\n", " return np.sin(20*x)\n", "else:\n", " def f(x):\n", " return (x>=0.5).astype(np.int).astype(np.float)\n", " "], "prompt_number": 2, "metadata": {}}, {"outputs": [{"text": ["[]"], "prompt_number": 3, "output_type": "pyout", "metadata": {}}, {"text": [""], "png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHlBJREFUeJzt3Xu81XO+x/HXx5YwKJdhRjIh5TIonS5itEzogogaNUOE\nmeThMs45yGXGduaQccyM0xjKTqYMGZJuNilaXeXWLkblJNdEmAhdd+3P+eO7aM9uX9bee631W5f3\n8/HYD2vt9bXWx++x93t/fX/fi7k7IiKSX3aKugAREUk9hbuISB5SuIuI5CGFu4hIHlK4i4jkIYW7\niEgeSirczazIzMrMbGo1r8XMbF3i9TIzuyX1ZYqISH3snGS7a4ClwJ41vD7b3fukpiQREWmsOnvu\nZnYQ0BsYDVhNzVJZlIiINE4ywzJ/Aq4DKmp43YGuZrbEzErN7KiUVSciIg1Sa7ib2ZnAp+5eRs29\n80VAS3c/DvgzMCm1JYqISH1ZbXvLmNkdwIXAVmBXYC/gSXcfVMu/8y7Qwd3XVvm+NrEREWkAd6/3\n0HetPXd3v8ndW7r7IcAA4IWqwW5mB5iZJR53IvzBWFvN2+Hu+nLn1ltvjbyGbPnStdC10LWo/uu+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j3rnZqqHZV4FDjezVma2C3A+YZFTZVOAQQC1LXrKA3VeCzM7GJgIXODub0dQY6bUeS3c/VB3\nP8TdDyGMuw/Nw2CH5H5HJgMnmVmRme1OuIG2NMN1ZkIy12I5cCpAYoy5LfBORqvMDvXOzZT23N19\nq5ldCUwn3Al/0N2XmdmQxOsFs+gpmWsB/BbYG7g/0WMtd/dOUdWcLklei4KQ5O/IcjN7FngdqABK\n3D3vwj3Jn4s7gIfMbAmhM3q9u6+NrOg0ScdiUS1iEhHJQylfxCQiItFTuIuI5CGFu4hIHlK4i4jk\nIYW7iEgeUriLiOQhhbuISB5SuIuI5KH/B8cKGj8ONOKPAAAAAElFTkSuQmCC\n", "output_type": "display_data", "metadata": {}}], "language": "python", "collapsed": false, "cell_type": "code", "input": ["x_01 = np.linspace(0, 1, 1000)\n", "pt.plot(x_01, f(x_01))"], "prompt_number": 3, "metadata": {}}, {"cell_type": "markdown", "source": ["And let's fix some parameters. Note that the interpolation interval is just $[0,h]$, not $[0,1]$!"], "metadata": {}}, {"outputs": [{"text": ["array([ 0., 1.])"], "prompt_number": 4, "output_type": "pyout", "metadata": {}}], "language": "python", "collapsed": false, "cell_type": "code", "input": ["degree = 1\n", "h = 1\n", "\n", "nodes = 0.5 + np.linspace(-h/2, h/2, degree+1)\n", "nodes"], "prompt_number": 4, "metadata": {}}, {"cell_type": "markdown", "source": ["Now build the Vandermonde matrix:"], "metadata": {}}, {"outputs": [], "language": "python", "collapsed": false, "cell_type": "code", "input": ["V = np.array([\n", " nodes**i\n", " for i in range(degree+1)\n", "]).T"], "prompt_number": 5, "metadata": {}}, {"outputs": [{"text": ["array([[ 1., 0.],\n", " [ 1., 1.]])"], "prompt_number": 6, "output_type": "pyout", "metadata": {}}], "language": "python", "collapsed": false, "cell_type": "code", "input": ["V"], "prompt_number": 6, "metadata": {}}, {"cell_type": "markdown", "source": ["Now find the interpolation coefficients as `coeffs`:"], "metadata": {}}, {"outputs": [], "language": "python", "collapsed": false, "cell_type": "code", "input": ["coeffs = la.solve(V, f(nodes))"], "prompt_number": 7, "metadata": {}}, {"cell_type": "markdown", "source": ["Here are some points. Evaluate the interpolant there:"], "metadata": {}}, {"outputs": [], "language": "python", "collapsed": false, "cell_type": "code", "input": ["x_0h = 0.5+np.linspace(-h/2, h/2, 1000)"], "prompt_number": 8, "metadata": {}}, {"outputs": [], "language": "python", "collapsed": false, "cell_type": "code", "input": ["interp_0h = 0*x_0h\n", "for i in range(degree+1):\n", " interp_0h += coeffs[i] * x_0h**i"], "prompt_number": 9, "metadata": {}}, {"cell_type": "markdown", "source": ["Now plot the interpolant with the function:"], "metadata": {}}, {"outputs": [{"text": [""], "prompt_number": 10, "output_type": "pyout", "metadata": {}}, {"text": [""], "png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd8VGXWwPHfAUFCJ4SXFgQUKVJCb8ISYXUXQV/WioUm\nKlYQd13bqri6+u5aVmVXRSkWFBREmgiIEDqhBQJCwABSAwKhJUDqef+4ETGEZJLMzJ2ZnO/nk4+T\nmSd3Tm7IyfHc53muqCrGGGNCSym3AzDGGON9ltyNMSYEWXI3xpgQZMndGGNCkCV3Y4wJQZbcjTEm\nBHmU3EWktIjEicisPF6LFpETOa/HicjfvB+mMcaYwrjEw3EjgC1ApYu8vlhVb/ROSMYYY4qrwMpd\nRCKB64GxgFxsmDeDMsYYUzyetGX+DTwBZF/kdQW6ishGEZkjIld5LTpjjDFFkm9yF5G+wM+qGsfF\nq/P1QD1VjQJGA9O9G6IxxpjCkvz2lhGRV4ABQCZQDqgMfKWqA/P5ml1AO1VNzvW8bWJjjDFFoKqF\nbn3nW7mr6jOqWk9VGwL9gYW5E7uI1BQRyXncEecPRnIeh0NV7UOVF154wfUYAuXDzoWdCzsXeXz/\nzZujOD3vovJ0tsy5/JyTxIflJOsxwC3AgyKSCZzG+SNgjDGms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b9BQCCjwXInIZMA24W1UTXYjR\nXwo8F6p6uao2VNWGOH33B0MwsYNnvyMzgG4iUlpEyuNcQNvi5zj9wZNzkQD8HiCnx9wE2OnXKAND\nofOmVyt3Vc0UkUeAeThXwsep6lYRGZbzeolZ9OTJuQCeB6oB7+VUrBmq2tGtmH3Fw3NRInj4O5Ig\nInOBeCAb+FBVQy65e/jv4hVggohsxClG/6qqya4F7SO+WCxqi5iMMSYEeX0RkzHGGPdZcjfGmBBk\nyd0YY0KQJXdjjAlBltyNMSYEWXI3xpgQZMndGGNCkCV3Y4wJQf8Pqe+AjdjCaYsAAAAASUVORK5C\nYII=\n", "output_type": "display_data", "metadata": {}}], "language": "python", "collapsed": false, "cell_type": "code", "input": ["pt.plot(x_01, f(x_01), \"--\", color=\"gray\", label=\"$f$\")\n", "pt.plot(x_0h, interp_0h, color=\"red\", label=\"Interpolant\")\n", "pt.plot(nodes, f(nodes), \"or\")\n", "pt.legend(loc=\"best\")"], "prompt_number": 10, "metadata": {}}, {"cell_type": "markdown", "source": ["Also plot the error:"], "metadata": {}}, {"outputs": [{"stream": "stdout", "output_type": "stream", "text": ["Max error: 0.633384\n"]}, {"text": [""], "png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEACAYAAABI5zaHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl81OW1x/HPkUVEUWtVVNTiQnGlAkpxJQK3Iq2iorK4\nY69oK95etSJqS9SrSNVK1VYpdcNWcS2iVeki44KgoGxCQCiigEsFUaSCBvLcP06QNIZkkszMM/Ob\n7/v1mheZ5JffHH8mJ8+c3/Ocx0IIiIhIsmwROwAREck8JXcRkQRSchcRSSAldxGRBFJyFxFJICV3\nEZEEqjO5m1kvM5tvZgvNbGgNX7/czGZUPuaY2Xoz2z474YqISDqstnnuZtYEWAD0BJYD04ABIYSy\nzRz/I+BnIYSeWYhVRETSVNfIvQuwKISwJIRQDowD+tRy/EDg4UwFJ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L8/djvpk9D8wGKoAxIYTEJfc0fyZuBO4zs1n4QPSKEMIn0YLOIjN7GOgG\n7GhmS4HheImuwXlTi5hERBIoygbZIiKSXUruIiIJpOQuIpJASu4iIgmk5C4ikkBK7iIiCaTkLiKS\nQEruIiIJ9P+Z+2jmIQJeugAAAABJRU5ErkJggg==\n", "output_type": "display_data", "metadata": {}}], "language": "python", "collapsed": false, "cell_type": "code", "input": ["error = interp_0h - f(x_0h)\n", "\n", "pt.plot(x_0h, error)\n", "\n", "print(\"Max error: %g\" % np.max(np.abs(error)))"], "prompt_number": 11, "metadata": {}}, {"cell_type": "markdown", "source": ["* What does the error look like? (Approximately)\n", "* How will the error react if we shrink the interval?\n", "* What will happen if we increase the polynomial degree?"], "metadata": {}}]}], "metadata": {"name": "", "signature": "sha256:79bbeedc806bbddc78128d510c49c8ce4cf5c452a1770d4d2a4e28ba5c84cdbb"}}