{
    "nbformat": 4,
    "nbformat_minor": 5,
    "metadata": {
        "kernelspec": {
            "display_name": "Python",
            "language": "python",
            "name": "python"
        },
        "language_info": {
            "name": "python"
        }
    },
    "cells": [
        {
            "id": "0e23d1f6",
            "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": "3cdb09ac",
            "cell_type": "markdown",
            "source": "Solve the banded system a x = b, where\n```\n\n[5  2 -1  0  0]       [0]\n[1  4  2 -1  0]       [1]\na = [0  1  3  2 -1]   b = [2]\n[0  0  1  2  2]       [2]\n[0  0  0  1  1]       [3]\n\n```\nThere is one nonzero diagonal below the main diagonal (l = 1), and\ntwo above (u = 2). The diagonal banded form of the matrix is\n```\n\n[*  * -1 -1 -1]\nab = [*  2  2  2  2]\n[5  4  3  2  1]\n[1  1  1  1  *]\n\n```",
            "metadata": {}
        },
        {
            "id": "af1809e6",
            "cell_type": "code",
            "metadata": {},
            "execution_count": null,
            "source": "import numpy as np\nfrom scipy.linalg import solve_banded\nab = np.array([[0,  0, -1, -1, -1],\n               [0,  2,  2,  2,  2],\n               [5,  4,  3,  2,  1],\n               [1,  1,  1,  1,  0]])\nb = np.array([0, 1, 2, 2, 3])\nx = solve_banded((1, 2), ab, b)\nx",
            "outputs": [
                {
                    "output_type": "execute_result",
                    "metadata": {},
                    "data": {
                        "text/plain": "array([-2.37288136,  3.93220339, -4.        ,  4.3559322 , -1.3559322 ])"
                    },
                    "execution_count": null
                }
            ]
        }
    ]
}