Revision history [back]

Whenever possible, avoid working with Sage's symbolic ring.

Here, you can use the symbolic ring as an intermediate step but move to QQbar.

This will make your code work. So you could start as you did:

sage: eta = I
sage: eta2 = (1+I)*sqrt(2)/2


sage: T = matrix(SR, 4, [eta**(i*j)*eta2/2 for i in range(4) for j in range(4)])


you could define

sage: T = matrix(QQbar, 4, [eta**(i*j)*eta2/2 for i in range(4) for j in range(4)])


And then things work.

sage: G = MatrixGroup(T)
sage: G
Matrix group over Algebraic Field with 1 generators (
[ 0.3535533905932738? + 0.3535533905932738?*I  0.3535533905932738? + 0.3535533905932738?*I  0.3535533905932738? + 0.3535533905932738?*I  0.3535533905932738? + 0.3535533905932738?*I]
[ 0.3535533905932738? + 0.3535533905932738?*I -0.3535533905932738? + 0.3535533905932738?*I -0.3535533905932738? - 0.3535533905932738?*I  0.3535533905932738? - 0.3535533905932738?*I]
[ 0.3535533905932738? + 0.3535533905932738?*I -0.3535533905932738? - 0.3535533905932738?*I  0.3535533905932738? + 0.3535533905932738?*I -0.3535533905932738? - 0.3535533905932738?*I]
[ 0.3535533905932738? + 0.3535533905932738?*I  0.3535533905932738? - 0.3535533905932738?*I -0.3535533905932738? - 0.3535533905932738?*I -0.3535533905932738? + 0.3535533905932738?*I]
)


Calculations in QQbar are exact and efficient.

If you need to see the radical expression of an element in QQbar (if it has one), use .radical_expression().

For example:

sage: T[0,0].radical_expression()
1/2*(-1)^(1/4)