{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "5547d6d2",
            "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": "1373d7e8",
            "cell_type": "markdown",
            "source": "Compute the modified bessel function of the second kind of order 0 and\nits first two derivatives at 1.\n",
            "metadata": {}
        },
        {
            "id": "971b552e",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.special import kvp\nkvp(0, 1, 0), kvp(0, 1, 1), kvp(0, 1, 2)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.42102443824070834, -0.6019072301972346, 1.0229316684379428)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "1527fb44",
            "cell_type": "markdown",
            "source": "Compute the first derivative of the modified Bessel function of the second\nkind for several orders at 1 by providing an array for `v`.\n",
            "metadata": {}
        },
        {
            "id": "eff63a32",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "kvp([0, 1, 2], 1, 1)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-0.60190723, -1.02293167, -3.85158503])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "7dce2b36",
            "cell_type": "markdown",
            "source": "Compute the first derivative of the modified Bessel function of the\nsecond kind of order 0 at several points by providing an array for `z`.\n",
            "metadata": {}
        },
        {
            "id": "7f3cbf87",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\npoints = np.array([0.5, 1.5, 3.])\nkvp(0, points, 1)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-1.65644112, -0.2773878 , -0.04015643])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "38e84f65",
            "cell_type": "markdown",
            "source": "Plot the modified bessel function of the second kind and its\nfirst three derivatives.\n",
            "metadata": {}
        },
        {
            "id": "1259a103",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import matplotlib.pyplot as plt\nx = np.linspace(0, 5, 1000)\nfig, ax = plt.subplots()\nax.plot(x, kvp(1, x, 0), label=r\"$K_1$\")\nax.plot(x, kvp(1, x, 1), label=r\"$K_1'$\")\nax.plot(x, kvp(1, x, 2), label=r\"$K_1''$\")\nax.plot(x, kvp(1, x, 3), label=r\"$K_1'''$\")\nax.set_ylim(-2.5, 2.5)\nplt.legend()\nplt.show()",
            "outputs": []
        }
    ]
}