1 | initial version |
This looks indeed like a bug. For numerical integration, you should use numerical_integral
:
sage: f(x) = exp(x^3)
sage: numerical_integral(f,1,2)
(275.5109837633117, 3.0587863771115628e-12)
2 | No.2 Revision |
This looks indeed like a bug. For numerical integration, you should use the numerical_integral
: function:
sage: f(x) = exp(x^3)
sage: numerical_integral(f,1,2)
(275.5109837633117, 3.0587863771115628e-12)
3 | No.3 Revision |
This looks indeed like a bug. Thanks for reporting. For numerical integration, you should use the numerical_integral
function:
sage: f(x) = exp(x^3)
sage: numerical_integral(f,1,2)
(275.5109837633117, 3.0587863771115628e-12)
Note that, if you want to stay in the symbolic world, sympy
seems to do the job:
sage: import sympy
sage: f = f._sympy_()
sage: g = f.integrate() ; g
exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, x**3*exp_polar(I*pi))/(9*gamma(4/3))
sage: h = g.subs(x,2) - g.subs(x,1)
sage: h
exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, 8*exp_polar(I*pi))/(9*gamma(4/3)) - exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, exp_polar(I*pi))/(9*gamma(4/3))
sage: h.n()
275.510983763312 - 1.68744844960818e-21*I
Which is consistent with the numerical approach (the imaginary part is just numerical noise).
4 | No.4 Revision |
This looks indeed like a bug. Thanks for reporting. For numerical integration, you should use the numerical_integral
function:
sage: f(x) = exp(x^3)
sage: numerical_integral(f,1,2)
(275.5109837633117, 3.0587863771115628e-12)
Note that, if you want to stay in the symbolic world, sympy
seems to do the job:
sage: import sympy
sage: f = f._sympy_()
sage: g = f.integrate() ; g
exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, x**3*exp_polar(I*pi))/(9*gamma(4/3))
sage: h = g.subs(x,2) - g.subs(x,1)
sage: h
exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, 8*exp_polar(I*pi))/(9*gamma(4/3)) - exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, exp_polar(I*pi))/(9*gamma(4/3))
sage: h.n()
275.510983763312 - 1.68744844960818e-21*I
Which is consistent with the numerical approach (the imaginary part is just numerical noise).
The bug is reported at trac ticket 17968.
5 | No.5 Revision |
This looks indeed like a bug. Thanks for reporting. reporting, it is now trac ticket 17968.
For numerical integration, you should use the numerical_integral
function:
sage: f(x) = exp(x^3)
sage: numerical_integral(f,1,2)
(275.5109837633117, 3.0587863771115628e-12)
Note that, if you want to stay in the symbolic world, sympy
seems to do the job:
sage: import sympy
sage: f = f._sympy_()
sage: g = f.integrate() ; g
exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, x**3*exp_polar(I*pi))/(9*gamma(4/3))
sage: h = g.subs(x,2) - g.subs(x,1)
sage: h
exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, 8*exp_polar(I*pi))/(9*gamma(4/3)) - exp(-I*pi/3)*gamma(1/3)*lowergamma(1/3, exp_polar(I*pi))/(9*gamma(4/3))
sage: h.n()
275.510983763312 - 1.68744844960818e-21*I
Which is consistent with the numerical approach (the imaginary part is just numerical noise).
The bug is reported at trac ticket 17968.