{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chebyshev polynomials"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'svg'\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"def chebyshev(n, x):\n",
" if n == 0:\n",
" y = np.ones(len(x))\n",
" elif n == 1:\n",
" y = x.copy()\n",
" else:\n",
" y = 2*x*chebyshev(n-1,x) - chebyshev(n-2,x)\n",
" return y"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
"