{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Parameters "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "bc_type"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "extrapolate"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " work independently, i.e. the former controls only construction of a spline, and the latter only evaluation."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "When a boundary condition is 'not-a-knot' and n = 2, it is replaced by a condition that the first derivative is equal to the linear interpolant slope. When both boundary conditions are 'not-a-knot' and n = 3, the solution is sought as a parabola passing through given points."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "When 'not-a-knot' boundary conditions is applied to both ends, the resulting spline will be the same as returned by "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "splrep",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "s=0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") and "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "InterpolatedUnivariateSpline",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.interpolate._fitpack2:InterpolatedUnivariateSpline"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but these two methods use a representation in B-spline basis."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.18.0"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Array API Standard Support"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "CubicSpline",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.interpolate._cubic:CubicSpline"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ⛔                   \nPyTorch               ✅                     ⛔                   \nJAX                   ⚠️ no JIT             ⛔                   \nDask                  ⛔                     n/a                 \n====================  ====================  ====================",
          "execution_status": null
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for more information."
                }
              ]
            }
          ]
        }
      ],
      "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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "__call__",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "derivative",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "antiderivative",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "integrate",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "solve",
              "annotation": "",
              "desc": []
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "roots",
              "annotation": "",
              "desc": []
            }
          ]
        }
      ],
      "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": "Piecewise cubic interpolator to fit values (C2 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": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "x",
              "annotation": "ndarray, shape (n,)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Breakpoints. The same "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " which was passed to the constructor."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "c",
              "annotation": "ndarray, shape (4, n-1, ...)",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Coefficients of the polynomials on each segment. The trailing dimensions match the dimensions of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", excluding "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". For example, if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is 1-d, then "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "c[k, i]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a coefficient for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(x-x[i])**(3-k)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " on the segment between "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x[i]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x[i+1]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Interpolation axis. The same axis which was passed to the constructor."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "x",
              "annotation": "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 must be real, finite and in strictly increasing order."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "y",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Array containing values of the dependent variable. It can have arbitrary number of dimensions, but the length along "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (see below) must match the length of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Values must be finite."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis along which "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is assumed to be varying. Meaning that for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x[i]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the corresponding values are "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "np.take(y, i, axis=axis)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Default is 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "bc_type",
              "annotation": "string or 2-tuple, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Boundary condition type. Two additional equations, given by the boundary conditions, are required to determine all coefficients of polynomials on each segment "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "bc_type"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a string, then the specified condition will be applied at both ends of a spline. Available conditions are:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'not-a-knot' (default): The first and second segment at a curve end   are the same polynomial. It is a good default when there is no   information on boundary conditions."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'periodic': The interpolated functions is assumed to be periodic   of period "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "x[-1] - x[0]"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ". The first and last value of "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " must be   identical: "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "y[0] == y[-1]"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ". This boundary condition will result in   "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "y'[0] == y'[-1]"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " and "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "y''[0] == y''[-1]"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'clamped': The first derivative at curves ends are zero. Assuming   a 1D "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "bc_type=((1, 0.0), (1, 0.0))"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is the same condition."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'natural': The second derivative at curve ends are zero. Assuming   a 1D "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "bc_type=((2, 0.0), (2, 0.0))"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is the same condition."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "bc_type"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a 2-tuple, the first and the second value will be applied at the curve start and end respectively. The tuple values can be one of the previously mentioned strings (except 'periodic') or a tuple "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(order, deriv_values)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " allowing to specify arbitrary derivatives at curve ends:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "order",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": the derivative order, 1 or 2."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "deriv_value",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": array_like containing derivative values, shape must   be the same as "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", excluding "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "axis"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " dimension. For example, if   "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is 1-D, then "
                            },
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "deriv_value",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " must be a scalar. If "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "y"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is 3-D with   the shape (n0, n1, n2) and axis=2, then "
                            },
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "deriv_value",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " must be 2-D   and have the shape (n0, n1)."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "extrapolate",
              "annotation": "{bool, 'periodic', None}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If bool, determines whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs. If 'periodic', periodic extrapolation is used. If None (default), "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "extrapolate"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is set to 'periodic' for "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "bc_type='periodic'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and to True otherwise."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Interpolate data with a piecewise cubic polynomial which is twice continuously differentiable "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The result is represented as a "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "PPoly",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.interpolate._interpolate:PPoly"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " instance with breakpoints matching the given data."
            }
          ]
        }
      ],
      "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/_cubic.py",
  "item_line": 616,
  "item_type": "class",
  "aliases": [
    "scipy.interpolate.CubicSpline"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "In this example the cubic spline is used to interpolate a sampled sinusoid.\nYou can see that the spline continuity property holds for the first and\nsecond derivatives and violates only for the third derivative.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.interpolate import CubicSpline\nimport matplotlib.pyplot as plt\nx = np.arange(10)\ny = np.sin(x)\ncs = CubicSpline(x, y)\nxs = np.arange(-0.5, 9.6, 0.1)\nfig, ax = plt.subplots(figsize=(6.5, 4))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot(x, y, 'o', label='data')\nax.plot(xs, np.sin(xs), label='true')\nax.plot(xs, cs(xs), label=\"S\")\nax.plot(xs, cs(xs, 1), label=\"S'\")\nax.plot(xs, cs(xs, 2), label=\"S''\")\nax.plot(xs, cs(xs, 3), label=\"S'''\")\nax.set_xlim(-0.5, 9.5)\nax.legend(loc='lower left', ncol=2)\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-c21a8f72227f08c8.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nIn the second example, the unit circle is interpolated with a spline. A\nperiodic boundary condition is used. You can see that the first derivative\nvalues, ds/dx=0, ds/dy=1 at the periodic point (1, 0) are correctly\ncomputed. Note that a circle cannot be exactly represented by a cubic\nspline. To increase precision, more breakpoints would be required.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "theta = 2 * np.pi * np.linspace(0, 1, 5)\ny = np.c_[np.cos(theta), np.sin(theta)]\ncs = CubicSpline(theta, y, bc_type='periodic')\nprint(\"ds/dx={:.1f} ds/dy={:.1f}\".format(cs(0, 1)[0], cs(0, 1)[1]))\nxs = 2 * np.pi * np.linspace(0, 1, 100)\nfig, ax = plt.subplots(figsize=(6.5, 4))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.plot(y[:, 0], y[:, 1], 'o', label='data')\nax.plot(np.cos(xs), np.sin(xs), label='true')\nax.plot(cs(xs)[:, 0], cs(xs)[:, 1], label='spline')\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.axes.set_aspect('equal')\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.legend(loc='center')\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-c0e00826152c43f6.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe third example is the interpolation of a polynomial y = x**3 on the\ninterval 0 <= x<= 1. A cubic spline can represent this function exactly.\nTo achieve that we need to specify values and first derivatives at\nendpoints of the interval. Note that y' = 3 * x**2 and thus y'(0) = 0 and\ny'(1) = 3.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "cs = CubicSpline([0, 1], [0, 1], bc_type=((1, 0), (1, 3)))\nx = np.linspace(0, 1)\nnp.allclose(x**3, cs(x))\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "Akima1DInterpolator",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._cubic:Akima1DInterpolator"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Akima 1D interpolator."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "PPoly",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._interpolate:PPoly"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Piecewise polynomial in terms of coefficients and breakpoints."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "PchipInterpolator",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.interpolate._cubic:PchipInterpolator"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "PCHIP 1-D monotonic cubic interpolator."
            }
          ]
        }
      ],
      "type": "func"
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "y",
        "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"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "bc_type",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "not-a-knot"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "extrapolate",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "CubicSpline"
  },
  "references": [
    ".. [1] `Cubic Spline Interpolation",
    "        <https://en.wikiversity.org/wiki/Cubic_Spline_Interpolation>`_",
    "        on Wikiversity.",
    ".. [2] Carl de Boor, \"A Practical Guide to Splines\", Springer-Verlag, 1978."
  ],
  "qa": "scipy.interpolate._cubic:CubicSpline",
  "arbitrary": [],
  "local_refs": [
    "__call__",
    "antiderivative",
    "axis",
    "bc_type",
    "c",
    "derivative",
    "extrapolate",
    "integrate",
    "roots",
    "solve",
    "x",
    "y"
  ]
}