Ask Your Question
0

.solve() Claiming No Solution for Quadratic form

asked 2026-09-04 04:16:48 +0200

.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)
edit retag flag offensive close merge delete

Comments

Apparently, no solution found is not the same as "no solution exists". The former simply says that SageMath was unable to find any solution.

Max Alekseyev gravatar imageMax Alekseyev ( 2026-09-10 14:44:06 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2026-09-17 09:14:02 +0200

rburing gravatar image

The code just calls PARI/GP's qfsolve, and qfsolve([4,1/2,0,0;1/2,8,-1/2,0;0,-1/2,4,1/2;0,0,1/2,-81]) returns 2, so according to its documentation (which claims no solution exists), there is a bug in PARI/GP. Please report it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2026-09-04 04:16:48 +0200

Seen: 51 times

Last updated: Sep 04