Ask Your Question

Revision history [back]

Hmm, I didn't get any hits on this. In the meantime, I think I may have answered one of my own questions. It's such a simple test that I'm kicking myself for not thinking of it sooner:

sage: a = -2.0 + 0
sage: sqrt(a)
1.41421356237310*I
sage: type(a)
<class 'sage.rings.real_mpfr.RealNumber'>
sage: type(sqrt(a))
<class 'sage.rings.complex_number.ComplexNumber'>

The + 0 part of a = -2.0 + 0 is to coerce -2.0 from RealLiteral to RealNumber. After that, it's pretty clear that ComplexNumber is the standard SAGE type for complex numbers. It automatically used that type, given a RealNumber. So I will avoid the MPComplexField class, unless I need specialized functionality from the MPC library. I can't think of what that is right now, but I guess I'm answering this for anyone else that might have the same question in the future.

If anyone else has deeper insights into the MPComplexField class, including any advantages or exclusive features of that class, I would still love to hear it.