.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/special_functions/airy/plot_01_airy_functions.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_airy_plot_01_airy_functions.py: The Airy functions Ai and Bi ================================= Plots Ai and Bi across the turning point x = 0 where y'' = xy switches from oscillation to exponential behaviour, and checks the Wronskian Ai Bi' - Ai' Bi = 1/pi. .. GENERATED FROM PYTHON SOURCE LINES 11-16 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from mathematicskit.special_functions import airy_functions .. GENERATED FROM PYTHON SOURCE LINES 17-19 Oscillation on the left, growth or decay on the right ------------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 19-31 .. code-block:: Python x = np.linspace(-15, 3, 18001) r = airy_functions(x) fig, ax = plt.subplots() ax.plot(x, r.ai, label="Ai(x)") ax.plot(x, r.bi, label="Bi(x)") ax.axvline(0, color="gray", ls=":") ax.set_ylim(-0.6, 1.2) ax.set_xlabel("x") ax.set_title(r"Solutions of $y'' = xy$") ax.legend() .. image-sg:: /api/gallery/special_functions/airy/images/sphx_glr_plot_01_airy_functions_001.png :alt: Solutions of $y'' = xy$ :srcset: /api/gallery/special_functions/airy/images/sphx_glr_plot_01_airy_functions_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 32-34 Wronskian and the first zeros of Ai ----------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 34-39 .. code-block:: Python wronskian = r.ai * r.bi_prime - r.ai_prime * r.bi print(f"Wronskian range: [{wronskian.min():.12f}, {wronskian.max():.12f}], 1/pi = {1 / np.pi:.12f}") zeros = x[:-1][np.diff(np.sign(r.ai)) != 0][::-1][:3] print(f"first zeros of Ai near {np.round(zeros, 3)} (known: -2.338, -4.088, -5.521)") .. rst-class:: sphx-glr-script-out .. code-block:: none Wronskian range: [0.318309886184, 0.318309886184], 1/pi = 0.318309886184 first zeros of Ai near [-2.339 -4.088 -5.521] (known: -2.338, -4.088, -5.521) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.051 seconds) .. _sphx_glr_download_api_gallery_special_functions_airy_plot_01_airy_functions.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_airy_functions.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_airy_functions.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_airy_functions.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_