First time here? Check out the FAQ!

Ask Your Question
0

integrating with unspecified constants

asked 13 years ago

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.

Preview: (hide)

4 Answers

Sort by » oldest newest most voted
2

answered 13 years ago

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.

Preview: (hide)
link

Comments

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

WVPhysicist gravatar imageWVPhysicist ( 13 years ago )
0

answered 13 years ago

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)

Preview: (hide)
link

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 ( 13 years ago )

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

kcrisman gravatar imagekcrisman ( 13 years ago )
0

answered 13 years ago

achrzesz gravatar image

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

Preview: (hide)
link

Comments

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

WVPhysicist gravatar imageWVPhysicist ( 13 years ago )
0

answered 13 years ago

Green diod gravatar image

updated 13 years ago

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

Preview: (hide)
link

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 ( 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: 1,125 times

Last updated: Jan 21 '12