# Interactive question in notebooks

When trying to find some solution to the double integral problem and poking around with Sage (4.7.2), I stumbled upon this behavior:

x,y,u,v,p,k=var('x,y,u,v,p,k')
integrate(x+y^k, y)


output (resembles maxima interaction):

Traceback (click to the left of this block for traceback)
...
Is  k+1  zero or nonzero?


How can I answer to this (with nonzero)?

Update: I accept @god.one solution below as there seems no way as for now to interactively answer those maxima questions.

edit retag close merge delete

Sort by » oldest newest most voted Hi, you can use the assume command

x,y,u,v,p,k=var('x,y,u,v,p,k')
assume(k+1!=0)
integrate(x+y^k, y)


which calculates to

x*y + y^(k + 1)/(k + 1)

more

Ok, thanks, that solves this particular question. But in general, how can one answer to interactive questions?

I do not understand what you mean with interactive questions. It is an error code from sage which gives you information where the error is and what to correct so the code can compile completely.

I would have preferred to have the possibility to answer nonzero to the above question i.e. interactively as I would in Maxima. But maybe it's not possible and the only solution is to add extra-assumptions and evaluate again as in your proposed solution.

You can avoid the question:

sage: x,y,u,v,p,k=var('x,y,u,v,p,k')

sage: integrate(x+y^k, y,algorithm='sympy')

x*y + y^(k + 1)/(k + 1)

more

Could you tell me where this algorithm option is documented? I'm going to try that for my [original problem](http://ask.sagemath.org/question/1077/symbolic-expectations-and-double-integrals)