Computes the integral with Gauss

2019-04-28  本文已影响0人  ahtia

下面的代码段是关于Computes the integral with Gauss-Legendre quadrature using m nodes in Python的代码。

## module gaussQuad

''' I = gaussQuad(f,a,b,m).

    Computes the integral of f(x) from x = a to b

    with Gauss-Legendre quadrature using m nodes.

'''

def gaussQuad(f,a,b,m):

    c1 = (b + a)/2.0

    c2 = (b - a)/2.0

    x,A = gaussNodes(m)

    sum = 0.0

    for i in range(len(x)):

上一篇 下一篇

猜你喜欢

热点阅读