Ask Your Question
0

integrating with unspecified constants

asked 2012-01-21 15:49:12 +0100

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

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
2

answered 2012-01-21 16:09:14 +0100

god.one gravatar image

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.

edit flag offensive delete link more

Comments

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

WVPhysicist gravatar imageWVPhysicist ( 2012-01-21 17:36:24 +0100 )edit
0

answered 2012-01-21 18:04:48 +0100

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

Comments

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 18:30:20 +0100 )edit

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

kcrisman gravatar imagekcrisman ( 2012-01-23 13:14:44 +0100 )edit
0

answered 2012-01-21 19:30:42 +0100

achrzesz gravatar image

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

edit flag offensive delete link more

Comments

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

WVPhysicist gravatar imageWVPhysicist ( 2012-01-27 20:54:26 +0100 )edit
0

answered 2012-01-21 16:39:13 +0100

Green diod gravatar image

updated 2012-01-21 18:28:05 +0100

@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

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.

kcrisman gravatar imagekcrisman ( 2012-01-21 16:43:35 +0100 )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

Stats

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

Seen: 1,105 times

Last updated: Jan 21 '12