Ask Your Question

# 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

## 4 Answers

Sort by ยป oldest newest most voted

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

## Comments

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

( 2012-01-21 17:36:24 +0200 )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

## Comments

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

( 2012-01-21 18:30:20 +0200 )edit

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

( 2012-01-23 13:14:44 +0200 )edit

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

more

## Comments

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

( 2012-01-27 20:54:26 +0200 )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

## Comments

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 16:43:35 +0200 )edit

## Your Answer

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

Add Answer

## Stats

Asked: 2012-01-21 15:49:12 +0200

Seen: 695 times

Last updated: Jan 21 '12