![]() | 1 | initial version |
Let's compute some solution.
We will fix B
as a matrix with just one off-diagonal nonzero entry, say, Bn,1=1. This will immediately imply B2=0 and satisfy the second equation.
We will introduce n2 variables for elements of n and one more to ensure that det. Then we will compute dimension of polynomials corresponds to the entries of the left-hand side of the first equation, and while it's positive, try to make some random variable assignment.
Here is a sample code:
import random
def find_A(n):
R = PolynomialRing(QQ, n^2+1, 'x')
x = R.gens()[:n^2]
A = Matrix(R, n, n, x)
B = Matrix(R, n, n)
B[n-1,0] = 1
# construct list of equations
E = []
E.extend( (A^2*B + A*B*A + B*A^2).list() ) # first equation
E.append( A.det()*R.gens()[-1] - 1 ) # det(A) != 0
while (d := (J := R.ideal(E)).dimension()):
# print('Dim =',d)
if d < 0: E.pop() # remove last assignment
E.append( random.choice(x) - ZZ.random_element() )
V = J.variety()[0] # any solution
return A.map_apply(V.__getitem__)
Calling find_A(3)
can produce a matrix like
[ 16 -1 0]
[273 1 0]
[ 0 -1 -17]
![]() | 2 | No.2 Revision |
Let's compute some solution.
We will fix B as a matrix with just one off-diagonal nonzero entry, say, B_{n,1}=1. This will immediately imply B^2=0 and satisfy the second equation. B
We will introduce n^2 variables for elements of n A, and one more to ensure that \det A\ne 0. (\det A)^{-1} (to make sure that the determinant is invertible). Then we will compute dimension of polynomials corresponds to the entries of the left-hand side of the first equation, and while it's positive, try to make some random variable assignment.assignment until it drops to 0 and enable application of .variety()
method.
Here is a sample code:
import random
def find_A(n):
R = PolynomialRing(QQ, n^2+1, 'x')
x = R.gens()[:n^2]
A = Matrix(R, n, n, x)
B = Matrix(R, n, n)
B[n-1,0] = 1
# construct list of equations
E = []
E.extend( (A^2*B + A*B*A + B*A^2).list() ) # first equation
E.append( A.det()*R.gens()[-1] - 1 ) # det(A) != 0
while (d := (J := R.ideal(E)).dimension()):
# print('Dim =',d)
if d < 0: E.pop() # remove last assignment
E.append( random.choice(x) - ZZ.random_element() )
V = J.variety()[0] # any solution
return A.map_apply(V.__getitem__)
Calling find_A(3)
can produce a matrix like
[ 16 -1 0]
[273 1 0]
[ 0 -1 -17]
![]() | 3 | No.3 Revision |
Let's compute some solution.
We will fix B as a matrix with just one off-diagonal nonzero entry, say, B_{n,1}=1. This will immediately imply B^2=0 and satisfy the second equation.
We will introduce n^2 variables for elements of A, and one more to ensure that (\det A)^{-1} (to make sure that the determinant is invertible). Then we will compute dimension of polynomials corresponds to the entries of the left-hand side of the first equation, and while it's positive, try to make some random variable assignment until it drops to 0 and enable application of .variety()
method.
Here is a sample code:
import random
def find_A(n):
R = PolynomialRing(QQ, n^2+1, 'x')
x = R.gens()[:n^2]
A = Matrix(R, n, n, x)
B = Matrix(R, n, n)
B[n-1,0] = 1
# construct list of equations
E = []
E.extend( (A^2*B + A*B*A + B*A^2).list() ) # first equation
E.append( A.det()*R.gens()[-1] - 1 ) # det(A) != 0
while (d := (J := R.ideal(E)).dimension()):
# print('Dim =',d)
if d < 0: E.pop() # remove last assignment
E.append( random.choice(x) - ZZ.random_element() )
V = J.variety()[0] # any solution
return A.map_apply(V.__getitem__)
A.apply_map(V.__getitem__)
Calling find_A(3)
can produce a matrix like
[ 16 -1 0]
[273 1 0]
[ 0 -1 -17]
![]() | 4 | No.4 Revision |
Let's compute some solution.
We will fix B as a matrix with just one off-diagonal nonzero entry, say, B_{n,1}=1. This will immediately imply B^2=0 and satisfy the second equation.
We will introduce n^2 variables for elements of A, and one more to ensure that (\det A)^{-1} (to make sure that the determinant is invertible). Then we will compute dimension of polynomials corresponds to the entries of the left-hand side of the first equation, and while it's positive, try to make some random variable assignment until it drops to 0 and enable application of .variety()
method.
Here is a sample code:
import random
def find_A(n):
R = PolynomialRing(QQ, n^2+1, 'x')
x = R.gens()[:n^2]
A = Matrix(R, n, n, x)
B = Matrix(R, n, n)
B[n-1,0] = 1
while True:
# construct list of equations
E = []
E.extend( (A^2*B + A*B*A + B*A^2).list() ) # first equation
E.append( A.det()*R.gens()[-1] - 1 ) # det(A) != 0
while (d := (J := R.ideal(E)).dimension()):
# print('Dim =',d)
if d < 0: E.pop() # remove last assignment
E.append( random.choice(x) - ZZ.random_element() )
V = J.variety()[0] # any solution
J.variety()
if V: return A.apply_map(V.__getitem__)
A.apply_map(V[0].__getitem__)
Calling find_A(3)
can produce a matrix like
[ 16 -1 0]
[273 1 0]
[ 0 -1 -17]
![]() | 5 | No.5 Revision |
UPDATED 2025-02-16. Let's compute some solution.
We will fix B as a matrix with just one off-diagonal nonzero entry, say, B_{n,1}=1. This will immediately imply B^2=0 and satisfy the second equation. B^2=0.
We will introduce n^2 variables for elements of A, and one more to ensure that (\det A)^{-1} (to make sure that the determinant is invertible). Then we will compute dimension of polynomials corresponds to the entries of the left-hand side of the first equation, two equations, and while it's positive, try to make some random variable assignment until it drops to 0 and enable application of .variety()
method.
Here is a sample code:
import random
def find_A(n):
R = PolynomialRing(QQ, n^2+1, 'x')
x = R.gens()[:n^2]
A = Matrix(R, n, n, x)
B = Matrix(R, n, n)
B[n-1,0] = 1
while True:
# construct list of equations
E = []
E.extend( (A^2*B + A*B*A + B*A^2).list() ) # first equation
E.extend( (B*A*B).list() ) # second equation
E.append( A.det()*R.gens()[-1] - 1 ) # det(A) != 0
while (d := (J := R.ideal(E)).dimension()):
# print('Dim =',d)
if d < 0: E.pop() # remove last assignment
E.append( random.choice(x) - ZZ.random_element() )
V = J.variety()
if V: return A.apply_map(V[0].__getitem__)
Calling find_A(3)
can produce a matrix like
[ 16 -1 0]
[273 1 [-1 0 0]
[ 7 0 1]
[ 5 -1 -17]
1]
![]() | 6 | No.6 Revision |
UPDATED 2025-02-16. Let's compute some solution.
We will fix B as a matrix with just one off-diagonal nonzero entry, say, B_{n,1}=1. This will immediately imply B^2=0.
We will introduce n^2 variables for elements of A, and one more to ensure that (\det A)^{-1} (to make sure that the determinant is invertible). Then we will compute dimension of polynomials corresponds to the entries of the left-hand side of the two equations, and while it's positive, try to make some random variable assignment until it drops to 0 and enable application of .variety()
method.
Here is a sample code:
import random
def find_A(n):
R = PolynomialRing(QQ, n^2+1, 'x')
x = R.gens()[:n^2]
A = Matrix(R, n, n, x)
B = Matrix(R, n, n)
B[n-1,0] = 1
while True:
# construct list of equations
E = []
E.extend( (A^2*B + A*B*A + B*A^2).list() ) # first equation
E.extend( (B*A*B).list() ) # second equation
E.append( A.det()*R.gens()[-1] - 1 ) # det(A) != 0
while (d := (J := R.ideal(E)).dimension()):
# print('Dim =',d)
if d < 0: E.pop() # remove last assignment
E.append( random.choice(x) choice(x) - ZZ.random_element() )
V = J.variety()
if V: return A.apply_map(V[0].__getitem__)
Calling find_A(3)
can produce a matrix like
[-1 0 0]
[ 7 0 1]
[ 5 -1 1]