{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "de96e22b",
            "cell_type": "markdown",
            "source": "<div class='alert alert-warning'>\n\nSciPy's interactive examples with Jupyterlite are experimental and may not always work as expected. Execution of cells containing imports may result in large downloads (up to 60MB of content for the first import from SciPy). Load times when importing from SciPy may take roughly 10-20 seconds. If you notice any problems, feel free to open an [issue](https://github.com/scipy/scipy/issues/new/choose).\n\n</div>",
            "metadata": {}
        },
        {
            "id": "5bd2665a",
            "cell_type": "markdown",
            "source": "The generalized Laguerre polynomials are closely related to the confluent\nhypergeometric function ${}_1F_1$:\n\n$$ L_n^{(\\alpha)} = \\binom{n + \\alpha}{n} {}_1F_1(-n, \\alpha +1, x) $$\nThis can be verified, for example,  for $n = \\alpha = 3$ over the\ninterval $[-1, 1]$:\n",
            "metadata": {}
        },
        {
            "id": "2d21e283",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.special import binom\nfrom scipy.special import genlaguerre\nfrom scipy.special import hyp1f1\nx = np.arange(-1.0, 1.0, 0.01)\nnp.allclose(genlaguerre(3, 3)(x), binom(6, 3) * hyp1f1(-3, 4, x))",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "True"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "0c03e9d9",
            "cell_type": "markdown",
            "source": "This is the plot of the generalized Laguerre polynomials\n$L_3^{(\\alpha)}$ for some values of $\\alpha$:\n",
            "metadata": {}
        },
        {
            "id": "0c780306",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import matplotlib.pyplot as plt\nx = np.arange(-4.0, 12.0, 0.01)\nfig, ax = plt.subplots()\nax.set_ylim(-5.0, 10.0)\nax.set_title(r'Generalized Laguerre polynomials $L_3^{\\alpha}$')\nfor alpha in np.arange(0, 5):\n    ax.plot(x, genlaguerre(3, alpha)(x), label=rf'$L_3^{(alpha)}$')\nplt.legend(loc='best')\nplt.show()",
            "outputs": []
        }
    ]
}