# Revision history [back]

Your first try should probably be

k.<a,b>=NumberField([x^3-2,x^2-3])
L=L=k.absolute_field('z')
O=L.order([1,a,a^2,b,a*b,a^2,b])


which creates the appropriate rank 6 order over ZZ. However, Sage seems to prefer to keep representing elements with respect to the power basis in z, even in O:

sage: O(a+b)
-4/51*z^5 - 1/51*z^4 + 40/51*z^3 + 26/51*z^2 - 127/51*z + 91/51
sage: list(O(a+b))
[91/51, -127/51, 26/51, 40/51, -1/51, -4/51]


However, you're just a change-of-basis away from the appropriate result, and you can compute the corresponding matrix easily (and indeed, since orders don't allow you to specify the basis, you don't have

sage: T=matrix([list(L(u)) for u in [1,a,a^2,b,a*b,a^2*b]])
sage: T
[      1       0       0       0       0       0]
[ 91/102  -38/51   13/51   20/51  -1/102   -2/51]
[  61/51  -53/51  -19/51   10/51    4/51   -1/51]
[ 91/102  -89/51   13/51   20/51  -1/102   -2/51]
[ 107/51 -53/102  -35/51    5/51    2/51  -1/102]
[ 125/51  -25/51   26/51   23/51   -1/51   -4/51]


Given what <number field element>.matrix does, you can now get the appropriate matrix for multiplication by a+b with respect to the tensor basis (acting on row vectors) via

sage: T*L(a+b).matrix()*T^(-1)
[0 1 0 1 0 0]
[0 0 1 0 1 0]
[2 0 0 0 0 1]
[3 0 0 0 1 0]
[0 3 0 0 0 1]
[0 0 3 2 0 0]


Your first try should probably be

k.<a,b>=NumberField([x^3-2,x^2-3])
L=L=k.absolute_field('z')
O=L.order([1,a,a^2,b,a*b,a^2,b])


which creates the appropriate rank 6 order over ZZ. However, Sage seems to prefer to keep representing elements with respect to the power basis in z, even in O:

sage: O(a+b)
-4/51*z^5 - 1/51*z^4 + 40/51*z^3 + 26/51*z^2 - 127/51*z + 91/51
sage: list(O(a+b))
[91/51, -127/51, 26/51, 40/51, -1/51, -4/51]


However, you're just a change-of-basis away from the appropriate result, and you can compute the corresponding matrix easily (and indeed, since orders don't allow you to specify the basis, you don't havehave to bother with orders at all. You might as well just work in the field)

sage: T=matrix([list(L(u)) for u in [1,a,a^2,b,a*b,a^2*b]])
sage: T
[      1       0       0       0       0       0]
[ 91/102  -38/51   13/51   20/51  -1/102   -2/51]
[  61/51  -53/51  -19/51   10/51    4/51   -1/51]
[ 91/102  -89/51   13/51   20/51  -1/102   -2/51]
[ 107/51 -53/102  -35/51    5/51    2/51  -1/102]
[ 125/51  -25/51   26/51   23/51   -1/51   -4/51]


Given what <number field element>.matrix does, you can now get the appropriate matrix for multiplication by a+b with respect to the tensor basis (acting on row vectors) via

sage: T*L(a+b).matrix()*T^(-1)
[0 1 0 1 0 0]
[0 0 1 0 1 0]
[2 0 0 0 0 1]
[3 0 0 0 1 0]
[0 3 0 0 0 1]
[0 0 3 2 0 0]