{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "bad7286e",
            "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": "d7698cb7",
            "cell_type": "markdown",
            "source": "In the following example `iv` returns infinity whereas `ive` still returns\na finite number.\n",
            "metadata": {}
        },
        {
            "id": "ca110a37",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "from scipy.special import iv, ive\nimport numpy as np\nimport matplotlib.pyplot as plt\niv(3, 1000.), ive(3, 1000.)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(inf, 0.01256056218254712)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "022d0a1a",
            "cell_type": "markdown",
            "source": "Evaluate the function at one point for different orders by\nproviding a list or NumPy array as argument for the `v` parameter:\n",
            "metadata": {}
        },
        {
            "id": "be8e5840",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "ive([0, 1, 1.5], 1.)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([0.46575961, 0.20791042, 0.10798193])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "2d10b1b5",
            "cell_type": "markdown",
            "source": "Evaluate the function at several points for order 0 by providing an\narray for `z`.\n",
            "metadata": {}
        },
        {
            "id": "43ab27d0",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "points = np.array([-2., 0., 3.])\nive(0, points)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([0.30850832, 1.        , 0.24300035])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "0350493a",
            "cell_type": "markdown",
            "source": "Evaluate the function at several points for different orders by\nproviding arrays for both `v` for `z`. Both arrays have to be\nbroadcastable to the correct shape. To calculate the orders 0, 1\nand 2 for a 1D array of points:\n",
            "metadata": {}
        },
        {
            "id": "c5941254",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "ive([[0], [1], [2]], points)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[ 0.30850832,  1.        ,  0.24300035],\n       [-0.21526929,  0.        ,  0.19682671],\n       [ 0.09323903,  0.        ,  0.11178255]])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "b9a908ae",
            "cell_type": "markdown",
            "source": "Plot the functions of order 0 to 3 from -5 to 5.\n",
            "metadata": {}
        },
        {
            "id": "46af93c4",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "fig, ax = plt.subplots()\nx = np.linspace(-5., 5., 1000)\nfor i in range(4):\n    ax.plot(x, ive(i, x), label=fr'$I_{i!r}(z)\\cdot e^{{-|z|}}$')\nax.legend()\nax.set_xlabel(r\"$z$\")\nplt.show()",
            "outputs": []
        }
    ]
}