{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The degree of the B-spline, "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "k",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", is inferred from the length of "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "t",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "t"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "len(t)-2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The knot vector is constructed by appending and prepending "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "k+1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " elements to internal knots "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "t",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "t"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "basis_element",
              "annotation": "callable",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A callable representing a B-spline basis element for the knot vector "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "t",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "t"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Return a B-spline basis element "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "B(x | t[0], ..., t[k+1])"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "t",
              "annotation": "ndarray, shape (k+2,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "internal knots"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extrapolate",
              "annotation": "bool or 'periodic', optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "whether to extrapolate beyond the base interval, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "t[0] .. t[k+1]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", or to return nans. If 'periodic', periodic extrapolation is used. Default is True."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/interpolate/_bsplines.py",
  "item_line": 307,
  "item_type": "classmethod",
  "aliases": [
    "scipy.interpolate.BSpline.basis_element"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Construct a cubic B-spline:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.interpolate import BSpline\nb = BSpline.basis_element([0, 1, 2, 3, 4])\nk = b.k\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "b.t[k:-k]\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "k\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nConstruct a quadratic B-spline on ``[0, 1, 1, 2]``, and compare\nto its explicit form:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "t = [0, 1, 1, 2]\nb = BSpline.basis_element(t)\ndef f(x):\n    return np.where(x < 1, x*x, (2. - x)**2)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import matplotlib.pyplot as plt\nfig, ax = plt.subplots()\nx = np.linspace(0, 2, 51)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot(x, b(x), 'g', lw=3)\nax.plot(x, f(x), 'r', lw=8, alpha=0.4)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.grid(True)\nplt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-40f4ecbf12486788.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "scipy.interpolate._bsplines:BSpline.basis_element",
  "arbitrary": [],
  "local_refs": [
    "basis_element",
    "extrapolate",
    "t"
  ]
}