{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "using Plots, ComplexPhasePortrait, ApproxFun, SingularIntegralEquations, DifferentialEquations\n", "gr();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# M3M6: Methods of Mathematical Physics\n", "\n", "$$\n", "\\def\\dashint{{\\int\\!\\!\\!\\!\\!\\!-\\,}}\n", "\\def\\infdashint{\\dashint_{\\!\\!\\!-\\infty}^{\\,\\infty}}\n", "\\def\\D{\\,{\\rm d}}\n", "\\def\\dx{\\D x}\n", "\\def\\dt{\\D t}\n", "\\def\\C{{\\mathbb C}}\n", "\\def\\CC{{\\cal C}}\n", "\\def\\HH{{\\cal H}}\n", "\\def\\I{{\\rm i}}\n", "\\def\\qqfor{\\qquad\\hbox{for}\\qquad}\n", "$$\n", "\n", "Dr. Sheehan Olver\n", "
\n", "s.olver@imperial.ac.uk\n", "\n", "
\n", "Website: https://github.com/dlfivefifty/M3M6LectureNotes\n", "\n", "# Lecture 13: Electric charges in a potential well\n", "\n", "1. One charge in a well\n", "2. Two charges in a well\n", "3. $N$ charges in a well\n", "4. Limiting distribution" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "We study the dynamics of many electric charges in a potential well. We restrict our attention to 1D: picture an infinitely long wire with carges on it. We will see that as the number of charges becomes large, we can determine the limiting distribution using an additive Riemann–Hilbert problem, but one which the _interval_ its posed on is solved for.\n", "\n", "## One charge in a potential well \n", "\n", "Consider a point charge in a well $V(x) = x^2 / 2$, initially located at $\\lambda^0$. The dynamics of the point charge are governed by\n", "$$\n", "{ \\D \\lambda \\over \\dt} = -V'(\\lambda) = - \\lambda\n", "$$\n", "that is: if we are positive we move left and if we are negative we move right. Here is a movie:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "V = x -> x^2/2\n", "Vp = x -> x\n", "\n", "λ⁰ = 2.3 # initial location\n", "prob = ODEProblem((λ,_,t) -> -Vp(λ), λ⁰, (0.0, 10.0))\n", "λ = solve(prob; reltol=1E-6);" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "@gif for t=0.0:0.05:7.0\n", " plot(V, range(-5, stop=5, length=100); label=\"potential\", title=\"t = $t\")\n", " scatter!([λ(t)] ,[0.0]; label=\"charge\")\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![One charge](onecharge.gif)\n", "\n", "In the limit the charge reaches an equilibrium: it no longer varies in time. I.e., it reaches a point where ${\\D\\lambda \\over \\dt} = 0$, which is equivalent to solving\n", "$$\n", " 0 = - V'(\\lambda) = - \\lambda\n", "$$\n", "in other words, the minimum of the well, in this case $\\lambda = 0$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Two charges in a potential well \n", "\n", "Suppose there are now two charges, $\\lambda_1$ and $\\lambda_2$. The effect on the first charge $\\lambda_1$ is to repulse away from $\\lambda_2$ via via:\n", "$$\n", "{\\D \\lambda_1 \\over \\D t} = {1 \\over \\lambda_1 -\\lambda_2}\n", "$$\n", "Similarly, the effect on $\\lambda_2$ is\n", "$$\n", "{\\D \\lambda_2 \\over \\D t} = {1 \\over \\lambda_2 -\\lambda_1}\n", "$$\n", "Unrestricted, the two potentials will repulse off to infinity:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "λ⁰ = [1.2,2.3] # initial location\n", "prob = ODEProblem((λ,_,t) -> [1/(λ[1] - λ[2]), 1/(λ[2] - λ[1])], λ⁰, (0.0, 10.0))\n", "λ = solve(prob; reltol=1E-6);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "@gif for t=0.0:0.05:7.0\n", " scatter(λ(t) ,zeros(2); label=\"charges\", xlims=(-5,5), title=\"t = $t\")\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![Two charges, no potential](twocharges_nov.gif)\n", "\n", "Adding in a potential well and we get an equilbrium again:\n", "\\begin{align*}\n", "{\\D \\lambda_1 \\over \\D t} = {1 \\over \\lambda_1 -\\lambda_2} - V'(\\lambda_1) \\\\\n", "{\\D \\lambda_2 \\over \\D t} = {1 \\over \\lambda_2 -\\lambda_1} - V'(\\lambda_2)\n", "\\end{align*}\n" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "λ₀ = [1.2,2.3] # initial location\n", "prob = ODEProblem((λ,_,t) -> [1/(λ[1] - λ[2]) - Vp(λ[1]), 1/(λ[2] - λ[1]) - Vp(λ[2])], λ₀, (0.0, 10.0))\n", "λ = solve(prob; reltol=1E-6);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "@gif for t=0.0:0.05:7.0\n", " plot(V, range(-5, stop=5, length=100); label=\"potential\", title=\"t = $t\")\n", " scatter!(λ(t) ,zeros(2); label=\"charges\", xlims=(-5,5), title=\"t = $t\")\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![Two charges](twocharges.gif)\n", "\n", "The limiting distribution is given by\n", "\\begin{align*}\n", "0 = {1 \\over \\lambda_1 -\\lambda_2} - V'(\\lambda_1) \\\\\n", "0 = {1 \\over \\lambda_2 -\\lambda_1} - V'(\\lambda_2) \n", "\\end{align*}\n", "For this potential, we can solve it exactly: we need to solve\n", "\\begin{align*}\n", "\\lambda_1 = {1 \\over \\lambda_1 -\\lambda_2} \\\\\n", "\\lambda_2 = {1 \\over \\lambda_2 -\\lambda_1} \n", "\\end{align*}\n", "Using $\\lambda_1 = -\\lambda_2$, we find that $\\lambda_1 = \\pm{1 \\over \\sqrt 2}$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### $N$ charges in a potential well\n", "\n", "Each charge repulses every other charge, so we end up needing to sum over them all:\n", "\\begin{align*}\n", "{\\D \\lambda_k \\over \\D t} = \\sum_{j=1 \\atop j \\neq k}^N {1 \\over \\lambda_k -\\lambda_j} - V'(\\lambda_k) \\\\\n", "\\end{align*}\n", "\n" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "N = 100\n", "λ⁰ = randn(N) # initial location\n", "prob = ODEProblem((λ,_,t) -> [sum(1 ./ (λ[k] .- λ[[1:k-1;k+1:end]])) - Vp(λ[k]) for k=1:N], λ⁰, (0.0, 10.0))\n", "λ = solve(prob; reltol=1E-6);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "@gif for t=0.0:0.05:7.0\n", " plot(V, range(-5, stop=5, length=100); label=\"potential\", title=\"t = $t\")\n", " scatter!(λ(t) ,zeros(N); label=\"charges\", xlims=(-5,5), title=\"t = $t\")\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![N charges](ncharges.gif)\n", "\n", "As the number of charges becomes large, they spread off to infinity. In the case of $V(x) = x^2$, we can renormalize by dividing by $N$ so they stay bounded:\n", "$\\mu_k = {\\lambda_k \\over \\sqrt N}$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "@gif for t=0.0:0.05:7.0\n", " scatter(λ(t)/sqrt(N) ,zeros(N); label=\"charges\", xlims=(-2,2), title=\"t = $t\")\n", "end" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![N charges, rescaled](ncharges_scaled.gif)\n", "\n", "This begs questions: why does it balance out at $\\pm \\sqrt 2$? Why does it have a nice histogram precisely like ${\\sqrt{2-x^2} \\over \\pi}$:" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "-1.5\n", "\n", "\n", "-1.0\n", "\n", "\n", "-0.5\n", "\n", "\n", "0.0\n", "\n", "\n", "0.5\n", "\n", "\n", "1.0\n", "\n", "\n", "1.5\n", "\n", "\n", "0.0\n", "\n", "\n", "0.1\n", "\n", "\n", "0.2\n", "\n", "\n", "0.3\n", "\n", "\n", "0.4\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "histogram of charges\n", "\n", "\n", "\n", "semicircle\n", "\n", "\n" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "histogram(λ(10.0)/sqrt(N); nbins=20, normalize=true, label=\"histogram of charges\")\n", "plot!(x -> sqrt(2-x^2)/(π), range(eps()-sqrt(2.0); stop=sqrt(2)-eps(), length=100), label=\"semicircle\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Equilibrium distribution\n", "\n", "Plugging in $\\lambda_k = \\sqrt N \\mu_k$, we get a dynamical system for $\\mu_k$:\n", "$$\n", " {\\D \\mu_k \\over \\D t} = {1 \\over N} \\sum_{j=1 \\atop j \\neq k}^N {1 \\over \\mu_k -\\mu_j} - \\mu_k\n", "$$\n", "(The choice of scaling like $\\sqrt N$ was dictated by $V'(x)$, if $V(x) = x^4$ it would be $N^{1/4}$.) Thus the limit of the charges is given by\n", "$$\n", "0 = {1 \\over N} \\sum_{j=1 \\atop j \\neq k}^N {1 \\over \\mu_k -\\mu_j} - \\mu_k \n", "$$\n", "\n", "\n", "\n", "It is convenient to represent the point charges by Dirac delta functions:\n", "$$\n", " w_N(x) = {1 \\over N} \\sum_{k=1}^N \\delta_{\\mu_k}(x)\n", "$$\n", "normalized so that $\\int w_N(x) \\dx = 1$, so that\n", "$$\n", " {1 \\over N} \\sum_{k=1}^N {1 \\over x -\\mu_j} = \\int_{-\\infty}^\\infty {w_N(t) \\dt \\over x - t}\n", "$$\n", "or in other words, we have \n", "$$\n", " \\HH_{(-\\infty,\\infty)} w_N(\\mu_k) = -{V'(\\mu_k) \\over \\pi}\n", "$$\n", "since\n", "$$\n", "\\HH w_n (\\mu_k) = {1 \\over \\pi} \\lim_{\\epsilon\\rightarrow 0} \\left(\\int_{-\\infty}^{\\mu_k-\\epsilon} + \\int_{\\mu_k+\\epsilon}^\\infty\\right) {w_N(t) \\over t - \\mu_k} \\dt = {1 \\over N\\pi} \\sum_{j \\neq k} {1 \\over \\mu_j - \\mu_k}\n", "$$\n", "\n", "Formally (see a more detailed explanation below), $w_N(x)$ tends to a continuous limit as $N\\rightarrow \\infty$, which we have guessed from the histogram to be $w(x) = { \\sqrt{2-x^2} \\over \\pi}$ for $-\\sqrt 2 < x < \\sqrt2$. We expect this limit to satisfy the same equation as $w_n$, that is\n", "$$\n", " \\HH w(x) = -{x \\over \\pi}\n", "$$\n", "for $x$ in the support of $w(x)$.\n", "\n", "\n", "Indeed:\n", " " ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "ename": "UndefVarError", "evalue": "UndefVarError: norm not defined", "output_type": "error", "traceback": [ "UndefVarError: norm not defined", "", "Stacktrace:", " [1] top-level scope at In[16]:3" ] } ], "source": [ "x = Fun(-sqrt(2) .. sqrt(2))\n", "w = sqrt(2-x^2)/π\n", "\n", "norm(hilbert(w) + x/π)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Why is it $[-\\sqrt 2, \\sqrt 2]$? \n", "\n", "We thus want to choose the interval $[a,b]$ so that there exists a $w(x)$ satisfying\n", "\n", "1. $w$ is bounded (Based on observation)\n", "2. $w(x) \\geq 0$ for $a \\leq x \\leq b$ (Since it is a probability distribution)\n", "2. $\\int_a^b w(x) \\dx = 1$ (Since it is a probability distribution)\n", "3. $\\HH_{[a,b]} w(x) = - x/\\pi$ \n", "\n", "As we saw last lecture, there exists a bounded solution to \n", "$\\HH_{[-b,b]} u = - x/\\pi$,\n", "namely $u(x) = { \\sqrt{b^2-x^2} \\over \\pi}$. The choice $b = \\sqrt{2}$ ensures that $\\int_{-b}^b u(x) \\dx = 1$, hence $u(x) = w(x)$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Aside: Explanation of limit of $w_N(x)$\n", "\n", "This is beyond the scope of the course, but the convergence of $w_N(x)$ to $w(x)$ is known as weak-\\* convergence. A simple version of this is that\n", "$$\n", " \\int_c^d w_N(x) \\dx \\rightarrow \\int_c^d w(x) \\dx\n", "$$\n", "for every choice of interval $(c,d)$. $ \\int_c^d w_N(x) \\dx $ is precisely the number of charges in $(c,d)$ scaled by $1/N$, which is exactly what a histogram plots." ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.1790059168895313" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = -0.1; b= 0.3;\n", "w = Fun(x -> sqrt(2-x^2)/π, a .. b)\n", "sum(w) # integral of w(x) between a and b" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.18" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "length(filter(λ -> a ≤ λ ≤ b, λ(10.0)/sqrt(N)))/N # integral of w_N(x) between a and b " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Another varient of describing weak-\\* convergence is that the Cauchy transforms converge, that is, for $z$ on any contour $\\gamma$ surrounding $a$ and $b$ (now the support of $w$) we have\n", "$$\n", "\\int_a^b {w_N(x) \\over x - z} \\dx \\rightarrow \\int_a^b {w(x) \\over x - z} \\dx\n", "$$\n", "converges uniformly with respect to $N \\rightarrow \\infty$.\n", "here we demonstrate it converges at a point:" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.1949409042727309 + 0.013681505291622225im" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = Fun(-sqrt(2) .. sqrt(2))\n", "w = sqrt(2-x^2)/π\n", "z = 0.1+0.2im\n", "cauchy(w, z)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.19542123392652283 + 0.013724448552242337im" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(sum(1 ./((λ(10.0)/sqrt(N)) .- z))/N)/(2π*im)" ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.0.2", "language": "julia", "name": "julia-1.0" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.0.2" } }, "nbformat": 4, "nbformat_minor": 2 }