{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "49f35f58",
            "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": "1abd6ba9",
            "cell_type": "markdown",
            "source": "Compare the output of `jv` and `jve` for large complex arguments for `z`\nby computing their values for order ``v=1`` at ``z=1000j``. We see that\n`jv` overflows but `jve` returns a finite number:\n",
            "metadata": {}
        },
        {
            "id": "6bb4d065",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.special import jv, jve\nv = 1\nz = 1000j\njv(v, z), jve(v, z)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "((inf+infj), (7.721967686709077e-19+0.012610930256928629j))"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "c1154035",
            "cell_type": "markdown",
            "source": "For real arguments for `z`, `jve` returns the same as `jv`.\n",
            "metadata": {}
        },
        {
            "id": "bf80823c",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "v, z = 1, 1000\njv(v, z), jve(v, z)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.004728311907089523, 0.004728311907089523)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "3fc54296",
            "cell_type": "markdown",
            "source": "The function can be evaluated for several orders at the same time by\nproviding a list or NumPy array for `v`:\n",
            "metadata": {}
        },
        {
            "id": "5aab3286",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "jve([1, 3, 5], 1j)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([1.27304208e-17+2.07910415e-01j, -4.99352086e-19-8.15530777e-03j,\n       6.11480940e-21+9.98657141e-05j])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "75e655bc",
            "cell_type": "markdown",
            "source": "In the same way, the function can be evaluated at several points in one\ncall by providing a list or NumPy array for `z`:\n",
            "metadata": {}
        },
        {
            "id": "9688dbb0",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "jve(1, np.array([1j, 2j, 3j]))",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([1.27308412e-17+0.20791042j, 1.31814423e-17+0.21526929j,\n       1.20521602e-17+0.19682671j])"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "d0481e2d",
            "cell_type": "markdown",
            "source": "It is also possible to evaluate several orders at several points\nat the same time by providing arrays for `v` and `z` with\ncompatible shapes for broadcasting. Compute `jve` for two different orders\n`v` and three points `z` resulting in a 2x3 array.\n",
            "metadata": {}
        },
        {
            "id": "a58dadb9",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "v = np.array([[1], [3]])\nz = np.array([1j, 2j, 3j])\nv.shape, z.shape",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "((2, 1), (3,))"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "55375fdd",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "jve(v, z)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([[1.27304208e-17+0.20791042j,  1.31810070e-17+0.21526929j,\n        1.20517622e-17+0.19682671j],\n       [-4.99352086e-19-0.00815531j, -1.76289571e-18-0.02879122j,\n        -2.92578784e-18-0.04778332j]])"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}