# integrating with unspecified constants

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 august04@frontier.com.

edit retag close merge delete

Sort by ยป oldest newest most voted

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

more

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

( 2012-01-27 13:54:26 -0600 )edit

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)

more

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

( 2012-01-21 11:30:20 -0600 )edit

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

( 2012-01-23 06:14:44 -0600 )edit

@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.

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.

( 2012-01-21 09:43:35 -0600 )edit

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

assume(b>0)


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

more

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

( 2012-01-21 10:36:24 -0600 )edit