{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Floater-Hormann interpolant is a rational function that interpolates the data with approximation order "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "O(h^{d+1})"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The rational function blends "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n - d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " polynomials of degree "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " together to produce a rational interpolant that contains no poles on the real axis, unlike "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "AAA",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.interpolate._bary_rational:AAA"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The interpolant is given by"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "r(x) = \\frac{\\sum_{i=0}^{n-d} \\lambda_i(x) p_i(x)}\n{\\sum_{i=0}^{n-d} \\lambda_i(x)},"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "p_i(x)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is an interpolating polynomial of at most degree "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " through the points "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "(x_i,y_i),\\dots,(x_{i+d},y_{i+d})"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "\\lambda_i(z)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are blending functions defined by"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "\\lambda_i(x) = \\frac{(-1)^i}{(x - x_i)\\cdots(x - x_{i+d})}."
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "When "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d = n - 1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " this reduces to polynomial interpolation."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Due to its stability, the following barycentric representation of the above equation is used for computation"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "r(z) = \\frac{\\sum_{k=1}^m\\ w_k f_k / (x - x_k)}{\\sum_{k=1}^m w_k / (x - x_k)},"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where the weights "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "w_j"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are computed as"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "w_k &= (-1)^{k - d} \\sum_{i \\in J_k} \\prod_{j = i, j \\neq k}^{i + d}\n1/|x_k - x_j|, \\\\\nJ_k &= \\{ i \\in I: k - d \\leq i \\leq k\\},\\\\\nI &= \\{0, 1, \\dots, n - d\\}."
        }
      ],
      "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": "Floater-Hormann barycentric rational interpolator (C∞ smooth on real axis)."
            }
          ]
        }
      ],
      "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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "weights",
              "annotation": "array",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Weights of the barycentric approximation."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "x",
              "annotation": "1D array_like, shape (n,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "1-D array containing values of the independent variable. Values may be real or complex but must be finite."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "y",
              "annotation": "array_like, shape (n, ...)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Array containing values of the dependent variable. Infinite and NaN values of "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "y",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "y"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and corresponding values of "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "x",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "x"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be discarded."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "d",
              "annotation": "int, default: 3",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Integer satisfying "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "0 <= d < n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Floater-Hormann interpolation blends "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n - d"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " polynomials of degree "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "d"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " together; for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "d = n - 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", this is equivalent to polynomial interpolation."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int, default: 0",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis of "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "y",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "y"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " corresponding to "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "x",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "x"
                      },
                      "kind": "local"
                    },
                    {
                      "__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": "As described in "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the method of Floater and Hormann computes weights for a barycentric rational interpolant with no poles on the real axis."
            }
          ]
        }
      ],
      "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/_bary_rational.py",
  "item_line": 630,
  "item_type": "class",
  "aliases": [
    "scipy.interpolate.FloaterHormannInterpolator"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Here we compare the method against polynomial interpolation for an example where\nthe polynomial interpolation fails due to Runge's phenomenon.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.interpolate import (FloaterHormannInterpolator,\n                               BarycentricInterpolator)\ndef f(x):\n    return 1/(1 + x**2)\nx = np.linspace(-5, 5, num=15)\nr = FloaterHormannInterpolator(x, f(x))\np = BarycentricInterpolator(x, f(x))\nxx = np.linspace(-5, 5, num=1000)\nimport matplotlib.pyplot as plt\nfig, ax = plt.subplots()\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot(xx, f(xx), label=\"f(x)\")\nax.plot(xx, r(xx), \"--\", label=\"Floater-Hormann\")\nax.plot(xx, p(xx), \"--\", label=\"Polynomial\")\nax.legend()\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success"
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.17.1",
          "kind": "assets",
          "path": "fig-9ffea95db334010d.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "AAA",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._bary_rational:AAA"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Barycentric rational approximation of real and complex functions."
            }
          ]
        }
      ],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "pade",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._pade:pade"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Padé approximation."
            }
          ]
        }
      ],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "points",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "values",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "d",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "3"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "0"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "FloaterHormannInterpolator"
  },
  "references": [
    ".. [1] M.S. Floater and K. Hormann, \"Barycentric rational interpolation with no",
    "       poles and high rates of approximation\", Numer. Math. 107, 315 (2007).",
    "       :doi:`10.1007/s00211-007-0093-y`"
  ],
  "qa": "scipy.interpolate._bary_rational:FloaterHormannInterpolator",
  "arbitrary": [],
  "local_refs": [
    "axis",
    "d",
    "weights",
    "x",
    "y"
  ]
}