four vars but only one eq generate solve() error

asked 2021-08-03 08:06:48 +0100

ortollj gravatar image

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 flag offensive close merge delete

Comments

I think there is a bug here.Am I wrong ?

ortollj gravatar imageortollj ( 2021-08-03 17:03:09 +0100 )edit

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 ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-08-04 13:00:10 +0100 )edit

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

ortollj gravatar imageortollj ( 2021-08-04 13:31:05 +0100 )edit

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

Filing a ticket on Trac...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-08-05 10:38:31 +0100 )edit

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 .

ortollj gravatar imageortollj ( 2021-08-06 08:40:41 +0100 )edit