Opened 3 years ago

Last modified 2 years ago

#16848 new defect

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

Reported by: dkrenn Owned by:
Priority: major Milestone:
Component: algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

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.

Change History (4)

comment:1 Changed 3 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 3 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: Changed 2 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}]

comment:4 in reply to: ↑ 3 Changed 2 years ago by dkrenn

Replying to 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}]

Ok, this is definitly a workaround and maybe should be mentioned somewhere. Anyhow, I do not like that solve as in the original problem accepts polynomials but then does not give a solution (while it did some versions ago)

Note: See TracTickets for help on using tickets.