{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "using Plots, ComplexPhasePortrait, ApproxFun\n", "gr();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$\n", "\\def\\dashint{{\\int\\!\\!\\!\\!\\!\\!-\\,}}\n", "\\def\\infdashint{\\dashint_{\\!\\!\\!-\\infty}^{\\,\\infty}}\n", "\\def\\D{\\,{\\rm d}}\n", "\\def\\E{{\\rm e}}\n", "\\def\\dx{\\D x}\n", "\\def\\dt{\\D t}\n", "\\def\\dz{\\D z}\n", "\\def\\C{{\\mathbb C}}\n", "\\def\\R{{\\mathbb R}}\n", "\\def\\CC{{\\cal C}}\n", "\\def\\HH{{\\cal H}}\n", "\\def\\I{{\\rm i}}\n", "\\def\\qqqquad{\\qquad\\qquad}\n", "\\def\\qqfor{\\qquad\\hbox{for}\\qquad}\n", "\\def\\qqwhere{\\qquad\\hbox{where}\\qquad}\n", "\\def\\Res_#1{\\underset{#1}{\\rm Res}}\\,\n", "\\def\\sech{{\\rm sech}\\,}\n", "\\def\\vc#1{{\\mathbf #1}}\n", "$$\n", "\n", "# M3M6: Methods of Mathematical Physics\n", "\n", "Dr. Sheehan Olver\n", "
\n", "s.olver@imperial.ac.uk\n", "\n", "\n", "# Lecture 3: Cauchy's integral formula and Taylor series\n", "\n", "\n", "This lecture we cover\n", "\n", "1. Deformation of contours\n", "2. Cauchy's integral formula\n", " - Application: Numerical differentiation\n", "3. Taylor series" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Deformation of contours\n", "\n", "**Definition (Domain)** A _domain_ is a non-empty, open and connected set $D \\subset {\\mathbb C}$.\n", "\n", "**Definition (Homotopic)** Two closed contours $\\gamma_1 : [a,b] \\rightarrow D$ and $\\gamma_2 \\rightarrow D$ in a domain $D$ are _homotopic_ if they can be continuously deformed to one-another while remaining in $D$. \n", "\n", "**Theorem (Deformation of contours)** Let $f(z)$ be holomorphic in a domain $D$. Let $\\gamma_1$ and $\\gamma_2$ be two homotopic contours. Then\n", "$$\n", " \\int_{\\gamma_1} f(z) dz = \\int_{\\gamma_2} f(z) dz\n", "$$ \n", "\n", "**Definition (Simply connected)** A domain is _simply connected_ if every closed contour is homotoic to a point.\n", "\n", "**Corollary (Deformation of contours on simply connected domains)** Let $f(z)$ be holomorphic in a simply-connected domain $D$. If $\\gamma_1$ and $\\gamma_2$ are two contours in $D$ with the same endpoints, then\n", "\n", "$$\n", " \\int_{\\gamma_1} f(z) dz = \\int_{\\gamma_2} f(z) dz\n", "$$ \n", "\n", "_Demonstration_ We can test this experimentally: in the following, the integral (implemented as `sum`) over two different contours returns the same vaule (up to numerical precision)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(-2.1779795225909058 + 0.8414709848078968im, -2.1779795225909053 + 0.8414709848078966im)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f = Fun( z -> exp(z), Arc(0.,1.,(0,π/2))) # Holomorphic!\n", "f̃ = Fun( z -> exp(z), Segment(1,im)) # Holomorphic!\n", "\n", "sum(f) , sum(f̃)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here is a depection of the two contours:" ] }, { "cell_type": "code", "execution_count": 11, "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", "0.00\n", "\n", "\n", "0.25\n", "\n", "\n", "0.50\n", "\n", "\n", "0.75\n", "\n", "\n", "1.00\n", "\n", "\n", "0.00\n", "\n", "\n", "0.25\n", "\n", "\n", "0.50\n", "\n", "\n", "0.75\n", "\n", "\n", "1.00\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "plot(domain(f); ratio=1.0, legend=false, arrow=true)\n", "plot!(domain(f̃), arrow=true)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Orientation of contours\n", "\n", "Contours are _oriented_: there is a notion of \"left\" and \"right\" inherited from $[a,b]$. For closed contours, there is as notion of positive/negative orientation:\n", "\n", "**Definition (Positive/negative orientation)** Let $\\gamma$ be a simple closed contour and $z$ in the interior of $\\gamma$. We say that $\\gamma$ is _positively oriented_ if \n", "$${1 \\over 2 \\pi i} \\oint_\\gamma {d\\zeta \\over \\zeta - z} = 1$$\n", "It is _negatively oriented_ if the reversed contour $\\gamma_{\\rm reversed}(t) = \\gamma(b+a-t)$ for $t \\in [a,b]$ is positively oriented, or equivalentally\n", "$${1 \\over 2 \\pi i} \\oint_\\gamma {d\\zeta \\over \\zeta - z} = -1$$\n", "\n", "\n", "_Demonstration_ Here we see numerically that $1/z$ is positively oriented:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0 + 1.2545118101832475e-16im" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sum(Fun(z -> 1/z, Circle()))/(2π*im)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Cauchy's integral formula\n", "\n", "Cauchy's integral formula allows us to recover a function from knowlerdge of its values on a surrounding contour:\n", "\n", "**Theorem (Cauchy integral formula)** Suppose $f$ is holomorphic inside and on a positively oriented, simple, closed contour $\\gamma$. Then\n", "$$\n", "f(z) = {1 \\over 2 \\pi i} \\oint_\\gamma {f(\\zeta) \\over \\zeta - z} d \\zeta$$\n", "\n", "_Demonstration_ This shows numerically that we can calculate $\\E^{0.1}$ by integrating over a circle that surrounds $z = 0.1$:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.0 - 0.0im" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "γ = Circle()\n", "ζ = Fun(γ)\n", "z = 0.1\n", "sum(exp(ζ)/(ζ-z)) /(2π*im) - exp(z)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Not only do we know $f$, we also know that $f$ is infinitely-differentiable, and we know all its values:\n", "\n", "**Corollary (Cauchy integral formula for derivatives)** Suppose $f$ is holomorphic inside and on a positively oriented, simple, closed contour $\\gamma$. Then $f$ is infinitely-differentiable at $z$ and \n", "$$\n", "f^{(k)}(z) = {k! \\over 2 \\pi i} \\oint_\\gamma {f(\\zeta) \\over (\\zeta - z)^{k+1}} d \\zeta$$\n", "\n", "_Demonstration_ Here we show that we can recover $\\E^z$ using any of the derivatives:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.7801382590221237e-10 - 0.0im" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "k=10\n", "factorial(1.0k)*sum(exp(ζ)/(ζ-z)^(k+1))/(2π*im) - exp(z)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "4.218847493575595e-15 - 0.0im" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "z = 0.1\n", "k = 5\n", "factorial(1.0k)*sum(exp(ζ)/(ζ-z)^(k+1))/(2π*im) - exp(z)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Taylor series\n", "\n", "\n", "**Theorem (Taylor)** Suppose $f$ is holomorphic in a ball $B(z_0,r)$. Then inside this ball we have\n", "$$\n", " f(z) = \\sum_{k=0}^\\infty {f^{(k)}(z_0) \\over k!} (z-z_0)^k\n", "$$ \n", "\n", "\n", "_Examples_\n", "1. $\\E^z$\n", "2. $1/(1-z)$\n", "3. $\\sec z$\n", "4. $\\sqrt z$\n", "\n", "here we plot the $n$-term Taylor approximation of $\\E^z$:" ] }, { "cell_type": "code", "execution_count": 8, "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", "-20\n", "\n", "\n", "-10\n", "\n", "\n", "0\n", "\n", "\n", "10\n", "\n", "\n", "20\n", "\n", "\n", "-20\n", "\n", "\n", "-10\n", "\n", "\n", "0\n", "\n", "\n", "10\n", "\n", "\n", "20\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expⁿ = (n,z) -> sum(z^k/factorial(1.0k) for k=0:n)\n", "phaseplot(-20..20, -20..20, z -> expⁿ.(10,z))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And now the $n$-term Taylor approximation to $1/(1-z)$:" ] }, { "cell_type": "code", "execution_count": 9, "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", "-2\n", "\n", "\n", "-1\n", "\n", "\n", "0\n", "\n", "\n", "1\n", "\n", "\n", "2\n", "\n", "\n", "-2\n", "\n", "\n", "-1\n", "\n", "\n", "0\n", "\n", "\n", "1\n", "\n", "\n", "2\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "geometricⁿ = (n,z) -> sum(z^k for k=0:n)\n", "\n", "phaseplot(-2..2, -2..2, z -> geometricⁿ.(20,z))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And here the $n$-term Taylor approximation of $\\sqrt z$ near $z_0$:" ] }, { "cell_type": "code", "execution_count": 10, "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", "-2\n", "\n", "\n", "-1\n", "\n", "\n", "0\n", "\n", "\n", "1\n", "\n", "\n", "2\n", "\n", "\n", "-2\n", "\n", "\n", "-1\n", "\n", "\n", "0\n", "\n", "\n", "1\n", "\n", "\n", "2\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "function sqrtⁿ(n,z,z₀) \n", " ret = sqrt(z₀)\n", " c = 0.5/ret*(z-z₀)\n", " for k=1:n\n", " ret += c\n", " c *= -(2k-1)/(2*(k+1)*z₀)*(z-z₀)\n", " end\n", " ret\n", "end\n", "\n", "\n", "z₀ = 0.3\n", "n = 40\n", "phaseplot(-2..2, -2..2, z -> sqrtⁿ.(n,z,z₀))" ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.0.1", "language": "julia", "name": "julia-1.0" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.0.1" } }, "nbformat": 4, "nbformat_minor": 2 }