Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Possible shortcut for @achrzesz's answer :

# Use SR
Vars = var(["a%d%d"%(i,j) for i in range(2) for j in range(2)] +\
           ["x%s"%i for i in (1,2)])
# V = matrix(Vars[4:])
# Can't parse the american obsession with "rows" and "columns" vectors :
# a vector is a vector is a vector...
U = vector(Vars[4:])
A = matrix(Vars[:4], ncols=2)
# Still in SR :
p = 2*x1^2-4*x1*x2+5*x2^2
# Useful polynomial rings
R1 = PolynomialRing(QQ, Vars[:4])
R2 = PolynomialRing(R1, Vars[4:])
# Solution as a polynomial ideal
J = R1.ideal((U*A*U-p).polynomial(ring=R2).coefficients() +\
             [a00-2, a11-5, a01-a10]) # Supplementary equations

then

sage: J
Ideal (a00 - 2, a01 + a10 + 4, a11 - 5, a00 - 2, a11 - 5, a01 - a10) of Multivariate Polynomial Ring in a00, a01, a10, a11 over Rational Field
sage: J.dimension()
0
sage: J.variety()
[{a11: 5, a10: -2, a01: -2, a00: 2}]

HTH,