matrix of multiplication by primitive element of number field in SageMath

103 Views Asked by At

I never used Sage and I would like to check some results on Sage but I really don't know how.

First I need to create a number field ($\Bbb Q[\sqrt 2]$ for instance). Then I would like to find or select a suitable basis $(1,\sqrt 2$). I would like at last to find the matrix multiplication, say by $\sqrt 2$ in that selected basis.

Could you please help? I tried unsuccessfully the following:

k. = NumberField(x^2 - 2)

a^4

k.basis()

Thank you.

1

There are 1 best solutions below

3
On BEST ANSWER

See the documentation on number field elements and search for 'matrix'

sage: K.<a> = NumberField(x^2 - 2)
sage: a.matrix()
[0 1]
[2 0]
sage: (a^4).matrix()
[4 0]
[0 4]

The standard basis used here is the list of powers of the primitive element, that is $(1,\sqrt{2})$ in this case.

As the documentation states, this is the matrix for right multiplication; the rows are the images of the basis vectors. You can take the transpose if you prefer.