Ask Your Question
1

Interactive question in notebooks

asked 13 years ago

Green diod gravatar image

updated 13 years ago

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
3

answered 13 years ago

god.one gravatar image

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)
Preview: (hide)
link

Comments

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

Green diod gravatar imageGreen diod ( 13 years ago )

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.

god.one gravatar imagegod.one ( 13 years ago )

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.

Green diod gravatar imageGreen diod ( 13 years ago )

You are correct.

kcrisman gravatar imagekcrisman ( 13 years ago )
0

answered 13 years ago

achrzesz gravatar image

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)

Preview: (hide)
link

Comments

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)

Green diod gravatar imageGreen diod ( 13 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 823 times

Last updated: Jan 21 '12