Challenges with subgroup elements
I'm running into apparent inconsistencies when studying subgroups of the unit group of a cyclotomic field.
k = CyclotomicField(7,'z')
U = k.unit_group()
z = k.gen()
a = 1+z
b = a^(-1)
T = U.subgroup([U(a)])
print(U(a) in U)
print(U(b) in U)
print(U(a) in T)
print(U(b) in T)
What I'm getting is:
True
True
True
False
which doesn't make sense. $T$ is a subgroup, so if it contains $a$ it must also contain $a^{-1}$. The group $U$ gets it right, but the subgroup $T$ does not. I'm guessing this is some coercion issue, but I'm not sure why it's happening, if it's a bug, and how to work around it.
(Checked this on the Sage Cell Server and CoCalc with Sage 9.4)
Please try SageMath 9.5, as there was a fix in this area recently.
Implentation of subgroups of unit groups is known to be buggy. E.g., see https://ask.sagemath.org/question/59558 along the same lines.
Wow. Thank you both. Yeah, ver 9.5 resolves this issue. Whew!