{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The algorithm uses a similar algorithm to "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "quad_vec",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.integrate._quad_vec:quad_vec"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which itself is based on the implementation of QUADPACK's DQAG* algorithms, implementing global error control and adaptive subdivision."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The source of the nodes and weights used for Gauss-Kronrod quadrature can be found in "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and the algorithm for calculating the nodes and weights in Genz-Malik cubature can be found in "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The rules currently supported via the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "rule"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " argument are:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"gauss-kronrod\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", 21-node Gauss-Kronrod"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"genz-malik\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", n-node Genz-Malik"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If using Gauss-Kronrod for an "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "-dim integrand where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n > 2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", then the corresponding Cartesian product rule will be found by taking the Cartesian product of the nodes in the 1D case. This means that the number of nodes scales exponentially as "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "21^n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " in the Gauss-Kronrod case, which may be problematic in a moderate number of dimensions."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Genz-Malik is typically less accurate than Gauss-Kronrod but has much fewer nodes, so in this situation using \"genz-malik\" might be preferable."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Infinite limits are handled with an appropriate variable transformation. Assuming "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "a = [a_1, ..., a_n]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b = [b_1, ..., b_n]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "a_i = -\\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "b_i = \\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the i-th integration variable will use the transformation "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x = \\frac{1-|t|}{t}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "t \\in (-1, 1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "a_i \\ne \\pm\\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "b_i = \\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the i-th integration variable will use the transformation "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x = a_i + \\frac{1-t}{t}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "t \\in (0, 1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "a_i = -\\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "b_i \\ne \\pm\\infty"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the i-th integration variable will use the transformation "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x = b_i - \\frac{1-t}{t}"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "t \\in (0, 1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__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": "cubature",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.integrate._cubature:cubature"
              },
              "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             ⚠️ no JIT           \nDask                  ⚠️ computes graph     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": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "res",
              "annotation": "object",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Object containing the results of the estimation. It has the following attributes:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "estimate"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "estimate"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "error"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "error"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "status"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "status"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "subdivisions"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "subdivisions"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "atol,rtol"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "atol, rtol"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "regions: list of object"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "List of objects containing the estimates of the integral over smaller     regions of the domain."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Each object in "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "regions"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " has the following attributes:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "a,b"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "a, b"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "estimate"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "estimate"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "error"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "error"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Adaptive cubature of multidimensional array-valued function."
            }
          ]
        }
      ],
      "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": "f",
              "annotation": "callable",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Function to integrate. "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " must have the signature      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "f(x : ndarray, *args) -> ndarray",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " should accept arrays "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " of shape      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "(npoints, ndim)",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "and output arrays of shape      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "(npoints, output_dim_1, ..., output_dim_n)",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "In this case, "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "cubature",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.integrate._cubature:cubature"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will return arrays of shape      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "(output_dim_1, ..., output_dim_n)",
                  "execution_status": null
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "a, b",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Lower and upper limits of integration as 1D arrays specifying the left and right endpoints of the intervals being integrated over. Limits can be infinite."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rule",
              "annotation": "str, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Rule used to estimate the integral. If passing a string, the options are \"gauss-kronrod\" (21 node), or \"genz-malik\" (degree 7). If a rule like \"gauss-kronrod\" is specified for an "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-dim integrand, the corresponding Cartesian product rule is used. \"gk21\", \"gk15\" are also supported for compatibility with "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "quad_vec",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.integrate._quad_vec:quad_vec"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". See Notes."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rtol, atol",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Relative and absolute tolerances. Iterations are performed until the error is estimated to be less than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "atol + rtol * abs(est)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Here "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rtol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " controls relative accuracy (number of correct digits), while "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " controls absolute accuracy (number of correct decimal places). To achieve the desired "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rtol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", set "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to be smaller than the smallest value that can be expected from "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rtol * abs(y)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " so that "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rtol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " dominates the allowable error. If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is larger than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rtol * abs(y)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the number of correct digits is not guaranteed. Conversely, to achieve the desired "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", set "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rtol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " such that "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rtol * abs(y)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is always smaller than "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Default values are 1e-8 for "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rtol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and 0 for "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "max_subdivisions",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Upper bound on the number of subdivisions to perform. Default is 10,000."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "args",
              "annotation": "tuple, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Additional positional args passed to "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", if any."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "workers",
              "annotation": "int or map-like callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an integer, part of the computation is done in parallel subdivided to this many tasks (using "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "python:multiprocessing.pool.Pool",
                      "domain": null,
                      "role": "class",
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "). Supply "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "-1",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to use all cores available to the Process. Alternatively, supply a map-like callable, such as "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "python:multiprocessing.pool.Pool.map",
                      "domain": null,
                      "role": "meth",
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for evaluating the population in parallel. This evaluation is carried out as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers(func, iterable)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "points",
              "annotation": "list of array_like, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "List of points to avoid evaluating "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " at, under the condition that the rule being used does not evaluate "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " on the boundary of a region (which is the case for all Genz-Malik and Gauss-Kronrod rules). This can be useful if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " has a singularity at the specified point. This should be a list of array-likes where each element has length "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "ndim"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Default is empty. See Examples."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Given an arbitrary integration rule, this function returns an estimate of the integral to the requested tolerance over the region defined by the arrays "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "a"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "b"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " specifying the corners of a hypercube."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Convergence is not guaranteed for all integrals."
            }
          ]
        }
      ],
      "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/integrate/_cubature.py",
  "item_line": 60,
  "item_type": "function",
  "aliases": [
    "scipy.integrate.cubature"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "**1D integral with vector output**:\n\n.. math::\n\n    \\int^1_0 \\mathbf f(x) \\text dx\n\nWhere ``f(x) = x^n`` and ``n = np.arange(10)`` is a vector. Since no rule is\nspecified, the default \"gk21\" is used, which corresponds to Gauss-Kronrod\nintegration with 21 nodes.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.integrate import cubature\ndef f(x, n):\n   # Make sure x and n are broadcastable\n   return x[:, np.newaxis]**n[np.newaxis, :]\nres = cubature(\n    f,\n    a=[0],\n    b=[1],\n    args=(np.arange(10),),\n)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.estimate\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n**7D integral with arbitrary-shaped array output**::\n\n    f(x) = cos(2*pi*r + alphas @ x)\n\nfor some ``r`` and ``alphas``, and the integral is performed over the unit\nhybercube, :math:`[0, 1]^7`. Since the integral is in a moderate number of\ndimensions, \"genz-malik\" is used rather than the default \"gauss-kronrod\" to\navoid constructing a product rule with :math:`21^7 \\approx 2 \\times 10^9` nodes.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.integrate import cubature\ndef f(x, r, alphas):\n    # f(x) = cos(2*pi*r + alphas @ x)\n    # Need to allow r and alphas to be arbitrary shape\n    npoints, ndim = x.shape[0], x.shape[-1]\n    alphas = alphas[np.newaxis, ...]\n    x = x.reshape(npoints, *([1]*(len(alphas.shape) - 1)), ndim)\n    return np.cos(2*np.pi*r + np.sum(alphas * x, axis=-1))\nrng = np.random.default_rng()\nr, alphas = rng.random((2, 3)), rng.random((2, 3, 7))\nres = cubature(\n    f=f,\n    a=np.array([0, 0, 0, 0, 0, 0, 0]),\n    b=np.array([1, 1, 1, 1, 1, 1, 1]),\n    rtol=1e-5,\n    rule=\"genz-malik\",\n    args=(r, alphas),\n)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.estimate\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n**Parallel computation with** `workers`:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from concurrent.futures import ThreadPoolExecutor\nwith ThreadPoolExecutor() as executor:\n    res = cubature(\n        f=f,\n        a=np.array([0, 0, 0, 0, 0, 0, 0]),\n        b=np.array([1, 1, 1, 1, 1, 1, 1]),\n        rtol=1e-5,\n        rule=\"genz-malik\",\n        args=(r, alphas),\n        workers=executor.map,\n     )\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.estimate\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n**2D integral with infinite limits**:\n\n.. math::\n\n    \\int^{ \\infty }_{ -\\infty }\n    \\int^{ \\infty }_{ -\\infty }\n        e^{-x^2-y^2}\n    \\text dy\n    \\text dx\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def gaussian(x):\n    return np.exp(-np.sum(x**2, axis=-1))\nres = cubature(gaussian, [-np.inf, -np.inf], [np.inf, np.inf])\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.estimate\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n**1D integral with singularities avoided using** `points`:\n\n.. math::\n\n    \\int^{ 1 }_{ -1 }\n      \\frac{\\sin(x)}{x}\n    \\text dx\n\nIt is necessary to use the `points` parameter to avoid evaluating `f` at the origin.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def sinc(x):\n    return np.sin(x)/x\nres = cubature(sinc, [-1], [1], points=[[0]])\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.estimate\n",
        "execution_status": "failure"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "f",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "a",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "b",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rule",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "gk21"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rtol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "1e-08"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "atol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "max_subdivisions",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "10000"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "args",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "()"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "workers",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "points",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "cubature"
  },
  "references": [
    ".. [1] R. Piessens, E. de Doncker, Quadpack: A Subroutine Package for Automatic",
    "    Integration, files: dqk21.f, dqk15.f (1983).",
    "",
    ".. [2] A.C. Genz, A.A. Malik, Remarks on algorithm 006: An adaptive algorithm for",
    "    numerical integration over an N-dimensional rectangular region, Journal of",
    "    Computational and Applied Mathematics, Volume 6, Issue 4, 1980, Pages 295-302,",
    "    ISSN 0377-0427",
    "    :doi:`10.1016/0771-050X(80)90039-X`"
  ],
  "qa": "scipy.integrate._cubature:cubature",
  "arbitrary": [],
  "local_refs": [
    "a",
    "args",
    "atol",
    "b",
    "f",
    "max_subdivisions",
    "points",
    "res",
    "rtol",
    "rule",
    "workers"
  ]
}