Ask Your Question

Revision history [back]

.solve() Claiming No Solution for Quadratic form

.solve() claims that there is no solution to the quadratic form defined by

$4x_1^2 +8x_2^2 +4x_3^2-81x_4^2 +x_1x_2 -x_2x_3 +x_3x_4$

However, (9,0,0,2) should be a solution. When I defined the above as a polynomial, and evaluate at the proposed solution, Sage gives 0 as the value. However, whenever I run solve, it says there is no solution and a local obstruction at 2.

I've looked through what I can understand of the .solve() and qfsolve documentation, but I don't see anything which indicates why this would be a problem. I am running Sage through a Jupyter Notebook.

Below is the code I am using

def QSolve(a1, a2, a3, a4):
     P.<x1,x2,x3,x4> = QQ[]
     p = a1*x1^2 +a2*x2^2 +a3*x3^2 +a4*x4^2 +x1*x2 -x2*x3+x3*x4
     print(p(9,0,0,2))
     print()
     Q = QuadraticForm(p)

     try: 
         uSoln = Q.solve()
         print( "[ ", a1 ,", ", a2, ", ", a3, ", ", a4, "]^+ has solution: ", uSoln) 
         print()
         return uSoln
     except Exception as ErrorMessage:
         print( "[ ", a1 ,", ", a2, ", ", a3, ", ", a4, "]^+ ", ErrorMessage) 
         print()
     return

QSolve(4,8,4,-81)

Which gives the output

0

[  4 ,  8 ,  4 ,  -81 ]^+  no solution found (local obstruction at 2)