(ccing sage-support in case someone else will have this question at
some point)
Dear Fredrik,
It seems that it is possible to convert from mpf to Sage reals
seemlessly:
sage: import sage.libs.mpmath.all as mpmath
sage: r = mpmath.mpf('1.00193')
sage: r
mpf('1.00193')
sage: RR(r)
1.00193000000000
However, this doesn't work for going from mpc to Sage complexes:
sage: c = mpmath.mpc('1.00193', '-0.332')
sage: c
mpc(real='1.00193', imag='-0.33200000000000002')
sage: CC(c)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
...
TypeError: unable to coerce to a ComplexNumber: <class
'mpmath.mptypes.mpc'>
I was thinking of fixing this by mimicking what you did in the case of
the reals, but I couldn't easily find where and how that is done. I
should probably keep looking -- but you probably know exactly where it
is, and so I am lazy and asking you.
Best,
Alex
--
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org