This is based on Sage bug report at http://trac.sagemath.org/sage_trac/ticket/11493.
(%i16) integrate(x^(1/2)*%e^(-x-x^2),x,0,inf);
inf
/ 2
[ - x - x
(%o16) I sqrt(x) %e dx
]
/
0
(%i18) integrate(x^(.5)*%e^(-x-x^2),x,0,inf);
<snip lots of these>
rat: replaced 0.5 by 1/2 = 0.5
sqrt(%pi)
(%o18) ---------
2
The second one is quite wrong, as quad_qags shows:
(%i28) quad_qags(x^(1/2)*%e^(-x-x^2),x,0,1000);
(%o28) [.3201570903601473, 1.5628860428051894e-9, 609, 0]
(%i29) quad_qags(x^(1/2)*%e^(-x-x^2),x,0,10000);
***MESSAGE FROM ROUTINE DQAGS IN LIBRARY SLATEC.
***INFORMATIVE MESSAGE, PROG CONTINUES, TRACEBACK REQUESTED
* ABNORMAL RETURN
* ERROR NUMBER = 4
*
***END OF MESSAGE
(%o29) [.3201753870288189, .03110853789056672, 7707, 4]
Separately, what's up with that error message?
See also https://sourceforge.net/p/maxima/bugs/2499/ for another example of a float causing trouble in an integral. There are probably other open bug reports on this topic.
Some tracing shows that Maxima eventually calls
rischintwith the given integrand. It returnssqrt(%pi)*erf(x)/2. This is clearly wrong. Alsorisch(sqrt(x)*exp(-x-x^2),x)returns a noun form. So that value of 0.5 confuses the Risch integrator somehow.Oh, also:
And specint works with
x^(0.5)too.