{
"cells": [
{
"cell_type": "markdown",
"id": "4da58ef7-37db-460b-acf5-cd7e342a89a8",
"metadata": {
"tags": []
},
"source": [
"# Kahden harmonisen aallon superposition aikakehitys.\n",
"\n",
"Alustellaan aluksi juttuja."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "adfd5691-b196-4c28-a98e-15b521152afa",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"from matplotlib import animation, rc\n",
"from IPython.display import HTML\n",
"\n",
"plt.rcParams['text.usetex'] = True\n",
"\n",
"L = 100.0\n",
"xvals = np.linspace(-L/2,L/2,10000)"
]
},
{
"cell_type": "markdown",
"id": "1624c1d1-2633-4fd8-bd81-a230c0b17725",
"metadata": {},
"source": [
"Määritellään aikakehitysfunktio evolve. Se koostuu suoraan kahdesta oikealle etenevästä harmonisesta aallosta. Dispersiota voi muokata muuttamalla esimerkiksi kulmataajuutta."
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "81714ed8-8746-45b1-8efb-ed3d52944b49",
"metadata": {},
"outputs": [],
"source": [
"def evolve(xvals,time):\n",
" yt = [np.cos(1.0*x-0.25*time) + np.cos(1.2*x-0.27*time) for x in xvals]\n",
" return yt"
]
},
{
"cell_type": "markdown",
"id": "02050c0f-af23-431b-84b7-c4f7d2e10d0a",
"metadata": {},
"source": [
"Ja sitten varsinainen animointi."
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "c7e7976d-3459-42ad-a915-d34a3abd5826",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD7CAYAAABgzo9kAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAAL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