Opened 9 years ago
Last modified 6 years ago
#11962 new defect
mpmath mpc won't coerce to ComplexNumber
Reported by: | dsm | Owned by: | robertwb |
---|---|---|---|
Priority: | major | Milestone: | sage-6.8 |
Component: | coercion | Keywords: | |
Cc: | leif | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Came across this working on #1173:
sage: version() 'Sage Version 4.7.2.alpha3, Release Date: 2011-09-28' sage: import mpmath sage: sage: z = mpmath.mpf(2) sage: z mpf('2.0') sage: RR(z) 2.00000000000000 sage: CC(z) 2.00000000000000 sage: sage: z = mpmath.mpc(2,3) sage: z mpc(real='2.0', imag='3.0') sage: complex(z) (2+3j) sage: CC(z) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) [...] TypeError: unable to coerce to a ComplexNumber: <type 'sage.libs.mpmath.ext_main.mpc'>
Change History (5)
comment:1 Changed 9 years ago by
- Cc leif added
- Component changed from PLEASE CHANGE to interfaces
- Owner changed from tbd to was
comment:2 Changed 9 years ago by
- Summary changed from mpc won't coerce to ComplexNumber to mpmath mpc won't coerce to ComplexNumber
comment:3 Changed 9 years ago by
comment:5 Changed 6 years ago by
- Component changed from interfaces to coercion
- Milestone set to sage-6.8
- Owner changed from was to robertwb
Note: See
TracTickets for help on using
tickets.
A trivial fix would be:
sage/rings/complex_number.pyx
elif isinstance(real, complex):real, imag = real.real, real.imagBut perhaps there are better ways.