{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "slideshow": { "slide_type": "skip" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "In /home/fruzsina/.config/matplotlib/stylelib/paper.mplstyle: \n", "The text.latex.preview rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n", "In /home/fruzsina/.config/matplotlib/stylelib/paper-elsevier.mplstyle: \n", "The text.latex.preview rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n", "Missing colon in file PosixPath('/home/fruzsina/.config/matplotlib/stylelib/kicc.mplstyle'), line 61 ('patch.linewidth = 0.5')\n" ] }, { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "import pyoscode\n", "import matplotlib.pyplot as plt\n", "plt.ion()\n", "import scipy.special as sp\n", "import scipy.integrate\n", "from scipy.optimize import minimize_scalar\n", "\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "\n", "from ipywidgets import interact, IntSlider, FloatSlider,FloatLogSlider\n", "%config InlineBackend.figure_formats = ['svg']\n", "%matplotlib inline\n", "\n", "\n", "from IPython.core.display import HTML\n", "HTML(\"\"\"\n", "\n", "\"\"\")\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "def wkb_step_airy(t,x,dx,h,order,n):\n", " \n", " times = np.linspace(t,t+h,n)\n", " ds0 = 1j*(np.sqrt(t))\n", " ds1 = -1./4*(t**(-1))\n", " ds2 = 1j*5./32*(t**(-5./2))\n", " ds3 = 15./64*(t**(-4.))\n", " s0 = 1j*2./3*((times)**(3./2)-t**(3./2))\n", " s1 = -1./4*np.log((times)/t)\n", " s2 = -1j*5./48*((times)**(-3./2)-t**(-3./2))\n", " s3 = -5./64*((times)**(-3)-t**(-3))\n", " \n", " alls = [s0,s1,s2,s3]\n", " allds = [ds0,ds1,ds2,ds3]\n", " fp = np.exp(sum(alls[:order+1]))\n", " fm = np.conj(fp)\n", " dfp = sum(allds[:order+1])\n", " dfm = np.conj(dfp)\n", " \n", " Ap = (dx - x*dfm)/(dfp - dfm)\n", " Am = (dx - x*dfp)/(dfm - dfp)\n", " \n", " y = Ap*fp + Am*fm\n", " return times,y\n", " " ] }, { "cell_type": "markdown", "metadata": { "hidePrompt": false, "slideshow": { "slide_type": "slide" } }, "source": [ "# pyoscode: fast solutions of oscillatory ODEs in physics\n", "\n", "\n", "\n", "### Fruzsina Agocs\n", "\n", "\n", "\n", "
\n", "
\n", "
\n", "
\n", "
\n", "\n", "To run these slides in jupyter,\\\n", "head to https://github.com/fruzsinaagocs/oscode and\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Introduction" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "- pyoscode is a numerical solver for **osc**illatory **o**rdinary **d**ifferential **e**quations\n", "- ODEs can be oscillatory through\n", " - an oscillatory forcing term, $$\\ddot{x} + x = C\\cos{\\omega t},\\; \\omega \\gg 1$$\n", " - oscillatory coefficients, $$\\dot{x} = xt + 10x\\cos{\\omega t},\\; \\omega \\gg 1$$\n", " - slowly changing, but high frequency, $$\\ddot{x} + 2\\gamma(t)\\dot{x} + \\omega^2(t) x = 0,\\; \\omega \\gg 1$$\n", "- oscode deals with the third type:\n", " - one-dimensional\n", " - ordinary\n", " - $\\omega(t)$, $\\gamma(t)$ vary slowly for _at least part of the integration range_" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Motivation" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "- all extremely common in physics: pendula, suspension, circuits, celestial mechanics, ...\n", "- even if $\\omega(t)$ changes slowly, if $\\omega \\gg 1$, numerical solution slow\n", "- e.g. $\\ddot{x} + tx = 0$, the Airy equation:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [], "source": [ "def f(t,x):\n", " return np.array([x[1],-t*x[0]])\n", "\n", "ti = 1.0\n", "tf = 1e3\n", "x0 = np.array([sp.airy(-ti)[0], -sp.airy(-ti)[1]])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n", "x(t=1000.0)=0.0302, dx/dt=-2.3852\n", "analytic solution: x=0.0560, dx/dt=-2.6331\n", "CPU times: user 1.63 s, sys: 0 ns, total: 1.63 s\n", "Wall time: 1.64 s\n" ] } ], "source": [ "%%time\n", "sol = scipy.integrate.solve_ivp(f,(ti,tf),x0,rtol=1e-3)\n", "print(sol.success)\n", "print(\"x(t={})={:.4f}, dx/dt={:.4f}\".format(tf,sol.y[0][-1],sol.y[1][-1]))\n", "print(\"analytic solution: x={:.4f}, dx/dt={:.4f}\".format(sp.airy(-tf)[0],-sp.airy(-tf)[1]))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- why the noticeable wall time?\n", " - `scipy.integrate.solve_ivp`'s default method is 4(5) order Runge-Kutta\n", " - Runge-Kutta excellent for non-stiff, non-oscillatory equations/regions\n", " - cannot deal with high-frequency oscillations (will see why)\n", " - the Airy frequency $\\omega(t) = \\sqrt{t}$, steadily increases with time" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## A brief summary of the algorithm\n", "\n", "Based on [arxiv:1906.01421](https://arxiv.org/abs/1906.01421)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Runge-Kutta (RK) steps \n", "\n", "- $ \\dot{\\vec{x}} = F(\\vec{x}) $\n", "- have (estimate of) solution $x$ at $t_i$, want to get $x$ at $t_i+h$\n", "- Taylor expand: \n", "\n", "$$x(t_i+h) = x(t_i) + hF(x(t_i)) + \\frac{1}{2}h^2\\left.\\frac{dF}{dt}\\right\\vert_{t=t_i} + \\mathcal{O}(h^3)$$\n", "\n", "- and replace derivatives of $F$ with evaluations of $F$ at gridpoints:\n", "\n", "$$ x(t_i+h) = x(t_i) + \\sum_{j,\\;t_i only affecting amplitude/phase" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### “RKWKB” method\n", "\n", "- step along the numerical solution (initial value problem solver)\n", "- 2 components:\n", " - _adaptive stepsize_ : change stepsize ($h$) based on estimate of local error\n", " - _switching_ : between RK and WKB steps\n", " - whichever gives larger $h$ to keep local error within user-specified tolerance\n", " - use common set of function evaluations $\\to$ minimum evaluations per step\n", "- local error estimated as difference between $n^{\\mathrm{th}}$ and $(n-1)^{\\mathrm{th}}$ method\n", "- details in [arxiv:1906.01421](https://arxiv.org/abs/1906.01421)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "hideCode": true, "hidePrompt": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e3e16221fa564f099c5dea011fbcb982", "version_major": 2, "version_minor": 0 }, "text/plain": [ "interactive(children=(FloatSlider(value=-20.0, continuous_update=False, description='tf', max=20.0, min=-20.0,…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5d66d0cbe4a1472d8e3b0a370b53a25b", "version_major": 2, "version_minor": 0 }, "text/plain": [ "interactive(children=(FloatSlider(value=-20.0, continuous_update=False, description='tf', max=20.0, min=-20.0,…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "n = 40.\n", "ts1 = np.linspace(-n/2,n/2,100000)\n", "ws1 = np.log(np.sqrt((n**2-1.)))-np.log(1+ts1**2)\n", "gs1 = np.zeros_like(ts1)\n", "ti1 = ts1[0]\n", "tf_dense = ts1[-1]\n", "xi1 = np.sqrt(1.+ti1**2)/n*np.cos(n*np.arctan(ti1))\n", "dxi1 = 1./(n*np.sqrt(1+ti1**2))*(ti1*np.cos(n*np.arctan(ti1))-n*np.sin(n*np.arctan(ti1)))\n", "xs_ana = np.sqrt(1.+ts1**2)/n*(np.cos(n*np.arctan(ts1))) \n", "solution1 = pyoscode.solve(ts1,ws1,gs1,ti1,tf_dense,xi1,dxi1,logw=True,rtol=1e-3)\n", "\n", "def burst_f(t,y):\n", " return np.array([y[1],-(n**2-1.)/(1.+t**2)**2*y[0]])\n", "\n", "def burst_rk(tf):\n", " \n", " sol = scipy.integrate.solve_ivp(burst_f,(ti1,tf),np.array([xi1,dxi1]),rtol=1e-3)\n", " t_rk = sol.t\n", " final_ind = np.argmax(t_rk >= tf)\n", " \n", " t_rk = t_rk[:final_ind+1]\n", " x_rk = sol.y[0][:final_ind+1]\n", " \n", " plt.figure(figsize=(10,2.5))\n", " plt.tight_layout()\n", " plt.title(\"scipy.integrate.solve_ivp solving the equation $\\ddot{x}+\\\\frac{n^2-1}{(1+t^2)^2}x=0$, with $n=40$\")\n", " plt.plot(ts1,xs_ana,label='analytic solution',color='black',lw=0.7)\n", " plt.xlabel('t')\n", " plt.ylabel('x')\n", " plt.plot(t_rk,x_rk ,'.',label='RK',ms=9.0,color='C1')\n", " plt.legend() \n", "\n", "def burst(tf):\n", " \n", " t_osc = np.array(solution1['t'])\n", " final_ind = np.argmax(t_osc >= tf)\n", " \n", " t_osc = t_osc[:final_ind+1]\n", " x_osc = np.array(solution1['sol'])[:final_ind+1]\n", " types = np.array(solution1['types'])[:final_ind+1]\n", " t_rk = t_osc[types==0]\n", " x_rk = x_osc[types==0]\n", " t_wkb = t_osc[types==1]\n", " x_wkb = x_osc[types==1]\n", " plt.figure(figsize=(10,2.5))\n", " plt.tight_layout()\n", " plt.title(\"oscode solving the equation $\\ddot{x}+\\\\frac{n^2-1}{(1+t^2)^2}x=0$, with $n=40$\")\n", " plt.plot(ts1,xs_ana,label='analytic solution',color='black',lw=0.7)\n", " plt.xlabel('t')\n", " plt.ylabel('x')\n", " plt.plot(t_rk,x_rk ,'.',label='RK',ms=9.0,color='C1')\n", " plt.plot(t_wkb,x_wkb,'.',label='WKB',ms=9.0,color='C0')\n", " plt.legend()\n", " \n", "\n", "interact(burst, \n", " tf=FloatSlider(min=ti1, max=tf_dense,\n", " step=1.0, continuous_update=False, value=ti1));\n", "\n", "interact(burst_rk, \n", " tf=FloatSlider(min=ti1, max=tf_dense,\n", " step=1.0, continuous_update=False, value=ti1));" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "hideCode": true, "hidePrompt": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8dabd2d315fb4e3893789f0487df2db0", "version_major": 2, "version_minor": 0 }, "text/plain": [ "interactive(children=(FloatLogSlider(value=100.0, description='n2', max=5.0, min=2.0, step=1.0), Output()), _d…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "def burst2(n2):\n", " \n", " ts2 = np.linspace(-n2,n2,500000)\n", " ws2 = np.log(np.sqrt((n2**2-1.)))-np.log(1+ts2**2)\n", " gs2 = np.zeros_like(ts2)\n", " ti2 = ts2[0]\n", " tf_dense = ts2[-1]\n", " xi2 = np.sqrt(1.+ti2**2)/n2*np.cos(n2*np.arctan(ti2))\n", " dxi2 = 1./(n2*np.sqrt(1+ti2**2))*(ti2*np.cos(n2*np.arctan(ti2))-n2*np.sin(n2*np.arctan(ti2)))\n", " xs_ana2 = np.sqrt(1.+ts2**2)/n2*(np.cos(n2*np.arctan(ts2))) \n", " solution2 = pyoscode.solve(ts2,ws2,gs2,ti2,tf_dense,xi2,dxi2,logw=True,rtol=1e-3)\n", " \n", " t_osc = np.array(solution2['t'])\n", "\n", " oscs = np.zeros(len(t_osc))\n", " for i,t in enumerate(t_osc):\n", " if i!=0:\n", " oscs[i] = ((n2*np.arctan(t)/(2*np.pi))-(n2*np.arctan(t_osc[i-1])/(2*np.pi)))\n", " else:\n", " oscs[i] = None\n", " \n", " types = np.array(solution2['types'])\n", " t_rk = t_osc[types==0]\n", " t_wkb = t_osc[types==1]\n", " plt.figure(figsize=(10,5))\n", " plt.tight_layout()\n", " plt.title(\"Number of oscillations traversed per step, $\\ddot{{x}}+\\\\frac{{n^2-1}}{{(1+t^2)^2}}x=0$, n={}\".format(n2))\n", " plt.xlabel('t')\n", " plt.ylabel('$N_{\\mathrm{osc}}$')\n", " plt.semilogy(t_osc,oscs,color='black')\n", " plt.semilogy(t_rk,oscs[types==0] ,'.',label='RK',ms=9.0,color='C1')\n", " plt.semilogy(t_wkb,oscs[types==1],'.',label='WKB',ms=9.0,color='C0')\n", " plt.ylim((1e-2,1e4))\n", " plt.legend()\n", " \n", "\n", "interact(burst2, \n", " n2=FloatLogSlider(base=10, min=2, max=5,\n", " step=1), continuous_update=False);" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "- Airy equation revisited with pyoscode (~2 s runtime with `scipy`):" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [], "source": [ "ts = np.linspace(0,1e3,5000)\n", "ws = np.sqrt(ts)\n", "gs = np.zeros_like(ts)\n", "\n", "# Initial conditions\n", "ti = 1.0\n", "tf = ts[-1]\n", "x0 = sp.airy(-ti)[0]\n", "dx0 = -sp.airy(-ti)[1]" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x(t=1000.0)=0.0560+0.0000j, dx/dt=-2.6292+0.0000j\n", "analytic solution: x=0.0560, dx/dt=-2.6331\n", "CPU times: user 646 µs, sys: 132 µs, total: 778 µs\n", "Wall time: 638 µs\n" ] } ], "source": [ "%%time\n", "pyoscode_sol = pyoscode.solve(ts,ws,gs,ti,tf,x0,dx0,rtol=1e-3)\n", "pyosc_y = pyoscode_sol['sol']\n", "pyosc_dy = pyoscode_sol['dsol']\n", "print(\"x(t={})={:.4f}, dx/dt={:.4f}\".format(tf,pyosc_y[-1],pyosc_dy[-1]))\n", "print(\"analytic solution: x={:.4f}, dx/dt={:.4f}\".format(sp.airy(-tf)[0],-sp.airy(-tf)[1]))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Examples in physics" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Cosmology\n", "\n", "- origins of large-scale structure thought to have been quantum fluctuations \n", "- fluctuations grew during a period of accelerated expansion, inflation ($t < \\;\\sim 10^{-32}$ s)\n", "- power spectrum of _gauge-invariant curvature perturbations_ $\\to$ cosmic microwave background (CMB)\n", "- to infer physics of early universe, need to assume or compute (primordial) power spectrum\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- power spectrum: $|$amplitude$|^2$ as a function of Fourier wavenumber $k$\n", "- computation of spectrum _can be_ bottleneck in forward modelling, e.g.\n", " - closed universes [arxiv:1907.08524](https://arxiv.org/abs/1907.08524)\n", " - axion monodromy models [arxiv:1502.02114](https://arxiv.org/abs/1502.02114)\n", " - initial conditions set at very early times [arXiv:2002.07042](https://arxiv.org/abs/2002.07042)\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- need time-evolution of gauge-invariant curvature perturbations of wavenumber $k$:\n", " - Mukhanov-Sasaki equation (assuming spatially flat universe, single-field inflation)\n", " $$ \\ddot{\\mathcal{R}}_k + 2\\left( \\frac{\\ddot{\\phi}}{\\phi} -\\frac{1}{2} \\dot{\\phi}^2 + \\frac{3}{2}\\right)\\dot{\\mathcal{R}}_k + \\left( \\frac{k}{aH} \\right)^2\\mathcal{R}_k = 0 $$\n", " - $a$: scale factor, $H$: Hubble parameter, $\\phi$: inflaton field\n", " - using $N = \\ln{a}$ as independent variable\n", " - oscillator with time-dependent frequency and damping\n", " - frequency $\\propto k \\to$ can get large, computationally challenging\n", " - $\\omega$, $\\gamma$ not closed-form functions\n", " " ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "hideCode": false, "hidePrompt": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2020-10-07T15:22:31.022080\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.3.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "import re\n", "\n", "pair = re.compile(r'\\(([^,\\)]+),([^,\\)]+)\\)')\n", "def parse_pair(s):\n", " s = s.decode('utf-8')\n", " return complex(*map(float, pair.match(s).groups()))\n", "\n", "f1 = \"images/bingo-singlek-k1e-5.txt\"\n", "f1ref = \"images/bingo-singlek-k1e-5-ref.txt\"\n", "f1wkb = \"images/rkwkb-single-k1e-5.txt\"\n", "d1 = np.genfromtxt(f1)\n", "d1ref = np.genfromtxt(f1ref)\n", "d1wkb = np.genfromtxt(f1wkb,dtype=complex,converters={1:parse_pair, 2:parse_pair})\n", "n1 = d1[:,0]\n", "n1ref = d1ref[:,0]\n", "n1wkb = d1wkb[:,0]\n", "rk1 = d1[:,1]\n", "rk1ref = d1ref[:,1]\n", "rk1wkb = d1wkb[:,1]\n", "rk1steps = d1wkb[:,3]\n", "\n", "plt.figure(figsize=(10,5))\n", "plt.title('Evolution of a single primordial perturbation $\\mathcal{R}_k$ of Fourier wavenumber $k$')\n", "plt.plot(n1ref,rk1ref,color='black',lw=0.7)\n", "plt.plot(n1wkb[rk1steps==0],rk1wkb[rk1steps==0],'.',color='C1',ms=9.0,label='RK step')\n", "plt.plot(n1wkb[rk1steps==1],rk1wkb[rk1steps==1],'.',color='C0',ms=9.0,label='WKB step')\n", "plt.ticklabel_format(axis='y',style='sci',scilimits=(-2,2))\n", "plt.legend()\n", "plt.xlabel('N')\n", "plt.ylabel('$\\Re{\\{ \\mathcal{R}_k \\}} $')\n", "plt.show()\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "hideCode": false, "hidePrompt": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2020-10-07T15:22:31.206471\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.3.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "fs1 = \"images/singlek-kd-bd-2a.txt\"\n", "fs2 = \"images/singlek-kd-bd-2a.txt\"\n", "fref = \"images/singlek-kd-bg-2a-ref.txt\"\n", "d1 = np.genfromtxt(fs1,dtype=complex,converters={1:parse_pair,2:parse_pair,4:parse_pair})\n", "d2 = np.genfromtxt(fs2,dtype=complex,converters={1:parse_pair,2:parse_pair,4:parse_pair})\n", "dref = np.genfromtxt(fref)\n", "n1 = d1[:,0]\n", "n2 = d2[:,0]\n", "nref = dref[:,0]\n", "rk1 = d1[:,1]\n", "rk2 = d2[:,1]\n", "rkref = dref[:,1]\n", "wkb1 = d1[:,3]\n", "wkb2 = d2[:,3]\n", "plt.figure(figsize=(10,5))\n", "plt.title('Evolution of a single primordial perturbation $\\mathcal{R}_k$ of Fourier wavenumber $k$')\n", "plt.plot(nref,rkref,color='black',lw=0.7)\n", "plt.plot(n1[wkb1==1],(rk1[wkb1==1]),'.',color='C0',label='WKB step',ms=9.)\n", "plt.plot(n1[wkb1==0],(rk1[wkb1==0]),'.',color='C1',label='RK step',ms=9.)\n", "plt.ticklabel_format(axis='y',style='sci',scilimits=(-2,2))\n", "plt.xlabel('N')\n", "plt.ylabel('$\\Re{\\{ \\mathcal{R}_k \\}} $')\n", "plt.legend()\n", "plt.show()\n", " " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Quantum mechanics\n", "\n", "- time-independent, one-dimensional Schrödinger equation: \n", "\n", "$$ \\Psi''(x) + 2m(E-V(x))\\Psi(x) = 0 $$\n", "\n", "- $\\Psi$ is wavefunction, $V(x)$ potential well, $E$ are _unknown_ energy eigenvalues of the system to be determined\n", "- a harmonic oscillator with time-dependent frequency that can be real or imaginary\n", "- a _boundary value problem_ :\n", " - continuity of $\\Psi$ and $\\Psi'$ required at edges of potential well where $E = V(x)$\n", " - $\\Psi(x)\\to 0$ far outside the well where $V(x) \\gg E$ " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- can rephrase as optimisation problem:\n", " - guess lower and upper bound for $n^{\\mathrm{th}}$ eigenvalue $E_n$\n", " - start from initial guess for $E_n$ within bounds\n", " - propagate two solutions from outside the potential well ( _initial value problems_ )\n", " - check for continuity between two solutions, $\\Psi_L$ and $\\Psi_R$, at midpoint\n", " - eigenvalue found when $\\left\\vert\\frac{\\Psi_L'}{\\Psi_L}-\\frac{\\Psi_R'}{\\Psi_R}\\right\\vert = 0$" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- Try potential of the form $V(x) = x^2 + \\lambda x^4$, the anharmonic oscillator\n", "- $\\lambda=1$, find $n^{\\mathrm{th}}$ energy levels with $n=\\{$50, 100, 1000, 10000$\\}$ \n", "- Numerical values using a conventional method: $E_n=$ 417.05626, 1035.5442, 21932, 7840, 471103.80 " ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "hideCode": true, "hideOutput": false, "hidePrompt": true, "slideshow": { "slide_type": "-" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Eigenenergy found: 416.60834468082714\n", "Eigenenergy found: 1035.3995965810213\n", "Eigenenergy found: 21939.980473898962\n", "Eigenenergy found: 471103.8196601125\n" ] }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2020-10-07T15:22:31.739172\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.3.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "l=1.0\n", "m=0.5\n", "\n", "def Ei(n):\n", " \"\"\" \n", " Energy eigenvalues (if analytic solution available)\n", " \"\"\"\n", " return np.sqrt(2.0)*(n-0.5)\n", "\n", "def V(t):\n", " \"\"\" \n", " Potential well \n", " \"\"\"\n", " return t**2 + l*t**4\n", "\n", "def w(t,E):\n", " \"\"\"\n", " Frequency term in the Schrodinger equation\n", " \"\"\"\n", " return np.sqrt(2*m*(complex(E)-V(t)));\n", "\n", "def f(E):\n", " \"\"\"\n", " Function to minimize wrt E to give the energy eigenvalues\n", " \"\"\"\n", "\n", " # Boundaries of integration\n", " tl = -((E)**(0.25))-2.0\n", " tr = -tl\n", " tm = 0.5\n", "\n", " # Grid of w, g\n", " t = np.linspace(tl.real,tr.real,30000)\n", " ws = np.log(w(t,E))\n", " g = np.zeros(t.shape)\n", " sol_l = pyoscode.solve(t,ws,g,tl,tm,0,1e-3,logw=True,rtol=1e-5)\n", " sol_r = pyoscode.solve(t,ws,g,tr,tm,0,1e-3,h=-1,logw=True,rtol=1e-5)\n", " psi_l = sol_l[\"sol\"][-1]\n", " psi_r = sol_r[\"sol\"][-1]\n", " dpsi_l = sol_l[\"dsol\"][-1]\n", " dpsi_r = sol_r[\"dsol\"][-1]\n", " try:\n", " return abs(dpsi_l/psi_l - dpsi_r/psi_r)\n", " except ZeroDivisionError:\n", " return 1000.0\n", " \n", "def plot(ns,Es):\n", "\n", " plt.figure(figsize=(10,5))\n", " t_v = np.linspace(-6,6,500)\n", " plt.plot(t_v,V(t_v),color='black',label='V(x)')\n", "\n", " for j,n,E in zip(range(len(ns)),ns,Es):\n", " # Boundaries of integration\n", " tl = -((E)**(0.25))-1.0\n", " tr = -tl\n", " tm = 0.0\n", "\n", " # Grid of w, g\n", " t = np.linspace(tl.real,tr.real,30000)\n", " ws = np.log(w(t,E))\n", " g = np.zeros(t.shape)\n", "\n", " sol_l = pyoscode.solve(t,ws,g,tl,tr/2.,0,1e-3,logw=True,rtol=1e-5)\n", " x_l = sol_l['sol']\n", " ts_l = sol_l['t']\n", " types_l = sol_l['types']\n", " for i,typ in enumerate(types_l):\n", " if typ==1 and 0 not in types_l[i:]:\n", " firstwkb = i\n", " break;\n", "\n", "\n", "\n", " t_eval = np.linspace(ts_l[firstwkb],tm,2000)\n", " sol = pyoscode.solve(t,ws,g,tl,tr,0,1e-3,logw=True,rtol=1e-5,t_eval=t_eval)\n", "\n", " x_eval = sol['x_eval']\n", " x_l = x_l[:firstwkb]\n", " ts_l = ts_l[:firstwkb]\n", " Ts_l = np.concatenate((np.array(ts_l),t_eval))\n", " Xs_l = np.concatenate((np.array(x_l),x_eval))\n", " maxx = max(np.real(Xs_l))\n", " Xs_l = Xs_l/maxx*4*np.sqrt(E)\n", " plt.plot(Ts_l,Xs_l+E,color='C{}'.format(j),label='$\\Psi_n(x)$, n={}, $E_n$={:.4f}'.format(n,E))\n", " plt.plot(-1*Ts_l,Xs_l+E,color='C{}'.format(j))\n", " plt.xlabel('x')\n", " plt.legend(loc='lower left')\n", " plt.show()\n", "\n", "bounds = [ (416.5,417.5),(1035,1037),(21930,21940),(471100,471110)]\n", "\n", "ress = []\n", "for bound in bounds:\n", " res = minimize_scalar(f,bounds=bound,method='bounded')\n", " print(\"Eigenenergy found: {}\".format(res.x))\n", " ress.append(res.x)\n", "plot([50,100],ress[:2])\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Other examples\n", "\n", "- modelling the mechanics of the cochlea [doi:10.1155/2014/150637](https://doi.org/10.1155/2014/150637)\n", " - cochlea map sounds of different frequencies onto unique positions on the basilar membrane\n", "- normal modes in black holes [doi:10.1103/PhysRevD.35.3632](https://doi.org/10.1103/PhysRevD.35.3632)\n", " - resonant, nonradial perturbations of black holes caused by external perturbations\n", "- scattering of radio waves from overdense meteor trains [doi:10.1016/0032-0633(92)90045-P](https://doi.org/10.1016/0032-0633(92)90045-P)\n", " - symmetry allows radio waves to be decomposed into partial waves, apply WKB to each" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## The interface" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "- draws from `scipy.integrate.solve_ivp(fun, t_span, y0, ...)`\n", " - `fun`: defines differential equation\n", " - `t_span`: integration range\n", " - `y0`: initial conditions\n", "- minimal setup:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [ { "data": { "text/plain": [ "dict_keys(['sol', 'dsol', 't', 'types', 'x_eval'])" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "import scipy.special as sp\n", "import pyoscode\n", "\n", "# Set up differential equation: x'' + tx = 0. \n", "ts = np.linspace(0,40.0,5000)\n", "ws = np.sqrt(ts)\n", "gs = np.zeros_like(ts)\n", "\n", "# Initial conditions\n", "ti = 1.0\n", "tf = 40.0\n", "x0 = sp.airy(-ti)[0]\n", "dx0 = -sp.airy(-ti)[1]\n", "\n", "solution = pyoscode.solve(ts, ws, gs, ti, tf, x0, dx0)\n", "solution.keys() " ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2020-10-07T15:22:31.962377\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.3.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "# Compute analytic solution for comparison\n", "analytic = np.array([sp.airy(-t)[0] for t in ts])\n", "\n", "plt.figure(figsize=(10,5))\n", "plt.plot(ts,analytic,label='analytic solution',color='black',lw=0.7)\n", "plt.plot(solution['t'],solution['sol'],'.',color='C1',label='pyoscode',ms=9.0)\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "- optional arguments allow _dense output_ \n", " - output solution at user-specified points\n", " - no extra steps or evaluations of the RHS of the ODE $\\to$ computationally cheap \n", " - not trivial for highly oscillatory solutions (Agocs, “Dense output for highly oscillatory numerical solutions” in prep.)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "scrolled": true, "slideshow": { "slide_type": "subslide" } }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2020-10-07T15:22:32.077125\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.3.1, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "# We'll get the solution at these points@\n", "t_eval = np.linspace(15,35,600)\n", "dense_solution = pyoscode.solve(ts, ws, gs, ti, tf, x0, dx0, t_eval=t_eval)\n", "\n", "plt.figure(figsize=(10,5))\n", "plt.plot(ts,analytic,label='analytic solution',color='black',lw=0.7)\n", "plt.plot(dense_solution['t'],dense_solution['sol'],'.',color='C1',label='pyoscode internal step',ms=9.0)\n", "plt.plot(t_eval, dense_solution['x_eval'], color='C1', label='pyoscode dense output')\n", "plt.xlabel('x')\n", "plt.ylabel('y(x)')\n", "plt.legend()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Documentation\n", "\n", "- https://github.com/fruzsinaagocs/oscode\n", "- open source software, to be submitted to JOSS\n", "- python & C++ documentation at https://oscode.readthedocs.io\n", "- examples available for both interfaces" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### Extending pyoscode" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "- multiple dimensions\n", " - modified Magnus expansion instead of (inherently 1D) WKB by [arxiv:1907.11638](https://arxiv.org/abs/1907.11638)\n", " - more work under way (Schöneberg and Agocs, “Beyond the traditional WKB approximation of Boltzmann equations” in prep.)\n", "- adapt basis function $f_{\\pm}$ to problem in question:\n", " - WKB is suitable for highly oscillatory solutions with slowly changing frequencies\n", " - different basis may be suitable for e.g. a problem exhibiting sawtooth-shaped oscillations\n", "- adjust order of WKB expansion on the fly" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Thank you, questions welcome!" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "### References\n", "
" ] } ], "metadata": { "celltoolbar": "Hide code", "cite2c": { "citations": { "3574492/2VK67JYP": { "DOI": "10.1103/PhysRevD.100.123517", "URL": "https://link.aps.org/doi/10.1103/PhysRevD.100.123517", "accessed": { "day": 7, "month": 6, "year": 2020 }, "author": [ { "family": "Handley", "given": "Will" } ], "container-title": "Physical Review D", "container-title-short": "Phys. Rev. D", "id": "3574492/2VK67JYP", "issue": "12", "issued": { "day": 12, "month": 12, "year": 2019 }, "journalAbbreviation": "Phys. Rev. D", "language": "en", "page": "123517", "page-first": "123517", "title": "Primordial power spectra for curved inflating universes", "type": "article-journal", "volume": "100" }, "3574492/5BZSXUB8": { "DOI": "10.1155/2014/150637", "URL": "http://www.hindawi.com/journals/bmri/2014/150637/", "abstract": "The cochlea plays a crucial role in mammal hearing. The basic function of the cochlea is to map sounds of different frequencies onto corresponding characteristic positions on the basilar membrane (BM). Sounds enter the fluid-filled cochlea and cause deflection of the BM due to pressure differences between the cochlear fluid chambers. These deflections travel along the cochlea, increasing in amplitude, until a frequency-dependent characteristic position and then decay away rapidly. The hair cells can detect these deflections and encode them as neural signals. Modelling the mechanics of the cochlea is of help in interpreting experimental observations and also can provide predictions of the results of experiments that cannot currently be performed due to technical limitations. This paper focuses on reviewing the numerical modelling of the mechanical and electrical processes in the cochlea, which include fluid coupling, micromechanics, the cochlear amplifier, nonlinearity, and electrical coupling.", "accessed": { "day": 7, "month": 6, "year": 2020 }, "author": [ { "family": "Ni", "given": "Guangjian" }, { "family": "Elliott", "given": "Stephen J." }, { "family": "Ayat", "given": "Mohammad" }, { "family": "Teal", "given": "Paul D." } ], "container-title": "BioMed Research International", "container-title-short": "BioMed Research International", "id": "3574492/5BZSXUB8", "issued": { "year": 2014 }, "journalAbbreviation": "BioMed Research International", "language": "en", "page": "1-42", "page-first": "1", "title": "Modelling Cochlear Mechanics", "type": "article-journal", "volume": "2014" }, "3574492/5I6RED6P": { "URL": "www.jstor.org/stable/79550", "abstract": "[Accurate eigenvalues and eigenfunctions of the anharmonic oscillator $(H=p^{2}+x^{2}+\\lambda x^{4},\\lambda >0)$ and the quartic oscillator (H=p2+x4) are obtained in all régimes of the quantum number n and the anharmonicity constant λ . Transition moments of comparable accuracy are obtained for the quartic oscillator. The method, applicable quite generally for eigenvalue problems, is non-perturbative and involves the use of an appropriately scaled basis for the determination of each eigenvalue. The appropriate scaling formula for a given régime of (n,λ) is constructed from the oscillation properties of the eigenfunctions. More general anharmonic oscillators are also discussed.]", "accessed": { "day": 7, "month": 6, "year": 2020 }, "archive": "JSTOR", "author": [ { "family": "Banerjee", "given": "K." }, { "family": "Bhatnagar", "given": "S. P." }, { "family": "Choudhry", "given": "V." }, { "family": "Kanwal", "given": "S. S." } ], "container-title": "Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences", "id": "3574492/5I6RED6P", "issue": "1703", "issued": { "year": 1978 }, "note": "Publisher: The Royal Society", "page": "575-586", "page-first": "575", "title": "The Anharmonic Oscillator", "type": "article-journal", "volume": "360" }, "3574492/7LA4L3AM": { "DOI": "10.1103/PhysRevResearch.2.013030", "URL": "https://link.aps.org/doi/10.1103/PhysRevResearch.2.013030", "accessed": { "day": 2, "month": 6, "year": 2020 }, "author": [ { "family": "Agocs", "given": "F. J." }, { "family": "Handley", "given": "W. J." }, { "family": "Lasenby", "given": "A. N." }, { "family": "Hobson", "given": "M. P." } ], "container-title": "Physical Review Research", "container-title-short": "Phys. Rev. Research", "id": "3574492/7LA4L3AM", "issue": "1", "issued": { "day": 9, "month": 1, "year": 2020 }, "journalAbbreviation": "Phys. Rev. Research", "language": "en", "page": "013030", "page-first": "013030", "title": "Efficient method for solving highly oscillatory ordinary differential equations with applications to physical systems", "type": "article-journal", "volume": "2" }, "3574492/8WK2IYN7": { "DOI": "10.1016/0032-0633(92)90045-P", "URL": "http://www.sciencedirect.com/science/article/pii/003206339290045P", "abstract": "In this treatment the meteor train is regarded as a cold collisionless cylindrical plasma to which the radio waves are at normal incidence. The electromagnetic fields are expanded in cylindrical waves and the Wentzel-Kramers-Brillouin approximation is applied to the individual differential equations for the partial waves. It is shown that these results may be interpreted as an application of the phase integral method using the Debye-Watson representation of the Hankel functions describing incoming and outgoing cylindrical waves. Results are presented of calculations of the scattering from trains with initial line densities in the ranges 1016and 1017 electrons m−1 ; previous calculations describing the scattering behaviour over the life of the train, based on the direct numerical integration of the differential equations for the partial waves, have been limited to 1015m−1. Results are presented for the cases of backscatter and a representative forward scattering angle of 50°. The treatment includes results of calculations in the absence of chemical effects and also when there is loss of ionization through chemical effects involving ozone, as suggested by Baggaley and Cummack (1974, J. atmos. terr. Phys. 36, 1759). The results are compared with the metallic cylinder model, which was the only model available for the estimation of echo durations from overdense trains up to now. We conclude that the metallic cylinder model is reasonable for backscatter, particularly as regards duration, but in general gives poor results when applied to forward scatter.", "author": [ { "family": "Jones", "given": "W." } ], "container-title": "Planetary and Space Science", "container-title-short": "Planetary and Space Science", "id": "3574492/8WK2IYN7", "issue": "11", "issued": { "day": 1, "month": 11, "year": 1992 }, "journalAbbreviation": "Planetary and Space Science", "page": "1487-1497", "page-first": "1487", "title": "The application of the WKB approximation to the calculation of the scattering of radio waves from overdense meteor trains", "type": "article-journal", "volume": "40" }, "3574492/9XNWYLFA": { "DOI": "10.1103/PhysRevD.101.043517", "URL": "https://link.aps.org/doi/10.1103/PhysRevD.101.043517", "accessed": { "day": 7, "month": 6, "year": 2020 }, "author": [ { "family": "Bamber", "given": "Jamie" }, { "family": "Handley", "given": "Will" } ], "container-title": "Physical Review D", "container-title-short": "Phys. Rev. D", "id": "3574492/9XNWYLFA", "issue": "4", "issued": { "day": 13, "month": 2, "year": 2020 }, "journalAbbreviation": "Phys. Rev. D", "language": "en", "page": "043517", "page-first": "043517", "title": "Beyond the Runge-Kutta-Wentzel-Kramers-Brillouin method", "type": "article-journal", "volume": "101" }, "3574492/LYQIAQKR": { "DOI": "10.1103/PhysRevD.35.3621", "URL": "https://link.aps.org/doi/10.1103/PhysRevD.35.3621", "accessed": { "day": 7, "month": 6, "year": 2020 }, "author": [ { "family": "Iyer", "given": "Sai" }, { "family": "Will", "given": "Clifford M." } ], "container-title": "Physical Review D", "container-title-short": "Phys. Rev. D", "id": "3574492/LYQIAQKR", "issue": "12", "issued": { "day": 15, "month": 6, "year": 1987 }, "journalAbbreviation": "Phys. Rev. D", "language": "en", "page": "3621-3631", "page-first": "3621", "shortTitle": "Black-hole normal modes", "title": "Black-hole normal modes: A WKB approach. I. Foundations and application of a higher-order WKB analysis of potential-barrier scattering", "title-short": "Black-hole normal modes", "type": "article-journal", "volume": "35" }, "3574492/MC4FCNHB": { "DOI": "10.1051/0004-6361/201525898", "URL": "http://www.aanda.org/10.1051/0004-6361/201525898", "accessed": { "day": 11, "month": 6, "year": 2020 }, "author": [ { "family": "Planck Collaboration", "given": "" }, { "family": "Ade", "given": "P. A. R." }, { "family": "Aghanim", "given": "N." }, { "family": "Arnaud", "given": "M." }, { "family": "Arroja", "given": "F." }, { "family": "Ashdown", "given": "M." }, { "family": "Aumont", "given": "J." }, { "family": "Baccigalupi", "given": "C." }, { "family": "Ballardini", "given": "M." }, { "family": "Banday", "given": "A. J." }, { "family": "Barreiro", "given": "R. B." }, { "family": "Bartolo", "given": "N." }, { "family": "Battaner", "given": "E." }, { "family": "Benabed", "given": "K." }, { "family": "Benoît", "given": "A." }, { "family": "Benoit-Lévy", "given": "A." }, { "family": "Bernard", "given": "J.-P." }, { "family": "Bersanelli", "given": "M." }, { "family": "Bielewicz", "given": "P." }, { "family": "Bock", "given": "J. J." }, { "family": "Bonaldi", "given": "A." }, { "family": "Bonavera", "given": "L." }, { "family": "Bond", "given": "J. R." }, { "family": "Borrill", "given": "J." }, { "family": "Bouchet", "given": "F. R." }, { "family": "Boulanger", "given": "F." }, { "family": "Bucher", "given": "M." }, { "family": "Burigana", "given": "C." }, { "family": "Butler", "given": "R. C." }, { "family": "Calabrese", "given": "E." }, { "family": "Cardoso", "given": "J.-F." }, { "family": "Catalano", "given": "A." }, { "family": "Challinor", "given": "A." }, { "family": "Chamballu", "given": "A." }, { "family": "Chary", "given": "R.-R." }, { "family": "Chiang", "given": "H. C." }, { "family": "Christensen", "given": "P. R." }, { "family": "Church", "given": "S." }, { "family": "Clements", "given": "D. L." }, { "family": "Colombi", "given": "S." }, { "family": "Colombo", "given": "L. P. L." }, { "family": "Combet", "given": "C." }, { "family": "Contreras", "given": "D." }, { "family": "Couchot", "given": "F." }, { "family": "Coulais", "given": "A." }, { "family": "Crill", "given": "B. P." }, { "family": "Curto", "given": "A." }, { "family": "Cuttaia", "given": "F." }, { "family": "Danese", "given": "L." }, { "family": "Davies", "given": "R. D." }, { "family": "Davis", "given": "R. J." }, { "family": "de Bernardis", "given": "P." }, { "family": "de Rosa", "given": "A." }, { "family": "de Zotti", "given": "G." }, { "family": "Delabrouille", "given": "J." }, { "family": "Désert", "given": "F.-X." }, { "family": "Diego", "given": "J. M." }, { "family": "Dole", "given": "H." }, { "family": "Donzelli", "given": "S." }, { "family": "Doré", "given": "O." }, { "family": "Douspis", "given": "M." }, { "family": "Ducout", "given": "A." }, { "family": "Dupac", "given": "X." }, { "family": "Efstathiou", "given": "G." }, { "family": "Elsner", "given": "F." }, { "family": "Enßlin", "given": "T. A." }, { "family": "Eriksen", "given": "H. K." }, { "family": "Fergusson", "given": "J." }, { "family": "Finelli⋆", "given": "F." }, { "family": "Forni", "given": "O." }, { "family": "Frailis", "given": "M." }, { "family": "Fraisse", "given": "A. A." }, { "family": "Franceschi", "given": "E." }, { "family": "Frejsel", "given": "A." }, { "family": "Frolov", "given": "A." }, { "family": "Galeotta", "given": "S." }, { "family": "Galli", "given": "S." }, { "family": "Ganga", "given": "K." }, { "family": "Gauthier", "given": "C." }, { "family": "Giard", "given": "M." }, { "family": "Giraud-Héraud", "given": "Y." }, { "family": "Gjerløw", "given": "E." }, { "family": "González-Nuevo", "given": "J." }, { "family": "Górski", "given": "K. M." }, { "family": "Gratton", "given": "S." }, { "family": "Gregorio", "given": "A." }, { "family": "Gruppuso", "given": "A." }, { "family": "Gudmundsson", "given": "J. E." }, { "family": "Hamann", "given": "J." }, { "family": "Handley", "given": "W." }, { "family": "Hansen", "given": "F. K." }, { "family": "Hanson", "given": "D." }, { "family": "Harrison", "given": "D. L." }, { "family": "Henrot-Versillé", "given": "S." }, { "family": "Hernández-Monteagudo", "given": "C." }, { "family": "Herranz", "given": "D." }, { "family": "Hildebrandt", "given": "S. R." }, { "family": "Hivon", "given": "E." }, { "family": "Hobson", "given": "M." }, { "family": "Holmes", "given": "W. A." }, { "family": "Hornstrup", "given": "A." }, { "family": "Hovest", "given": "W." }, { "family": "Huang", "given": "Z." }, { "family": "Huffenberger", "given": "K. M." }, { "family": "Hurier", "given": "G." }, { "family": "Jaffe", "given": "A. H." }, { "family": "Jaffe", "given": "T. R." }, { "family": "Jones", "given": "W. C." }, { "family": "Juvela", "given": "M." }, { "family": "Keihänen", "given": "E." }, { "family": "Keskitalo", "given": "R." }, { "family": "Kim", "given": "J." }, { "family": "Kisner", "given": "T. S." }, { "family": "Kneissl", "given": "R." }, { "family": "Knoche", "given": "J." }, { "family": "Kunz", "given": "M." }, { "family": "Kurki-Suonio", "given": "H." }, { "family": "Lagache", "given": "G." }, { "family": "Lähteenmäki", "given": "A." }, { "family": "Lamarre", "given": "J.-M." }, { "family": "Lasenby", "given": "A." }, { "family": "Lattanzi", "given": "M." }, { "family": "Lawrence", "given": "C. R." }, { "family": "Leonardi", "given": "R." }, { "family": "Lesgourgues", "given": "J." }, { "family": "Levrier", "given": "F." }, { "family": "Lewis", "given": "A." }, { "family": "Liguori", "given": "M." }, { "family": "Lilje", "given": "P. B." }, { "family": "Linden-Vørnle", "given": "M." }, { "family": "López-Caniego", "given": "M." }, { "family": "Lubin", "given": "P. M." }, { "family": "Ma", "given": "Y.-Z." }, { "family": "Macías-Pérez", "given": "J. F." }, { "family": "Maggio", "given": "G." }, { "family": "Maino", "given": "D." }, { "family": "Mandolesi", "given": "N." }, { "family": "Mangilli", "given": "A." }, { "family": "Maris", "given": "M." }, { "family": "Martin", "given": "P. G." }, { "family": "Martínez-González", "given": "E." }, { "family": "Masi", "given": "S." }, { "family": "Matarrese", "given": "S." }, { "family": "McGehee", "given": "P." }, { "family": "Meinhold", "given": "P. R." }, { "family": "Melchiorri", "given": "A." }, { "family": "Mendes", "given": "L." }, { "family": "Mennella", "given": "A." }, { "family": "Migliaccio", "given": "M." }, { "family": "Mitra", "given": "S." }, { "family": "Miville-Deschênes", "given": "M.-A." }, { "family": "Molinari", "given": "D." }, { "family": "Moneti", "given": "A." }, { "family": "Montier", "given": "L." }, { "family": "Morgante", "given": "G." }, { "family": "Mortlock", "given": "D." }, { "family": "Moss", "given": "A." }, { "family": "Münchmeyer", "given": "M." }, { "family": "Munshi", "given": "D." }, { "family": "Murphy", "given": "J. A." }, { "family": "Naselsky", "given": "P." }, { "family": "Nati", "given": "F." }, { "family": "Natoli", "given": "P." }, { "family": "Netterfield", "given": "C. B." }, { "family": "Nørgaard-Nielsen", "given": "H. U." }, { "family": "Noviello", "given": "F." }, { "family": "Novikov", "given": "D." }, { "family": "Novikov", "given": "I." }, { "family": "Oxborrow", "given": "C. A." }, { "family": "Paci", "given": "F." }, { "family": "Pagano", "given": "L." }, { "family": "Pajot", "given": "F." }, { "family": "Paladini", "given": "R." }, { "family": "Pandolfi", "given": "S." }, { "family": "Paoletti", "given": "D." }, { "family": "Pasian", "given": "F." }, { "family": "Patanchon", "given": "G." }, { "family": "Pearson", "given": "T. J." }, { "family": "Peiris", "given": "H. V." }, { "family": "Perdereau", "given": "O." }, { "family": "Perotto", "given": "L." }, { "family": "Perrotta", "given": "F." }, { "family": "Pettorino", "given": "V." }, { "family": "Piacentini", "given": "F." }, { "family": "Piat", "given": "M." }, { "family": "Pierpaoli", "given": "E." }, { "family": "Pietrobon", "given": "D." }, { "family": "Plaszczynski", "given": "S." }, { "family": "Pointecouteau", "given": "E." }, { "family": "Polenta", "given": "G." }, { "family": "Popa", "given": "L." }, { "family": "Pratt", "given": "G. W." }, { "family": "Prézeau", "given": "G." }, { "family": "Prunet", "given": "S." }, { "family": "Puget", "given": "J.-L." }, { "family": "Rachen", "given": "J. P." }, { "family": "Reach", "given": "W. T." }, { "family": "Rebolo", "given": "R." }, { "family": "Reinecke", "given": "M." }, { "family": "Remazeilles", "given": "M." }, { "family": "Renault", "given": "C." }, { "family": "Renzi", "given": "A." }, { "family": "Ristorcelli", "given": "I." }, { "family": "Rocha", "given": "G." }, { "family": "Rosset", "given": "C." }, { "family": "Rossetti", "given": "M." }, { "family": "Roudier", "given": "G." }, { "family": "Rowan-Robinson", "given": "M." }, { "family": "Rubiño-Martín", "given": "J. A." }, { "family": "Rusholme", "given": "B." }, { "family": "Sandri", "given": "M." }, { "family": "Santos", "given": "D." }, { "family": "Savelainen", "given": "M." }, { "family": "Savini", "given": "G." }, { "family": "Scott", "given": "D." }, { "family": "Seiffert", "given": "M. D." }, { "family": "Shellard", "given": "E. P. S." }, { "family": "Shiraishi", "given": "M." }, { "family": "Spencer", "given": "L. D." }, { "family": "Stolyarov", "given": "V." }, { "family": "Stompor", "given": "R." }, { "family": "Sudiwala", "given": "R." }, { "family": "Sunyaev", "given": "R." }, { "family": "Sutton", "given": "D." }, { "family": "Suur-Uski", "given": "A.-S." }, { "family": "Sygnet", "given": "J.-F." }, { "family": "Tauber", "given": "J. A." }, { "family": "Terenzi", "given": "L." }, { "family": "Toffolatti", "given": "L." }, { "family": "Tomasi", "given": "M." }, { "family": "Tristram", "given": "M." }, { "family": "Trombetti", "given": "T." }, { "family": "Tucci", "given": "M." }, { "family": "Tuovinen", "given": "J." }, { "family": "Valenziano", "given": "L." }, { "family": "Valiviita", "given": "J." }, { "family": "Van Tent", "given": "B." }, { "family": "Vielva", "given": "P." }, { "family": "Villa", "given": "F." }, { "family": "Wade", "given": "L. A." }, { "family": "Wandelt", "given": "B. D." }, { "family": "Wehus", "given": "I. K." }, { "family": "White", "given": "M." }, { "family": "Yvon", "given": "D." }, { "family": "Zacchei", "given": "A." }, { "family": "Zibin", "given": "J. P." }, { "family": "Zonca", "given": "A." } ], "container-title": "Astronomy & Astrophysics", "container-title-short": "A&A", "id": "3574492/MC4FCNHB", "issued": { "year": 2016 }, "journalAbbreviation": "A&A", "page": "A20", "page-first": "A20", "shortTitle": "Planck 2015 results", "title": "Planck 2015 results: XX. Constraints on inflation", "title-short": "Planck 2015 results", "type": "article-journal", "volume": "594" }, "3574492/UH3EP4MW": { "DOI": "10.1051/0004-6361/201525830", "URL": "http://www.aanda.org/10.1051/0004-6361/201525830", "accessed": { "day": 10, "month": 6, "year": 2020 }, "author": [ { "family": "Planck Collaboration", "given": "" }, { "family": "Ade", "given": "P. A. R." }, { "family": "Aghanim", "given": "N." }, { "family": "Arnaud", "given": "M." }, { "family": "Ashdown", "given": "M." }, { "family": "Aumont", "given": "J." }, { "family": "Baccigalupi", "given": "C." }, { "family": "Banday", "given": "A. J." }, { "family": "Barreiro", "given": "R. B." }, { "family": "Bartlett", "given": "J. G." }, { "family": "Bartolo", "given": "N." }, { "family": "Battaner", "given": "E." }, { "family": "Battye", "given": "R." }, { "family": "Benabed", "given": "K." }, { "family": "Benoît", "given": "A." }, { "family": "Benoit-Lévy", "given": "A." }, { "family": "Bernard", "given": "J.-P." }, { "family": "Bersanelli", "given": "M." }, { "family": "Bielewicz", "given": "P." }, { "family": "Bock", "given": "J. J." }, { "family": "Bonaldi", "given": "A." }, { "family": "Bonavera", "given": "L." }, { "family": "Bond", "given": "J. R." }, { "family": "Borrill", "given": "J." }, { "family": "Bouchet", "given": "F. R." }, { "family": "Boulanger", "given": "F." }, { "family": "Bucher", "given": "M." }, { "family": "Burigana", "given": "C." }, { "family": "Butler", "given": "R. C." }, { "family": "Calabrese", "given": "E." }, { "family": "Cardoso", "given": "J.-F." }, { "family": "Catalano", "given": "A." }, { "family": "Challinor", "given": "A." }, { "family": "Chamballu", "given": "A." }, { "family": "Chary", "given": "R.-R." }, { "family": "Chiang", "given": "H. C." }, { "family": "Chluba", "given": "J." }, { "family": "Christensen", "given": "P. R." }, { "family": "Church", "given": "S." }, { "family": "Clements", "given": "D. L." }, { "family": "Colombi", "given": "S." }, { "family": "Colombo", "given": "L. P. L." }, { "family": "Combet", "given": "C." }, { "family": "Coulais", "given": "A." }, { "family": "Crill", "given": "B. P." }, { "family": "Curto", "given": "A." }, { "family": "Cuttaia", "given": "F." }, { "family": "Danese", "given": "L." }, { "family": "Davies", "given": "R. D." }, { "family": "Davis", "given": "R. J." }, { "family": "de Bernardis", "given": "P." }, { "family": "de Rosa", "given": "A." }, { "family": "de Zotti", "given": "G." }, { "family": "Delabrouille", "given": "J." }, { "family": "Désert", "given": "F.-X." }, { "family": "Di Valentino", "given": "E." }, { "family": "Dickinson", "given": "C." }, { "family": "Diego", "given": "J. M." }, { "family": "Dolag", "given": "K." }, { "family": "Dole", "given": "H." }, { "family": "Donzelli", "given": "S." }, { "family": "Doré", "given": "O." }, { "family": "Douspis", "given": "M." }, { "family": "Ducout", "given": "A." }, { "family": "Dunkley", "given": "J." }, { "family": "Dupac", "given": "X." }, { "family": "Efstathiou", "given": "G." }, { "family": "Elsner", "given": "F." }, { "family": "Enßlin", "given": "T. A." }, { "family": "Eriksen", "given": "H. K." }, { "family": "Farhang", "given": "M." }, { "family": "Fergusson", "given": "J." }, { "family": "Finelli", "given": "F." }, { "family": "Forni", "given": "O." }, { "family": "Frailis", "given": "M." }, { "family": "Fraisse", "given": "A. A." }, { "family": "Franceschi", "given": "E." }, { "family": "Frejsel", "given": "A." }, { "family": "Galeotta", "given": "S." }, { "family": "Galli", "given": "S." }, { "family": "Ganga", "given": "K." }, { "family": "Gauthier", "given": "C." }, { "family": "Gerbino", "given": "M." }, { "family": "Ghosh", "given": "T." }, { "family": "Giard", "given": "M." }, { "family": "Giraud-Héraud", "given": "Y." }, { "family": "Giusarma", "given": "E." }, { "family": "Gjerløw", "given": "E." }, { "family": "González-Nuevo", "given": "J." }, { "family": "Górski", "given": "K. M." }, { "family": "Gratton", "given": "S." }, { "family": "Gregorio", "given": "A." }, { "family": "Gruppuso", "given": "A." }, { "family": "Gudmundsson", "given": "J. E." }, { "family": "Hamann", "given": "J." }, { "family": "Hansen", "given": "F. K." }, { "family": "Hanson", "given": "D." }, { "family": "Harrison", "given": "D. L." }, { "family": "Helou", "given": "G." }, { "family": "Henrot-Versillé", "given": "S." }, { "family": "Hernández-Monteagudo", "given": "C." }, { "family": "Herranz", "given": "D." }, { "family": "Hildebrandt", "given": "S. R." }, { "family": "Hivon", "given": "E." }, { "family": "Hobson", "given": "M." }, { "family": "Holmes", "given": "W. A." }, { "family": "Hornstrup", "given": "A." }, { "family": "Hovest", "given": "W." }, { "family": "Huang", "given": "Z." }, { "family": "Huffenberger", "given": "K. M." }, { "family": "Hurier", "given": "G." }, { "family": "Jaffe", "given": "A. H." }, { "family": "Jaffe", "given": "T. R." }, { "family": "Jones", "given": "W. C." }, { "family": "Juvela", "given": "M." }, { "family": "Keihänen", "given": "E." }, { "family": "Keskitalo", "given": "R." }, { "family": "Kisner", "given": "T. S." }, { "family": "Kneissl", "given": "R." }, { "family": "Knoche", "given": "J." }, { "family": "Knox", "given": "L." }, { "family": "Kunz", "given": "M." }, { "family": "Kurki-Suonio", "given": "H." }, { "family": "Lagache", "given": "G." }, { "family": "Lähteenmäki", "given": "A." }, { "family": "Lamarre", "given": "J.-M." }, { "family": "Lasenby", "given": "A." }, { "family": "Lattanzi", "given": "M." }, { "family": "Lawrence", "given": "C. R." }, { "family": "Leahy", "given": "J. P." }, { "family": "Leonardi", "given": "R." }, { "family": "Lesgourgues", "given": "J." }, { "family": "Levrier", "given": "F." }, { "family": "Lewis", "given": "A." }, { "family": "Liguori", "given": "M." }, { "family": "Lilje", "given": "P. B." }, { "family": "Linden-Vørnle", "given": "M." }, { "family": "López-Caniego", "given": "M." }, { "family": "Lubin", "given": "P. M." }, { "family": "Macías-Pérez", "given": "J. F." }, { "family": "Maggio", "given": "G." }, { "family": "Maino", "given": "D." }, { "family": "Mandolesi", "given": "N." }, { "family": "Mangilli", "given": "A." }, { "family": "Marchini", "given": "A." }, { "family": "Maris", "given": "M." }, { "family": "Martin", "given": "P. G." }, { "family": "Martinelli", "given": "M." }, { "family": "Martínez-González", "given": "E." }, { "family": "Masi", "given": "S." }, { "family": "Matarrese", "given": "S." }, { "family": "McGehee", "given": "P." }, { "family": "Meinhold", "given": "P. R." }, { "family": "Melchiorri", "given": "A." }, { "family": "Melin", "given": "J.-B." }, { "family": "Mendes", "given": "L." }, { "family": "Mennella", "given": "A." }, { "family": "Migliaccio", "given": "M." }, { "family": "Millea", "given": "M." }, { "family": "Mitra", "given": "S." }, { "family": "Miville-Deschênes", "given": "M.-A." }, { "family": "Moneti", "given": "A." }, { "family": "Montier", "given": "L." }, { "family": "Morgante", "given": "G." }, { "family": "Mortlock", "given": "D." }, { "family": "Moss", "given": "A." }, { "family": "Munshi", "given": "D." }, { "family": "Murphy", "given": "J. A." }, { "family": "Naselsky", "given": "P." }, { "family": "Nati", "given": "F." }, { "family": "Natoli", "given": "P." }, { "family": "Netterfield", "given": "C. B." }, { "family": "Nørgaard-Nielsen", "given": "H. U." }, { "family": "Noviello", "given": "F." }, { "family": "Novikov", "given": "D." }, { "family": "Novikov", "given": "I." }, { "family": "Oxborrow", "given": "C. A." }, { "family": "Paci", "given": "F." }, { "family": "Pagano", "given": "L." }, { "family": "Pajot", "given": "F." }, { "family": "Paladini", "given": "R." }, { "family": "Paoletti", "given": "D." }, { "family": "Partridge", "given": "B." }, { "family": "Pasian", "given": "F." }, { "family": "Patanchon", "given": "G." }, { "family": "Pearson", "given": "T. J." }, { "family": "Perdereau", "given": "O." }, { "family": "Perotto", "given": "L." }, { "family": "Perrotta", "given": "F." }, { "family": "Pettorino", "given": "V." }, { "family": "Piacentini", "given": "F." }, { "family": "Piat", "given": "M." }, { "family": "Pierpaoli", "given": "E." }, { "family": "Pietrobon", "given": "D." }, { "family": "Plaszczynski", "given": "S." }, { "family": "Pointecouteau", "given": "E." }, { "family": "Polenta", "given": "G." }, { "family": "Popa", "given": "L." }, { "family": "Pratt", "given": "G. W." }, { "family": "Prézeau", "given": "G." }, { "family": "Prunet", "given": "S." }, { "family": "Puget", "given": "J.-L." }, { "family": "Rachen", "given": "J. P." }, { "family": "Reach", "given": "W. T." }, { "family": "Rebolo", "given": "R." }, { "family": "Reinecke", "given": "M." }, { "family": "Remazeilles", "given": "M." }, { "family": "Renault", "given": "C." }, { "family": "Renzi", "given": "A." }, { "family": "Ristorcelli", "given": "I." }, { "family": "Rocha", "given": "G." }, { "family": "Rosset", "given": "C." }, { "family": "Rossetti", "given": "M." }, { "family": "Roudier", "given": "G." }, { "family": "Rouillé d’Orfeuil", "given": "B." }, { "family": "Rowan-Robinson", "given": "M." }, { "family": "Rubiño-Martín", "given": "J. A." }, { "family": "Rusholme", "given": "B." }, { "family": "Said", "given": "N." }, { "family": "Salvatelli", "given": "V." }, { "family": "Salvati", "given": "L." }, { "family": "Sandri", "given": "M." }, { "family": "Santos", "given": "D." }, { "family": "Savelainen", "given": "M." }, { "family": "Savini", "given": "G." }, { "family": "Scott", "given": "D." }, { "family": "Seiffert", "given": "M. D." }, { "family": "Serra", "given": "P." }, { "family": "Shellard", "given": "E. P. S." }, { "family": "Spencer", "given": "L. D." }, { "family": "Spinelli", "given": "M." }, { "family": "Stolyarov", "given": "V." }, { "family": "Stompor", "given": "R." }, { "family": "Sudiwala", "given": "R." }, { "family": "Sunyaev", "given": "R." }, { "family": "Sutton", "given": "D." }, { "family": "Suur-Uski", "given": "A.-S." }, { "family": "Sygnet", "given": "J.-F." }, { "family": "Tauber", "given": "J. A." }, { "family": "Terenzi", "given": "L." }, { "family": "Toffolatti", "given": "L." }, { "family": "Tomasi", "given": "M." }, { "family": "Tristram", "given": "M." }, { "family": "Trombetti", "given": "T." }, { "family": "Tucci", "given": "M." }, { "family": "Tuovinen", "given": "J." }, { "family": "Türler", "given": "M." }, { "family": "Umana", "given": "G." }, { "family": "Valenziano", "given": "L." }, { "family": "Valiviita", "given": "J." }, { "family": "Van Tent", "given": "F." }, { "family": "Vielva", "given": "P." }, { "family": "Villa", "given": "F." }, { "family": "Wade", "given": "L. A." }, { "family": "Wandelt", "given": "B. D." }, { "family": "Wehus", "given": "I. K." }, { "family": "White", "given": "M." }, { "family": "White", "given": "S. D. M." }, { "family": "Wilkinson", "given": "A." }, { "family": "Yvon", "given": "D." }, { "family": "Zacchei", "given": "A." }, { "family": "Zonca", "given": "A." } ], "container-title": "Astronomy & Astrophysics", "container-title-short": "A&A", "id": "3574492/UH3EP4MW", "issued": { "year": 2016 }, "journalAbbreviation": "A&A", "page": "A13", "page-first": "A13", "shortTitle": "Planck 2015 results", "title": "Planck 2015 results: XIII. Cosmological parameters", "title-short": "Planck 2015 results", "type": "article-journal", "volume": "594" }, "3574492/ZT4XDK5S": { "URL": "http://arxiv.org/abs/2002.07042", "abstract": "We investigate the transformation of initial conditions for primordial curvature perturbations under two types of transformations of the associated action: simultaneous redefinition of time and the field to be quantised, and the addition of surface terms. The latter encompasses all canonical transformations, whilst the time- and field-redefinition is a distinct, non-canonical transformation since the initial and destination systems use different times. Actions related to each other via such transformations yield identical equations of motion and preserve the commutator structure. They further preserve the time-evolution of expectation values of quantum operators unless the vacuum state also changes under the transformation. These properties suggest that it is of interest to investigate vacuum prescriptions that also remain unchanged under canonical transformations. We find that initial conditions derived via minimising the vacuum expectation value of the Hamiltonian and those obtained using the Danielsson vacuum prescription are not invariant under these transformations, whereas those obtained by minimising the local energy density are. We derive the range of physically distinct initial conditions obtainable by Hamiltonian diagonalisation, and illustrate their effect on the scalar primordial power spectrum and the Cosmic Microwave Background under the just enough inflation model. We also generalise the analogy between the dynamics of a quantum scalar field on a curved, time-dependent spacetime and the gauge-invariant curvature perturbation. We argue that the invariance of the vacuum prescription obtained by minimising the renormalised stress--energy tensor should make it the preferred procedure for setting initial conditions for primordial perturbations. All other procedures reviewed in this work yield ambiguous initial conditions, which is problematic both in theory and practice.", "accessed": { "day": 10, "month": 6, "year": 2020 }, "author": [ { "family": "Agocs", "given": "F. J." }, { "family": "Hergt", "given": "L. T." }, { "family": "Handley", "given": "W. J." }, { "family": "Lasenby", "given": "A. N." }, { "family": "Hobson", "given": "M. P." } ], "container-title": "arXiv:2002.07042 [astro-ph, physics:gr-qc]", "id": "3574492/ZT4XDK5S", "issued": { "day": 27, "month": 5, "year": 2020 }, "note": "arXiv: 2002.07042", "title": "Quantum initial conditions for inflation and canonical invariance", "type": "article-journal" } } }, "kernelspec": { "display_name": "scipyenv_new", "language": "python", "name": "scipyenv_new" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2" }, "rise": { "theme": "simple" } }, "nbformat": 4, "nbformat_minor": 4 }