示例#1
0
def test_gq_integrate_legendre():
    from quadrature import GQIntegrate

    gqi = GQIntegrate()

    func = lambda x: 2*x*x
    intf = lambda x: 2/3*x**3
    x1, x2 = numpy.random.rand(2)

    ref = intf(x2) - intf(x1)
    aa_equal(ref, gqi.gq_integrate(x1, x2, func, qtype='legendre'), 15)