Ask Your Question
1

gauss-Legendre quadrature

asked 6 years ago

Sha gravatar image

Hi, is there any command i can use (or link I can refer to) on calculating the Gauss-Legendre error term? For example in PARI, we have these "intnumgaussinit({n})" as well as "intnumgauss(X = a, b, expr, {tab})". thank you.

Preview: (hide)

Comments

Did you look at the doc: numerical_integral?

FrédéricC gravatar imageFrédéricC ( 6 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 6 years ago

slelievre gravatar image

updated 6 years ago

Edited to take into account suggestions and observations by @FrédéricC and @nbruin.

Sage's numerical_integral function uses a heuristic to guess an error bound, provide no certified error bound.

The good way to go is to use Arb, which is easy from Sage.

Example (from http://fredrikj.net/math/scan2018.pdf):

sage: C = ComplexBallField(100)
sage:  C.integral(lambda x, _: cos(x) * sin(x), 0, 1)
[0.35403670913678559674939205737 +/- 8.68e-30]

Side observation: the file gauss_legendre.pyx in src/sage/numerical/ strangely does not result in a gauss_legendre entry in the reference manual under sage/numerical.

Preview: (hide)
link

Comments

That implementation doesn't do anything to compute a guaranteed error term. It does extrapolate one heuristically, and uses that as termination condition. It would be worth looking at "arb" for certified numerical integration (with Gauss-Legendre available).

nbruin gravatar imagenbruin ( 6 years ago )

See Sage Trac ticket 30698 for better documenting Gauss-Legendre integration in the Sage documentation.

slelievre gravatar imageslelievre ( 4 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 6 years ago

Seen: 929 times

Last updated: Dec 04 '18