无限区间 (1)梯形法则,(2)辛普森法则,(3)龙伯格积分法或(4)高斯积分法,有一些适用的指导原则。
通常,更高阶的方法对于平滑函数更好。 如果不是,那么使用更简单的方法会更好,因为数据的变化不会反映在采样点上。 梯形法则适用于在均匀间隔的采样点处积分来自实验的数据。 这对于表现不佳的函数是有好处的。 辛普森的规则依赖于被积函数的更高阶的近似,以便准确。 而高斯积分是非常准确的,如果你需要均匀间隔的采样点,它不是令人满意的。
高斯积分
######################################################################
#
# Functions to calculate integration points and weights for Gaussian
# quadrature
#
# x,w = gaussxw(N) returns integration points x and integration
# weights w such that sum_i w[i]*f(x[i]) is the Nth-order
# Gaussian approximation to the integral int_{-1}^1 f(x) dx
# x,w = gaussxwab(N,a,b) returns integration points and weights
# mapped to the interval [a,b], so that sum_i w[i]*f(x[i])
# is the Nth-order Gaussian approximation to the integral
# int_a^b f(x) dx
#
# This code finds the zeros of the nth Legendre polynomial using
# Newton's method, starting from the approximation given in Abramowitz
# and Stegun 22.16.6. The Legendre polynomial itself is evaluated
# using the recurrence relation given in Abramowitz and Stegun
# 22.7.10. The function has been checked against other sources for
# values of N up to 1000. It is compatible with version 2 and version
# 3 of Python.
#
# Written by Mark Newman <mejn@umich.edu>, June 4, 2011
# You may use, share, or modify thi

本文介绍了高斯积分法在数值计算中的优势,并提供了MATLAB中的计算实例,强调了高斯求积在处理平滑函数时的高精度。讨论了如何通过映射积分点和利用勒让德多项式来实现高斯积分,同时对比了与其他积分方法如梯形法和辛普森法则的适用场景。

2285

被折叠的 条评论
为什么被折叠?



