ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 27 Jan 2012 13:54:26 -0600integrating with unspecified constantshttps://ask.sagemath.org/question/8652/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.
Sat, 21 Jan 2012 08:49:12 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/Answer by Green diod for <p>in the online sage I typed:
var('x,a,b')
integrate(1/sqrt(b+a/x), x)</p>
<p>And it answered:
Traceback (click to the left of this block for traceback)
...
Is b positive or negative?</p>
<p>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.</p>
<p>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.</p>
<p>I don't know how to use this thing so send a copy of the answer to me at <a href="mailto:august04@frontier.com">august04@frontier.com</a>.</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13160#post-id-13160@WVPhysicist It seems there is no way to interactively answer the question. I just tried the [integral I proposed](http://ask.sagemath.org/question/1078/interactive-question-in-notebooks) 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.Sat, 21 Jan 2012 09:39:13 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13160#post-id-13160Comment by kcrisman for <p><a href="/users/691/wvphysicist/">@WVPhysicist</a> It seems there is no way to interactively answer the question. I just tried the <a href="http://ask.sagemath.org/question/1078/interactive-question-in-notebooks">integral I proposed</a> in both notebook mode (via http) and at the console but same problem. </p>
<p>I must say the console output is more verbose.</p>
<p>I think the problem is with the way Sage is interfaced with Maxima.</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20471#post-id-20471Or 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.Sat, 21 Jan 2012 09:43:35 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20471#post-id-20471Answer by achrzesz for <p>in the online sage I typed:
var('x,a,b')
integrate(1/sqrt(b+a/x), x)</p>
<p>And it answered:
Traceback (click to the left of this block for traceback)
...
Is b positive or negative?</p>
<p>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.</p>
<p>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.</p>
<p>I don't know how to use this thing so send a copy of the answer to me at <a href="mailto:august04@frontier.com">august04@frontier.com</a>.</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13167#post-id-13167sage: sage.symbolic.integration.integral.integral?Sat, 21 Jan 2012 12:30:42 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13167#post-id-13167Comment by WVPhysicist for <p>sage: sage.symbolic.integration.integral.integral?</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20401#post-id-20401Why doesn't "a = Constant('a')" work?Fri, 27 Jan 2012 13:54:26 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20401#post-id-20401Answer by achrzesz for <p>in the online sage I typed:
var('x,a,b')
integrate(1/sqrt(b+a/x), x)</p>
<p>And it answered:
Traceback (click to the left of this block for traceback)
...
Is b positive or negative?</p>
<p>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.</p>
<p>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.</p>
<p>I don't know how to use this thing so send a copy of the answer to me at <a href="mailto:august04@frontier.com">august04@frontier.com</a>.</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13163#post-id-13163sage: var('x,a,b')
sage: integrate(1/sqrt(b+a/x), x,algorithm='mathematica_free')
sqrt(b + a/x)*x/b - 1/2*a*log(2*sqrt(b + a/x)*sqrt(b)*x + 2*b*x + a)/b^(3/2)Sat, 21 Jan 2012 11:04:48 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13163#post-id-13163Comment by kcrisman for <p>sage: var('x,a,b') </p>
<p>sage: integrate(1/sqrt(b+a/x), x,algorithm='mathematica_free')</p>
<p>sqrt(b + a/x)<em>x/b - 1/2</em>a<em>log(2</em>sqrt(b + a/x)<em>sqrt(b)</em>x + 2<em>b</em>x + a)/b^(3/2)</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20456#post-id-20456They should be the same. One is an alias for the other, I believe, for convenience.Mon, 23 Jan 2012 06:14:44 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20456#post-id-20456Comment by Green diod for <p>sage: var('x,a,b') </p>
<p>sage: integrate(1/sqrt(b+a/x), x,algorithm='mathematica_free')</p>
<p>sqrt(b + a/x)<em>x/b - 1/2</em>a<em>log(2</em>sqrt(b + a/x)<em>sqrt(b)</em>x + 2<em>b</em>x + a)/b^(3/2)</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20466#post-id-20466BTW, what is the difference between integrate and integral ?? Could you point us to the doc for this algorithm option?Sat, 21 Jan 2012 11:30:20 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20466#post-id-20466Answer by god.one for <p>in the online sage I typed:
var('x,a,b')
integrate(1/sqrt(b+a/x), x)</p>
<p>And it answered:
Traceback (click to the left of this block for traceback)
...
Is b positive or negative?</p>
<p>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.</p>
<p>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.</p>
<p>I don't know how to use this thing so send a copy of the answer to me at <a href="mailto:august04@frontier.com">august04@frontier.com</a>.</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13159#post-id-13159Hi, see question [Interactive question in notebooks](http://ask.sagemath.org/question/1078/interactive-question-in-notebooks#1743). 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.
Sat, 21 Jan 2012 09:09:14 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?answer=13159#post-id-13159Comment by WVPhysicist for <p>Hi, see question <a href="http://ask.sagemath.org/question/1078/interactive-question-in-notebooks#1743">Interactive question in notebooks</a>. Sage does not know that b is positive and you have specify that. Insert</p>
<pre><code>assume(b>0)
</code></pre>
<p>The Traceback gives you hints if sage needs further information or if there is an error in the code you want to compile.</p>
https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20468#post-id-20468It works. The answer is simpler. Now all I have to do is check it. Thanks.Sat, 21 Jan 2012 10:36:24 -0600https://ask.sagemath.org/question/8652/integrating-with-unspecified-constants/?comment=20468#post-id-20468