Ask Your Question

How to evaluate $\int_1^2 e^{x^3} dx$?

asked 2015-03-16 16:59:03 -0500

mathhobbyist gravatar image

updated 2015-03-16 19:22:32 -0500

I tried to evaluate $\int_1^2 e^{x^3} dx$ in Sage. Is this a bug?

│ Sage Version 6.5, Release Date: 2015-02-17                         │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
sage: x=var('x');N(integrate(exp(x^3),x,1,2))
-138.557717219510 - 238.442320120796*I
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-03-16 17:41:40 -0500

tmonteil gravatar image

updated 2015-03-16 18:10:28 -0500

This looks indeed like a bug. Thanks for 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).

edit flag offensive delete link more

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


Asked: 2015-03-16 16:59:03 -0500

Seen: 124 times

Last updated: Mar 16 '15