# four vars but only one eq generate solve() error

Hi

W10 SageMath 9.2

why I m not allowed to have only one equation in the equation list, (uncomment line 4)?

varL=var('a,b,c,d',domain='real')
eqL=[a == -d, b*c == 0, a*(b + c) == 0]
eqL=[a == -d, b*c == 0]
#eqL=[a == -d]
show("so we need : \t ",eqL)
S=solve(eqL,varL)
show(S)


but with eqL=[a == -d,1==1] ,solve is ok

edit retag close merge delete

Indeed, this seems to be specific of equation singleton cases. Contrast :

sage: solve([a==-d, a*b==0], [a, b, d])
[[a == r45, b == 0, d == -r45], [a == 0, b == r46, d == 0]]
sage: solve([a==-d, a*b==0], [a, b, c, d])
[[a == r47, b == 0, c == r48, d == -r47], [a == 0, b == r49, c == r50, d == 0]]


with :

sage: solve([a==-d], [a, b, d])


[ Snip... ]

AttributeError: 'list' object has no attribute 'lhs'
sage: solve(a==-d, [a, b, d])


[ Snip... ]

AttributeError: 'list' object has no attribute 'lhs'


Would you care to report this ?

Would you care to report this ?@Emmanuel Charpentier :what do you mean ?

I think it's a problem that we can't use solve with a list with only one equation.

solve([a==-d],[a, b,c, d]) should have returned the following response

[[a == -r4, b == r6, c == r5, d == r4]]


or at least do not generate an error, and return the same equation

I filled in the ticket with a minimum of information as it is easily reproducible. I chose "Algebra" as a component, I'm not sure it makes sense .