ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 04 Jan 2016 17:48:08 +0100assume a variable has two possible valueshttps://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/Hi,
how can I assume that a variable admits only a finite number of possible values? E.g., the variable x can only be 0 or 1. I could assume that
> `x*(x-1)==0`
but I am looking whether there is a straightforward way, too.
thanks in advanceSat, 02 Jan 2016 23:53:00 +0100https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/Comment by tmonteil for <p>Hi,</p>
<p>how can I assume that a variable admits only a finite number of possible values? E.g., the variable x can only be 0 or 1. I could assume that </p>
<blockquote>
<p><code>x*(x-1)==0</code></p>
</blockquote>
<p>but I am looking whether there is a straightforward way, too. </p>
<p>thanks in advance</p>
https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/?comment=32051#post-id-32051The assumption system is not working well (some assumptions are not taken into account during some computations). Could you please tell us about your initial problem ? Perhaps this first problem could solved with a non-symbolic approach.Mon, 04 Jan 2016 15:36:34 +0100https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/?comment=32051#post-id-32051Comment by daniele for <p>Hi,</p>
<p>how can I assume that a variable admits only a finite number of possible values? E.g., the variable x can only be 0 or 1. I could assume that </p>
<blockquote>
<p><code>x*(x-1)==0</code></p>
</blockquote>
<p>but I am looking whether there is a straightforward way, too. </p>
<p>thanks in advance</p>
https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/?comment=32055#post-id-32055dear Thierry, what kind of assumptions are not taken into account? and what do you mean by "not taken into account"? the problem is related to a reseach problem I'm studying. I should try to write a sample example. Roughly speaking, I have objects in a Lie algebra (whose structure equations may depend on parameters), and I am declaring objects with variable coefficients. Some additional properties add constraints on the possible values of the coefficients. I am using assume() to take into account the several properties. Thanks in advance, all the best,Mon, 04 Jan 2016 17:48:08 +0100https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/?comment=32055#post-id-32055Answer by slelievre for <p>Hi,</p>
<p>how can I assume that a variable admits only a finite number of possible values? E.g., the variable x can only be 0 or 1. I could assume that </p>
<blockquote>
<p><code>x*(x-1)==0</code></p>
</blockquote>
<p>but I am looking whether there is a straightforward way, too. </p>
<p>thanks in advance</p>
https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/?answer=32050#post-id-32050You could assume x is integer, and x >= 0, and x <= 1.Mon, 04 Jan 2016 15:18:44 +0100https://ask.sagemath.org/question/31995/assume-a-variable-has-two-possible-values/?answer=32050#post-id-32050