Ask Your Question

Revision history [back]

One solution is to convert complex rationals to QQbar.

I hope QQbar is well-behaved enough for you needs.

This might not be as good as QQ[i], maybe you can then convert to QQ[i].

By the way, you didn't specify how you define QQ[I].

sage: version()
'SageMath version 7.3, Release Date: 2016-08-04'
sage: a = SR(2/3+4/5*I); a
4/5*I + 2/3
sage: aa = QQbar(a); aa
4/5*I + 2/3
sage: aa.minpoly()
x^2 - 4/3*x + 244/225