.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/special_functions/hypergeometric/plot_02_kummer_confluent.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_special_functions_hypergeometric_plot_02_kummer_confluent.py: Kummer's confluent hypergeometric function ================================================ Checks Kummer's transformation M(a, b, z) = e^z M(b - a, b, -z) and shows 2F1(a, c; b; z/c) merging into 1F1(a; b; z) as c grows. .. GENERATED FROM PYTHON SOURCE LINES 10-15 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from mathematicskit.special_functions import confluent_hypergeometric_1f1, hypergeometric_2f1 .. GENERATED FROM PYTHON SOURCE LINES 16-18 Kummer's transformation ----------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 18-25 .. code-block:: Python a, b = 0.6, 2.3 z = np.linspace(-4, 4, 9) lhs = confluent_hypergeometric_1f1(a, b, z) rhs = np.exp(z) * confluent_hypergeometric_1f1(b - a, b, -z) print(f"max |M(a,b,z) - e^z M(b-a,b,-z)| = {np.max(np.abs(lhs - rhs)):.1e}") .. rst-class:: sphx-glr-script-out .. code-block:: none max |M(a,b,z) - e^z M(b-a,b,-z)| = 2.2e-16 .. GENERATED FROM PYTHON SOURCE LINES 26-28 The confluence of two singular points ----------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 28-38 .. code-block:: Python a, b = 0.5, 1.5 z = np.linspace(-3, 3, 300) fig, ax = plt.subplots() for c in (2.0, 5.0, 20.0): ax.plot(z, hypergeometric_2f1(a, c, b, z / c), "--", label=f"${{}}_2F_1(a, {c:g}; b; z/{c:g})$") ax.plot(z, confluent_hypergeometric_1f1(a, b, z), "k", lw=2, label=r"${}_1F_1(a; b; z)$") ax.set_xlabel("z") ax.set_title(r"$a = 1/2$, $b = 3/2$: the confluent limit") ax.legend() .. image-sg:: /api/gallery/special_functions/hypergeometric/images/sphx_glr_plot_02_kummer_confluent_001.png :alt: $a = 1/2$, $b = 3/2$: the confluent limit :srcset: /api/gallery/special_functions/hypergeometric/images/sphx_glr_plot_02_kummer_confluent_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.033 seconds) .. _sphx_glr_download_api_gallery_special_functions_hypergeometric_plot_02_kummer_confluent.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_kummer_confluent.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_kummer_confluent.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_kummer_confluent.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_