{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Runge phenomenon"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Consider interpolating the following two functions on $[-1,1]$\n",
"$$\n",
"f_1(x) = \\exp(-5x^2), \\qquad f_2(x) = \\frac{1}{1 + 16 x^2}\n",
"$$\n",
"We will try uniformly spaced points and Chebyshev points."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'svg'\n",
"from numpy import exp,linspace,polyfit,polyval,cos,pi\n",
"from matplotlib.pyplot import figure,plot,legend,axis,text,subplot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us first plot the two functions."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
"