{ } Raw JSON

bundles / scipy 1.17.1 / scipy / integrate / _rules / _base / ProductNestedFixed

class

scipy.integrate._rules._base:ProductNestedFixed

source: /scipy/integrate/_rules/_base.py :352

Signature

class   ProductNestedFixed ( base_rules )

Members

Summary

Find the n-dimensional cubature rule constructed from the Cartesian product of 1-D NestedFixedRule quadrature rules.

Extended Summary

Given a list of N 1-dimensional quadrature rules which support error estimation using NestedFixedRule, this will find the N-dimensional cubature rule obtained by taking the Cartesian product of their nodes, and estimating the error by taking the difference with a lower-accuracy N-dimensional cubature rule obtained using the .lower_nodes_and_weights rule in each of the base 1-dimensional rules.

Parameters

base_rules : list of NestedFixedRule

List of base 1-dimensional NestedFixedRule quadrature rules.

Attributes

base_rules : list of NestedFixedRule

List of base 1-dimensional NestedFixedRule qudarature rules.

Examples

Evaluate a 2D integral by taking the product of two 1D rules:
import numpy as np
from scipy.integrate import cubature
from scipy.integrate._rules import (
 ProductNestedFixed, GaussKronrodQuadrature
)
def f(x):
    # f(x) = cos(x_1) + cos(x_2)
    return np.sum(np.cos(x), axis=-1)
rule = ProductNestedFixed(
    [GaussKronrodQuadrature(15), GaussKronrodQuadrature(15)]
) # Use 15-point Gauss-Kronrod, which implements NestedFixedRule
a, b = np.array([0, 0]), np.array([1, 1])
rule.estimate(f, a, b) # True value 2*sin(1), approximately 1.6829
rule.estimate_error(f, a, b)

Aliases

  • scipy.integrate._cubature.ProductNestedFixed