Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surprising error in numerical integration #30379

Open
EmmanuelCharpentier mannequin opened this issue Aug 16, 2020 · 3 comments
Open

Surprising error in numerical integration #30379

EmmanuelCharpentier mannequin opened this issue Aug 16, 2020 · 3 comments

Comments

@EmmanuelCharpentier
Copy link
Mannequin

EmmanuelCharpentier mannequin commented Aug 16, 2020

Source : this ask.sagemath question.

sage: g(x)=gamma_inc(2,11/5)*x
sage: g(x).integrate(x,2,5).n() ## For reference
3.72298612097441

So far, so good. But :

sage: gamma_inc(2,11/5).n()*numerical_integral(x,2,5)[0]
3.72298612097441
sage: numerical_integral(g(x),2,5)
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
<ipython-input-105-c9c90f4afa7c> in <module>
----> 1 numerical_integral(g(x),Integer(2),Integer(5))

/usr/local/sage-9/local/lib/python3.7/site-packages/sage/calculus/integration.pyx in sage.calculus.integration.numerical_integral (build/cythonized/sage/calculus/integration.c:4479)()
    380          _b = b
    381          W = <gsl_integration_workspace*> gsl_integration_workspace_alloc(n)
--> 382          sig_on()
    383          gsl_integration_qag(&F,_a,_b,eps_abs,eps_rel,n,rule,W,&result,&abs_err)
    384          sig_off()

SystemError: calling remove_from_pari_stack() inside sig_on()

Ouch... The problem seems to come from the ((unpurposeful) repeated) computation of gamma(2,11/5) inside the integrated function.

FWIW:

sage: numerical_integral(x*arctan(sqrt(3)),2,5)
(10.995574287564278, 1.2207539743030213e-13)

Component: numerical

Keywords: integral

Issue created by migration from https://trac.sagemath.org/ticket/30379

@EmmanuelCharpentier EmmanuelCharpentier mannequin added this to the sage-9.2 milestone Aug 16, 2020
@EmmanuelCharpentier
Copy link
Mannequin Author

EmmanuelCharpentier mannequin commented Aug 16, 2020

comment:1

A few (alive, dead or zombie) fossils tickets, possibly related : #15219, #17328, #18210

@fchapoton
Copy link
Contributor

Changed keywords from none to integral

@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Oct 24, 2020
@mkoeppe
Copy link
Contributor

mkoeppe commented May 10, 2021

comment:4

Moving to 9.4, as 9.3 has been released.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 May 10, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Aug 22, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants