ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 26 Oct 2012 02:14:34 -0500Assumptions in sagehttp://ask.sagemath.org/question/9470/assumptions-in-sage/Hello!
I am a sage beginner and I wish to know that How sage handles assumptions ?
My example is as follows.
a= var('a');
solve((a-1)*x ==3, x);
and sage solves and gives correct solution [x==(3 / (a - 1))].
But here how the assumption (a != 1) is handled ? Because solution is not defined for (a=1).
Best regards
Charmi
Thu, 25 Oct 2012 10:04:20 -0500http://ask.sagemath.org/question/9470/assumptions-in-sage/Answer by benjaminfjones for <p>Hello!</p>
<p>I am a sage beginner and I wish to know that How sage handles assumptions ?</p>
<p>My example is as follows.</p>
<p>a= var('a');
solve((a-1)*x ==3, x);</p>
<p>and sage solves and gives correct solution [x==(3 / (a - 1))].
But here how the assumption (a != 1) is handled ? Because solution is not defined for (a=1).</p>
<p>Best regards</p>
<p>Charmi</p>
http://ask.sagemath.org/question/9470/assumptions-in-sage/?answer=14193#post-id-14193I would say that `3 / (a-1)` is a "symbolic solution"; meaning it's a solution for a particular value of `a` if and only if it makes sense for that `a` (i.e. there is no division by zero, etc..). The `solve` command will return symbolic solutions when possible because they generally make sense for almost all values of any symbolic parameter. You have to take care that solutions may not make sense for some particular values of the parameters.Thu, 25 Oct 2012 16:04:00 -0500http://ask.sagemath.org/question/9470/assumptions-in-sage/?answer=14193#post-id-14193Comment by sage_learner for <p>I would say that <code>3 / (a-1)</code> is a "symbolic solution"; meaning it's a solution for a particular value of <code>a</code> if and only if it makes sense for that <code>a</code> (i.e. there is no division by zero, etc..). The <code>solve</code> command will return symbolic solutions when possible because they generally make sense for almost all values of any symbolic parameter. You have to take care that solutions may not make sense for some particular values of the parameters.</p>
http://ask.sagemath.org/question/9470/assumptions-in-sage/?comment=18813#post-id-18813I got it.. Thank you. I wish to understand something regarding following code.
x = var('x');
assume(x>0);
print([x>0] == [1==1])
Sage answers it as "False"
In the above piece of code "[x>0] == [1==1]" is logically true but it is gives False.
I wish to know How does comparison operator "==" works ? Specially when comparing two predicates ?
Does there any other function exist for such comparison ?
Best regardsFri, 26 Oct 2012 02:14:34 -0500http://ask.sagemath.org/question/9470/assumptions-in-sage/?comment=18813#post-id-18813