.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/complex_analysis/series/plot_01_casorati_weierstrass.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_complex_analysis_series_plot_01_casorati_weierstrass.py: The Casorati-Weierstrass theorem: near an essential singularity f comes close to every value ============================================================================================ An isolated singularity is removable, a pole, or *essential*, depending on whether the Laurent series has no negative powers, finitely many, or infinitely many. Casorati and Weierstrass showed that near an essential singularity the values of :math:`f` are dense in the plane. For :math:`e^{1/z}` at 0 we find a point within :math:`\delta = 10^{-3}` of 0 where :math:`f` hits an arbitrary target :math:`w`, and the phase portrait shows every color packed into every neighbourhood of 0. .. GENERATED FROM PYTHON SOURCE LINES 15-23 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from mathematicskit.complex_analysis import domain_coloring, laurent_coefficients from mathematicskit.complex_analysis.visualizers import plot_domain_coloring f = lambda z: np.exp(1 / z) .. GENERATED FROM PYTHON SOURCE LINES 24-26 Infinitely many negative powers ------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 26-30 .. code-block:: Python series = laurent_coefficients(f, 0.0, 1.0, 6) print("a_{-k} for k = 0..6:", np.round([series.coefficient(-k).real for k in range(7)], 6), "(= 1/k!)") .. rst-class:: sphx-glr-script-out .. code-block:: none a_{-k} for k = 0..6: [1. 1. 0.5 0.166667 0.041667 0.008333 0.001389] (= 1/k!) .. GENERATED FROM PYTHON SOURCE LINES 31-34 Hitting any target value arbitrarily close to 0 ----------------------------------------------- :math:`e^{1/z} = w` has the solutions :math:`z = 1/(\log w + 2\pi i n)`; large :math:`n` makes :math:`|z|` small. .. GENERATED FROM PYTHON SOURCE LINES 34-41 .. code-block:: Python delta = 1e-3 for w in (5.0, -2 + 1j, 1e-4j): n = int(np.ceil(1 / (2 * np.pi * delta))) + 1 z = 1 / (np.log(w) + 2j * np.pi * n) print(f"target w = {w}: z = {z:.2e}, |z| = {abs(z):.1e} < {delta}, f(z) = {f(z):.6f}") .. rst-class:: sphx-glr-script-out .. code-block:: none target w = 5.0: z = 1.57e-06-9.89e-04j, |z| = 9.9e-04 < 0.001, f(z) = 5.000000-0.000000j target w = (-2+1j): z = 7.82e-07-9.86e-04j, |z| = 9.9e-04 < 0.001, f(z) = -2.000000+1.000000j target w = 0.0001j: z = -8.97e-06-9.87e-04j, |z| = 9.9e-04 < 0.001, f(z) = -0.000000+0.000100j .. GENERATED FROM PYTHON SOURCE LINES 42-44 Zooming in on the singularity ----------------------------- .. GENERATED FROM PYTHON SOURCE LINES 44-50 .. code-block:: Python fig, axes = plt.subplots(1, 3, figsize=(13, 4.5)) for ax, half_width in zip(axes, (1.0, 0.1, 0.01), strict=False): result = domain_coloring(f, (-half_width, half_width), (-half_width, half_width), resolution=400) plot_domain_coloring(result, ax=ax, title=rf"$e^{{1/z}}$, $|{{\rm Re}}\,z|, |{{\rm Im}}\,z| < {half_width}$") fig.tight_layout() .. image-sg:: /api/gallery/complex_analysis/series/images/sphx_glr_plot_01_casorati_weierstrass_001.png :alt: $e^{1/z}$, $|{\rm Re}\,z|, |{\rm Im}\,z| < 1.0$, $e^{1/z}$, $|{\rm Re}\,z|, |{\rm Im}\,z| < 0.1$, $e^{1/z}$, $|{\rm Re}\,z|, |{\rm Im}\,z| < 0.01$ :srcset: /api/gallery/complex_analysis/series/images/sphx_glr_plot_01_casorati_weierstrass_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.480 seconds) .. _sphx_glr_download_api_gallery_complex_analysis_series_plot_01_casorati_weierstrass.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/complex_analysis/series/plot_01_casorati_weierstrass.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_casorati_weierstrass.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_casorati_weierstrass.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_casorati_weierstrass.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_