{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# p27: Solve KdV equation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Solve the KdV equation using FFT\n",
"$$\n",
"u_t + u u_x + u_{xxx} = 0, \\qquad x \\in [-\\pi,\\pi]\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_format='svg'\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"from matplotlib.collections import LineCollection\n",
"from numpy import pi,cosh,exp,round,zeros,arange,real\n",
"from numpy.fft import fft,ifft\n",
"from matplotlib.pyplot import figure"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"\n",
"\n",
"\n"
],
"text/plain": [
"