When I do:

t.integrate(t, 0, 4*a - a^2) # LaTeX: \int_{0}^{4a - a^2} t dt


I get the correct answer:

1/2*a^4 - 4*a^3 + 8*a^2


But if I first make some assumptions, then the integral fails to evaluate:

assume(a, 'real')
assume(a > 1)
assume(a < 3) # now 0 < a < 4, so 4*a - a^2 > 0
t.integrate(t, 0, 4*a - a^2) # hangs, eventually produces RuntimeError


(To me, the assumptions should make the problem easier, if anything.  But 
instead apparently they make it harder...)

I also get a RuntimeError if, under the above assumptions, I do:

bool(4*a - a^2 > 0)


So maybe the integrate() function is trying to determine which endpoint is 
greater, and that's causing it to hang?  (The top endpoint is greater under 
the given assumptions, but you have to do a bit of algebra to figure that 
out.)  Indeed, a workaround is to first do: assume(4*a - a^2 > 0). 

I have posted a version of this question at 
https://ask.sagemath.org/question/52382/assumption-seems-to-break-integrate-is-this-a-bug/
 
, and there user @eric_g suggests another workaround: 
.integrate(algorithm='sympy').

So, does that mean that this is a problem with Maxima?

I noticed the behavior in Sage 8.6, and @eric_g confirms the behavior in 
Sage 9.2.beta5.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/4e77ae06-7f8f-4405-888d-cd1f9aba6ae6o%40googlegroups.com.

Reply via email to