Ask Your Question

integrating with unspecified constants

asked 2012-01-21 08:49:12 -0500

WVPhysicist gravatar image

in the online sage I typed: var('x,a,b') integrate(1/sqrt(b+a/x), x)

And it answered: Traceback (click to the left of this block for traceback) ... Is b positive or negative?

Of course b is positive but there is no way to answer it's question or to predefine b as positive, so far as I know. so I used b^2 and got a question "Is b > 0?". Well yes b>0. So is a.

a and b are part of a physics problem. They change with the initial conditions. This is my first day with Sage. I have no idea what trace back is good for.

I don't know how to use this thing so send a copy of the answer to me at

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted

answered 2012-01-21 09:09:14 -0500 gravatar image

Hi, see question Interactive question in notebooks. Sage does not know that b is positive and you have specify that. Insert


The Traceback gives you hints if sage needs further information or if there is an error in the code you want to compile.

edit flag offensive delete link more


It works. The answer is simpler. Now all I have to do is check it. Thanks.

WVPhysicist gravatar imageWVPhysicist ( 2012-01-21 10:36:24 -0500 )edit

answered 2012-01-21 12:30:42 -0500

achrzesz gravatar image

sage: sage.symbolic.integration.integral.integral?

edit flag offensive delete link more


Why doesn't "a = Constant('a')" work?

WVPhysicist gravatar imageWVPhysicist ( 2012-01-27 13:54:26 -0500 )edit

answered 2012-01-21 11:04:48 -0500

achrzesz gravatar image

sage: var('x,a,b')

sage: integrate(1/sqrt(b+a/x), x,algorithm='mathematica_free')

sqrt(b + a/x)x/b - 1/2alog(2sqrt(b + a/x)sqrt(b)x + 2bx + a)/b^(3/2)

edit flag offensive delete link more


BTW, what is the difference between integrate and integral ?? Could you point us to the doc for this algorithm option?

Green diod gravatar imageGreen diod ( 2012-01-21 11:30:20 -0500 )edit

They should be the same. One is an alias for the other, I believe, for convenience.

kcrisman gravatar imagekcrisman ( 2012-01-23 06:14:44 -0500 )edit

answered 2012-01-21 09:39:13 -0500

Green diod gravatar image

updated 2012-01-21 11:28:05 -0500

@WVPhysicist It seems there is no way to interactively answer the question. I just tried the integral I proposed in both notebook mode (via http) and at the console but same problem.

I must say the console output is more verbose.

I think the problem is with the way Sage is interfaced with Maxima.

edit flag offensive delete link more


Or more precisely, the issue is that Maxima still adheres to a 1970s view of someone always being at the terminal ready to answer a prompt. This is a feature or a bug, depending on who you ask, but we really don't have any way to change how this interface is from that standpoint, as Python isn't really that sort of "interactive" language.

kcrisman gravatar imagekcrisman ( 2012-01-21 09:43:35 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2012-01-21 08:49:12 -0500

Seen: 424 times

Last updated: Jan 21 '12