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.Wed, 16 Jun 2021 11:05:27 +0200assume causes a solving failurehttps://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/This code
var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
causes an AttributeError :
AttributeError: 'list' object has no attribute 'lhs'
The problem comes from the assumption in line 2. Can somebody explain?
Thu, 10 Jun 2021 11:33:47 +0200https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/Comment by po for <p>This code</p>
<pre><code>var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
</code></pre>
<p>causes an AttributeError :</p>
<pre><code>AttributeError: 'list' object has no attribute 'lhs'
</code></pre>
<p>The problem comes from the assumption in line 2. Can somebody explain?</p>
https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57584#post-id-57584Emmanuel, thanks for your detailed examination.Wed, 16 Jun 2021 11:05:27 +0200https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57584#post-id-57584Comment by Emmanuel Charpentier for <p>This code</p>
<pre><code>var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
</code></pre>
<p>causes an AttributeError :</p>
<pre><code>AttributeError: 'list' object has no attribute 'lhs'
</code></pre>
<p>The problem comes from the assumption in line 2. Can somebody explain?</p>
https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57575#post-id-57575These bugs seem mutually independent :
sage: var("a, b")
(a, b)
sage: assume(a, "real")
sage: equation=[a+b==0]
sage: solve(equation, a, b)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[ Snip...]
AttributeError: 'list' object has no attribute 'lhs'
sage: var("a, b")
(a, b)
sage: equation=[a+b==0]
sage: var("a, b")
(a, b)
sage: assume(a, "real")
sage: equation=[a+b==0]
sage: solve(equation, [a, b])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
[ Snip...]
AttributeError: 'list' object has no attributeTue, 15 Jun 2021 20:04:23 +0200https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57575#post-id-57575Comment by Emmanuel Charpentier for <p>This code</p>
<pre><code>var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
</code></pre>
<p>causes an AttributeError :</p>
<pre><code>AttributeError: 'list' object has no attribute 'lhs'
</code></pre>
<p>The problem comes from the assumption in line 2. Can somebody explain?</p>
https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57574#post-id-57574`solve` has *two* positional arguments :
- a (list of) equation(s) to solve, and
- a (list of) variable(s) to solve *for*.
Your call passes a list of one equation, which confuses `solve`. A (very old, AFAICT) bug...
Your call also pass *three* arguments to `solve` : another source of confusion... A second bug ?
But I checked that the assumption introduced yet another error. A third bug ??Tue, 15 Jun 2021 19:58:35 +0200https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57574#post-id-57574Comment by tolga for <p>This code</p>
<pre><code>var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
</code></pre>
<p>causes an AttributeError :</p>
<pre><code>AttributeError: 'list' object has no attribute 'lhs'
</code></pre>
<p>The problem comes from the assumption in line 2. Can somebody explain?</p>
https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57537#post-id-57537Cyrille, I think the question is still valid because if we rule out the assumption line, the code yields an answer with a free variable as
[a == -r1, b == r1]Thu, 10 Jun 2021 21:23:32 +0200https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57537#post-id-57537Comment by Cyrille for <p>This code</p>
<pre><code>var("a b")
assume(a, "real")
equation=[a+b==0]
s=solve(equation, a, b)
print(s)
</code></pre>
<p>causes an AttributeError :</p>
<pre><code>AttributeError: 'list' object has no attribute 'lhs'
</code></pre>
<p>The problem comes from the assumption in line 2. Can somebody explain?</p>
https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57531#post-id-57531I have always a sens of unlegitimity in answering a question, but your problem comes more certainly from the fact that you hve one equation and two unknowns. It works if you use a or bThu, 10 Jun 2021 17:37:24 +0200https://ask.sagemath.org/question/57526/assume-causes-a-solving-failure/?comment=57531#post-id-57531