Opened 5 years ago

solve of ideal over QQ[x,y] does not give solution anymore (since 6.3)

Reported by: dkrenn major algebra N/A

Description

In Sage 6.3 we have

sage: R.<x,y> = QQ[]
sage: I = R.ideal(y^2 - 2*y + 1, x + 1/4*y - 5/4)
sage: solve(I.gens(), [SR(x) for x in R.gens()], solution_dict=true)
[]

But in 6.1.1 we got

sage: solve(I.gens(), [SR(x) for x in R.gens()], solution_dict=true)
[{x: 1, y: 1}]

which was the correct solution.

comment:1 Changed 5 years ago by dkrenn

I've narrowed the search: It works in 6.3.beta5, but not anymore in 6.3.beta6.

comment:2 Changed 5 years ago by vdelecroix

Hi,

I would not say this is a bug. If you want to use the function solve, you need to feed it with symbolic polynomials

sage: R.<x,y> = QQ[]
sage: Sx, Sy = var('x,y')
sage: I = R.ideal(y^2 - 2*y + 1, x + 1/4*y - 5/4)
sage: f0,f1 = I.gens()
sage: f0 = f0.subs(x=Sx, y=Sy); f1 = f1.subs(x=Sx, y=Sy)
sage: solve([f0,f1], [Sx,Sy], solution_dict=true)
[{x: 1, y: 1}]

The "bug" comes from solve which does not type check the input as it should. Note that when the input is one polynomial the check is done

sage: f0,f1 = I.gens()
sage: solve(f0, [Sx,Sy])
Traceback (most recent call last):
...
TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.

Vincent

comment:3 follow-up: ↓ 4 Changed 4 years ago by lftabera

See also #13360 automatically coercing from polynomials to symbolics can cause unexpected problems. So, while I acknowledge that this ugly and unconvenient I am more inclined to get used to write

sage: R.<x,y> = QQ[]
sage: I = R.ideal(y^2 - 2*y + 1, x + 1/4*y - 5/4)
sage: solve(map(SR,I.gens()), map(SR,R.gens()), solution_dict=true)
[{y: 1, x: 1}]