Thank you both for the answers. However, I’m still stuck:
Focusing on just translating the first line: R.<x> = QQ[]
In sage,
>>> preparse("R.<x> = QQ[]")"R = QQ['x']; (x,) = R._first_ngens(1)">>>
>>> import_statements(QQ)# ** Warning **: several names for that object: Q,
>>> QQfrom sage.rings.rational_field import Q>>> import_statements(R)from
>>> sage.rings.qqbar import QQx
Immediately I have a question: how come the import_statements of QQ is ...
import Q, and the import statement of R is ... import QQx? In either case
the namespace in question is not imported. Does it mean ... import Q as QQ
and ... import QQx as R respectively?
Then I’ve a problem: In sage, I can import them using these import
statements. But when entering these 2 import statements in Python,
>>> from sage.rings.rational_field import Q
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-0fb4c40d1a13> in <module>()
----> 1 from sage.rings.rational_field import Q
/usr/lib/python2.7/site-packages/sage/rings/rational_field.py in <module>()
62 _long_type = int
63
---> 64 from .rational import Rational
65 from .integer import Integer
66
/usr/lib/python2.7/site-packages/sage/rings/rational.pyx in init
sage.rings.rational (build/cythonized/sage/rings/rational.c:40976)()
94
95
---> 96 import sage.rings.real_mpfr
97 import sage.rings.real_double
98 from libc.stdint cimport uint64_t
/usr/lib/python2.7/site-packages/sage/rings/real_mpfr.pyx in init
sage.rings.real_mpfr (build/cythonized/sage/rings/real_mpfr.c:44298)()
----> 1 r"""
2 Arbitrary Precision Real Numbers
3
4 AUTHORS:
5
/usr/lib/python2.7/site-packages/sage/rings/complex_number.pxd in init
sage.libs.mpmath.utils (build/cythonized/sage/libs/mpmath/utils.c:8831)()
4 from .real_mpfr cimport RealNumber
5
----> 6 cdef class ComplexNumber(sage.structure.element.FieldElement):
7 cdef mpfr_t __re
8 cdef mpfr_t __im
/usr/lib/python2.7/site-packages/sage/rings/complex_double.pxd in init
sage.rings.complex_number (build/cythonized/sage/rings/complex_number.c:24212)()
8
9
---> 10 cdef class ComplexDoubleField_class(sage.rings.ring.Field):
11 pass
12
/usr/lib/python2.7/site-packages/sage/rings/complex_double.pyx in init
sage.rings.complex_double (build/cythonized/sage/rings/complex_double.c:24230)()
96 from cypari2.convert cimport new_gen_from_double,
new_t_COMPLEX_from_double
97
---> 98 from . import complex_number
99
100 from .complex_field import ComplexField
ImportError: cannot import name complex_number
>>> from sage.rings.qqbar import QQx
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-4809457c5588> in <module>()
----> 1 from sage.rings.qqbar import QQx
/usr/lib/python2.7/site-packages/sage/rings/qqbar.py in <module>()
512 rich_to_bool, richcmp_not_equal,
513 op_EQ, op_NE)
--> 514 from sage.rings.real_mpfr import RR
515 from sage.rings.real_mpfi import RealIntervalField, RIF,
is_RealIntervalFieldElement, RealIntervalField_class
516 from sage.rings.complex_field import ComplexField
/usr/lib/python2.7/site-packages/sage/rings/real_mpfr.pyx in init
sage.rings.real_mpfr (build/cythonized/sage/rings/real_mpfr.c:44298)()
----> 1 r"""
2 Arbitrary Precision Real Numbers
3
4 AUTHORS:
5
/usr/lib/python2.7/site-packages/sage/rings/complex_number.pxd in init
sage.libs.mpmath.utils (build/cythonized/sage/libs/mpmath/utils.c:8831)()
4 from .real_mpfr cimport RealNumber
5
----> 6 cdef class ComplexNumber(sage.structure.element.FieldElement):
7 cdef mpfr_t __re
8 cdef mpfr_t __im
/usr/lib/python2.7/site-packages/sage/rings/complex_double.pxd in init
sage.rings.complex_number (build/cythonized/sage/rings/complex_number.c:24212)()
8
9
---> 10 cdef class ComplexDoubleField_class(sage.rings.ring.Field):
11 pass
12
/usr/lib/python2.7/site-packages/sage/rings/complex_double.pyx in init
sage.rings.complex_double (build/cythonized/sage/rings/complex_double.c:24230)()
96 from cypari2.convert cimport new_gen_from_double,
new_t_COMPLEX_from_double
97
---> 98 from . import complex_number
99
100 from .complex_field import ComplexField
ImportError: cannot import name complex_number
Thanks.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.