Ask Your Question
1

gauss-Legendre quadrature

asked 2018-12-03 07:13:25 +0200

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.

edit retag flag offensive close merge delete

Comments

Did you look at the doc: numerical_integral?

FrédéricC gravatar imageFrédéricC ( 2018-12-03 11:48:18 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-12-03 15:15:17 +0200

slelievre gravatar image

updated 2018-12-04 13:57:38 +0200

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.

edit flag offensive delete link more

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 ( 2018-12-03 18:46:12 +0200 )edit

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

slelievre gravatar imageslelievre ( 2020-10-03 21:31:37 +0200 )edit

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: 2018-12-03 07:13:25 +0200

Seen: 512 times

Last updated: Dec 04 '18