Skip to content
DeepForgeby svx
All problems
HardCalculusca-349

Adaptive Quadrature Decision

Problem

Compare Simpson estimates on the whole interval and on its two halves: S1 with two subintervals and S2 with four. If |S2 - S1| < 15 * tol, the corrected estimate is S2 + (S2 - S1) / 15; otherwise return None.

Given polynomial coefficients, a, b, and tol, return the corrected estimate or None.

Hint

Richardson correction; strict inequality on the error test.

Test cases

case 1
in: [[0,0,1],0,1,0.001]
expected: 0.3333333333333333
case 2
in: [[0,0,1],0,1,1e-12]
expected: 0.3333333333333333
case 3
in: [[1,1],0,2,0.000001]
expected: 4
Starter codePython
def adaptive_quadrature_decision(coeffs, a, b, tol):
    # Your code here
    pass

3 test cases · run your code against them in the editor