{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "47bed693",
            "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": "cd7396a5",
            "cell_type": "markdown",
            "source": "Compute the first four roots of the first derivative of the\nBessel function of second kind for order 0 $Y_0'$.\n",
            "metadata": {}
        },
        {
            "id": "c760087f",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.special import ynp_zeros\nynp_zeros(0, 4)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([ 2.19714133,  5.42968104,  8.59600587, 11.74915483])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "c6957ba9",
            "cell_type": "markdown",
            "source": "Plot $Y_0$, $Y_0'$ and confirm visually that the roots of\n$Y_0'$ are located at local extrema of $Y_0$.\n",
            "metadata": {}
        },
        {
            "id": "54259301",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy.special import yn, ynp_zeros, yvp\nzeros = ynp_zeros(0, 4)\nxmax = 13\nx = np.linspace(0, xmax, 500)\nfig, ax = plt.subplots()\nax.plot(x, yn(0, x), label=r'$Y_0$')\nax.plot(x, yvp(0, x, 1), label=r\"$Y_0'$\")\nax.scatter(zeros, np.zeros((4, )), s=30, c='r',\n           label=r\"Roots of $Y_0'$\", zorder=5)\nfor root in zeros:\n    y0_extremum =  yn(0, root)\n    lower = min(0, y0_extremum)\n    upper = max(0, y0_extremum)\n    ax.vlines(root, lower, upper, color='r')\nax.hlines(0, 0, xmax, color='k')\nax.set_ylim(-0.6, 0.6)\nax.set_xlim(0, xmax)\nplt.legend()\nplt.show()",
            "outputs": []
        }
    ]
}