{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "be873b3d",
            "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": "5c93f586",
            "cell_type": "markdown",
            "source": "Basic homogeneity property:\n",
            "metadata": {}
        },
        {
            "id": "74d1703b",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.special import elliprc",
            "outputs": []
        },
        {
            "id": "7b96d848",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "x = 1.2 + 3.4j\ny = 5.\nscale = 0.3 + 0.4j\nelliprc(scale*x, scale*y)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.5484493976710874-0.4169557678995833j)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "fcdb1279",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "elliprc(x, y)/np.sqrt(scale)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.5484493976710874-0.41695576789958333j)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "02045856",
            "cell_type": "markdown",
            "source": "When the two arguments coincide, the integral is particularly\nsimple:\n",
            "metadata": {}
        },
        {
            "id": "661a1f78",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "x = 1.2 + 3.4j\nelliprc(x, x)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.4299173120614631-0.3041729818745595j)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "cccb5863",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "1/np.sqrt(x)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.4299173120614631-0.30417298187455954j)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "c8e83dd2",
            "cell_type": "markdown",
            "source": "Another simple case: the first argument vanishes:\n",
            "metadata": {}
        },
        {
            "id": "0d3bb200",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "y = 1.2 + 3.4j\nelliprc(0, y)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.6753125346116815-0.47779380263880866j)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "a582aa9b",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "np.pi/2/np.sqrt(y)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "(0.6753125346116815-0.4777938026388088j)"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "09dc3791",
            "cell_type": "markdown",
            "source": "When `x` and `y` are both positive, we can express\n$R_C(x,y)$ in terms of more elementary functions.  For the\ncase $0 \\le x < y$,\n",
            "metadata": {}
        },
        {
            "id": "dbaed04d",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "x = 3.2\ny = 6.\nelliprc(x, y)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "0.44942991498453444"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "f7496d98",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "np.arctan(np.sqrt((y-x)/x))/np.sqrt(y-x)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "0.44942991498453433"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "0174bd91",
            "cell_type": "markdown",
            "source": "And for the case $0 \\le y < x$,\n",
            "metadata": {}
        },
        {
            "id": "152cf486",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "x = 6.\ny = 3.2\nelliprc(x,y)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "0.4989837501576147"
                    },
                    "execution_count": null
                }
            ]
        },
        {
            "id": "31da7b21",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "np.log((np.sqrt(x)+np.sqrt(x-y))/np.sqrt(y))/np.sqrt(x-y)",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "0.49898375015761476"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}