美文网首页
Computes the integral with Gauss

Computes the integral with Gauss

作者: ahtia | 来源:发表于2019-04-28 16:17 被阅读0次

下面的代码段是关于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)):

相关文章

网友评论

      本文标题:Computes the integral with Gauss

      本文链接:https://www.haomeiwen.com/subject/raqjnqtx.html