{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Be aware that the algorithms implemented here are not necessarily the most numerically stable known. Moreover, even in a world of exact computation, unless the x coordinates are chosen very carefully - Chebyshev zeros (e.g., cos(i*pi/n)) are a good choice - polynomial interpolation itself is a very ill-conditioned process due to the Runge phenomenon. In general, even with well-chosen x values, degrees higher than about thirty cause problems with numerical instability in this code."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Based on "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__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": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Krogh interpolator (C∞ smooth)."
            }
          ]
        }
      ],
      "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": "xi",
              "annotation": "array_like, shape (npoints, )",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Known x-coordinates. Must be sorted in increasing order."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "yi",
              "annotation": "array_like, shape (..., npoints, ...)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Known y-coordinates. When an xi occurs two or more times in a row, the corresponding yi's represent derivative values. The length of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "yi"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " along the interpolation axis must be equal to the length of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "xi"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Use the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " parameter to select the correct axis."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis in the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "yi"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array corresponding to the x-coordinate values. Defaults to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "axis=0"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The polynomial passes through all the pairs "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "(xi, yi)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". One may additionally specify a number of derivatives at each point "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "xi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; this is done by repeating the value "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "xi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and specifying the derivatives as successive "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "yi"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " values."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Allows evaluation of the polynomial and all its derivatives. For reasons of numerical stability, this function does not compute the coefficients of the polynomial, although they can be obtained by evaluating all the derivatives."
            }
          ]
        }
      ],
      "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/_polyint.py",
  "item_line": 249,
  "item_type": "class",
  "aliases": [
    "scipy.interpolate.KroghInterpolator"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "To produce a polynomial that is zero at 0 and 1 and has\nderivative 2 at 0, call\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.interpolate import KroghInterpolator\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "KroghInterpolator([0,0,1],[0,2,0])\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThis constructs the quadratic :math:`2x^2-2x`. The derivative condition\nis indicated by the repeated zero in the `xi` array; the corresponding\nyi values are 0, the function value, and 2, the derivative value.\n\nFor another example, given `xi`, `yi`, and a derivative `ypi` for each\npoint, appropriate arrays can be constructed as:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nrng = np.random.default_rng()\nxi = np.linspace(0, 1, 5)\nyi, ypi = rng.random((2, 5))\nxi_k, yi_k = np.repeat(xi, 2), np.ravel(np.dstack((yi,ypi)))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "KroghInterpolator(xi_k, yi_k)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nTo produce a vector-valued polynomial, supply a higher-dimensional\narray for `yi`:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "KroghInterpolator([0,1],[[2,3],[4,5]])\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThis constructs a linear polynomial giving (2,3) at 0 and (4,5) at 1."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "xi",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "yi",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "KroghInterpolator"
  },
  "references": [
    ".. [1] Krogh, \"Efficient Algorithms for Polynomial Interpolation",
    "    and Numerical Differentiation\", 1970."
  ],
  "qa": "scipy.interpolate._polyint:KroghInterpolator",
  "arbitrary": [],
  "local_refs": [
    "axis",
    "xi",
    "yi"
  ]
}