Ask Your Question
0

Using the "solve" function in a field extension

asked 2025-06-24 20:16:31 +0200

updated 2025-06-27 17:17:26 +0200

Max Alekseyev gravatar image

Hello, this is my code :

K0.<j> = NumberField(x^2+x+1)
K1.<k> = K0.extension(2*x^2 + 3*x + 3)
var("a,b,c")
u = Matrix(1,3,[a,b,c]).transpose()

A2 = Matrix(3,3,[[1,0,0],[0,j,0],[0,0,j^2]])
A3 = Matrix(3,3,[[1,k*j,k*j^2],[k*j,j^2,k],[k*j^2,k,j]])

And I would like this line of code :

solve([(u.transpose()*A2*u)[0][0] == 0, (u.transpose()*A3*u)[0][0] == 0, a==1],[a,b,c])

to work and give me the 4 solutions (I need to do that for a lot of pair of matrices). What should I do ? Thank you ^^

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2025-06-25 01:06:46 +0200

Max Alekseyev gravatar image

updated 2025-06-26 01:59:09 +0200

Generally, it's a bad idea to mix up symbolic variables with exact rings.

Since the equations you are solving are polynomial, it's better to define a,b,c as polynomial variables and use polynomial ideals machinery for solving the equations. Unfortunately, it does not support field extensions, and so we'd need to use a workaround of using the absolute field, say in a variable z, and mapping equations into there for solving.

The resulting code becomes:

K1.<j,k> = NumberField([x^2+x+1, 2*x^2 + 3*x + 3])
AF.<z> = K1.absolute_field()
print(AF)

to_K1, to_AF = AF.structure()

R.<a,b,c> = AF[]

u = Matrix(1,3,[a,b,c]).transpose()
A2 = Matrix(3,3,[[1,0,0],[0,j,0],[0,0,j^2]]).apply_map(to_AF)
A3 = Matrix(3,3,[[1,k*j,k*j^2],[k*j,j^2,k],[k*j^2,k,j]]).apply_map(to_AF)

J = R.ideal([(u.transpose()*A2*u)[0][0], (u.transpose()*A3*u)[0][0], a-1])
S = J.variety()
print('Solutions in AF:', S)
print('Solutions in K1:', [{v:to_K1(s) for v,s in sol.items()} for sol in S])

which prints:

Number Field in z with defining polynomial x^4 + 4*x^3 + 15*x^2 + 22*x + 19

Solutions in AF: [{c: 1, b: 1, a: 1}, {c: 1/6*z^2 + 1/2*z + 5/6, b: 1/18*z^3 + 1/3*z - 11/18, a: 1}, {c: -1/2*z^2 - 3/2*z - 5/2, b: -1/6*z^3 - 1/3*z^2 - 2/3*z - 1/2, a: 1}, {c: 1/3*z^3 + 5/6*z^2 + 19/6*z + 7/6, b: -1/6*z^3 - z + 11/6, a: 1}]

Solutions in K1: [{c: 1, b: 1, a: 1}, {c: (2/3*k + 2/3)*j + 2/3*k + 1/3, b: (-2/3*k - 2/3)*j - 1/3, a: 1}, {c: (-2*k - 2)*j - 2*k - 1, b: (2/3*k + 2)*j + 4/3*k + 1, a: 1}, {c: (-2/3*k - 2)*j + 2/3*k - 1, b: (2*k + 2)*j + 1, a: 1}]
edit flag offensive delete link more

Comments

Thank you very much, it worked perectly !

DJ_Ridoo gravatar imageDJ_Ridoo ( 2025-06-26 12:28:38 +0200 )edit

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: 2025-06-24 20:16:31 +0200

Seen: 47 times

Last updated: Jun 26