Commits

Volker Braun committed d1072e6

updated to sage-5.8.beta0

Comments (0)

Files changed (15)

+trac_13618-rings_doc_real-ts.patch
+trac_13618-rings_doc_complex-ts.patch
+trac_13618-rings_doc_others-ts.patch
 trac_13249_vb.patch
 trac_13249_volume.patch
 trac_12553_ppl_count_points.patch

trac_13084_toric_weierstrass.patch

 # HG changeset patch
-# Parent 22651a99a721d2c5567e4cece70101a0c0772670
+# Parent cef6980288b356886205a3d207a7a6e9fde58d91
 
 Weierstrass form for toric anticanonical hypersurfaces
 
-diff --git a/doc/en/reference/schemes.rst b/doc/en/reference/schemes.rst
---- a/doc/en/reference/schemes.rst
-+++ b/doc/en/reference/schemes.rst
-@@ -33,4 +33,5 @@
+diff --git a/doc/en/reference/schemes/index.rst b/doc/en/reference/schemes/index.rst
+--- a/doc/en/reference/schemes/index.rst
++++ b/doc/en/reference/schemes/index.rst
+@@ -31,6 +31,7 @@
     sage/schemes/toric/chow_group
     sage/schemes/toric/ideal
     sage/schemes/toric/morphism
 +   sage/schemes/toric/weierstrass
  
+ 
+ .. include:: ../footer.txt
 diff --git a/sage/schemes/toric/all.py b/sage/schemes/toric/all.py
 --- a/sage/schemes/toric/all.py
 +++ b/sage/schemes/toric/all.py

trac_13458_toric_Weierstrass_covering.patch

 # HG changeset patch
-# Parent bb6aaafaea5cfcd9b223ed872b33080e5d009da1
+# Parent 72ce6fa4077075bc98dbfe4f59d1aebf71fb8876
 
 Compute the map from a elliptic curve in a toric surface
 to its Weierstrass form
 
-diff --git a/doc/en/reference/schemes.rst b/doc/en/reference/schemes.rst
---- a/doc/en/reference/schemes.rst
-+++ b/doc/en/reference/schemes.rst
-@@ -34,4 +34,4 @@
+diff --git a/doc/en/reference/schemes/index.rst b/doc/en/reference/schemes/index.rst
+--- a/doc/en/reference/schemes/index.rst
++++ b/doc/en/reference/schemes/index.rst
+@@ -32,6 +32,7 @@
     sage/schemes/toric/ideal
     sage/schemes/toric/morphism
     sage/schemes/toric/weierstrass
--
 +   sage/schemes/toric/weierstrass_covering
+ 
+ 
+ .. include:: ../footer.txt
 diff --git a/sage/geometry/polyhedron/lattice_euclidean_group_element.py b/sage/geometry/polyhedron/lattice_euclidean_group_element.py
 --- a/sage/geometry/polyhedron/lattice_euclidean_group_element.py
 +++ b/sage/geometry/polyhedron/lattice_euclidean_group_element.py

trac_13618-rings_doc_complex-ts.patch

+# HG changeset patch
+# User Travis Scrimshaw <tscrim@ucdavis.edu>
+# Date 1360163433 28800
+# Node ID 15aaa5bf91f8c72bf65ec46af20778091662d710
+# Parent 001d4d4bd8d6a9204c161a14a16de9f062728b72
+Trac #13618 - Added doctests for complex*.
+
+diff --git a/doc/en/reference/rings_numerical/index.rst b/doc/en/reference/rings_numerical/index.rst
+--- a/doc/en/reference/rings_numerical/index.rst
++++ b/doc/en/reference/rings_numerical/index.rst
+@@ -23,11 +23,18 @@ when implementations aren't otherwise av
+    :maxdepth: 2
+ 
+    sage/rings/real_double
++   sage/rings/real_mpfr
++   sage/rings/real_mpfi
++   sage/rings/real_interval_field
++   sage/rings/real_interval_absolute
++   sage/rings/real_lazy
++
+    sage/rings/complex_double
+-   sage/rings/real_mpfr
+    sage/rings/complex_field
+    sage/rings/complex_number
+    sage/rings/complex_mpc
+-   sage/rings/real_mpfi
++   sage/rings/complex_interval_field
++   sage/rings/complex_interval
+ 
+ .. include:: ../footer.txt
++
+diff --git a/sage/rings/complex_double.pyx b/sage/rings/complex_double.pyx
+--- a/sage/rings/complex_double.pyx
++++ b/sage/rings/complex_double.pyx
+@@ -2,16 +2,16 @@ r"""
+ Double Precision Complex Numbers
+ 
+ Sage supports arithmetic using double-precision complex numbers. A
+-double-precision complex number is a complex number x + I\*y with
+-x, y 64-bit (8 byte) floating point numbers (double precision).
+-
+-The field ``ComplexDoubleField`` implements the field
++double-precision complex number is a complex number ``x + I*y`` with
++`x`, `y` 64-bit (8 byte) floating point numbers (double precision).
++
++The field :class:`ComplexDoubleField` implements the field
+ of all double-precision complex numbers. You can refer to this
+ field by the shorthand CDF. Elements of this field are of type
+-``ComplexDoubleElement``. If x and y are coercible to
++:class:`ComplexDoubleElement`. If `x` and `y` are coercible to
+ doubles, you can create a complex double element using
+ ``ComplexDoubleElement(x,y)``. You can coerce more
+-general objects z to complex doubles by typing either
++general objects `z` to complex doubles by typing either
+ ``ComplexDoubleField(x)`` or ``CDF(x)``.
+ 
+ EXAMPLES::
+@@ -46,6 +46,8 @@ incomplete gamma, etc., are implemented 
+ AUTHORS:
+ 
+ - William Stein (2006-09): first version
++
++- Travis Scrimshaw (2012-10-18): Added doctests to get full coverage
+ """
+ 
+ #################################################################################
+@@ -68,12 +70,12 @@ cdef extern from "math.h":
+ 
+ # The M_PI_4 constant is not available on cygwin in "math.h" (though
+ # it is on most other platforms).
+-cdef double M_PI_4 = 0.785398163397448309615660845819875721    
+-    
++cdef double M_PI_4 = 0.785398163397448309615660845819875721
++
+ cdef extern from "complex.h":
+     double complex csqrt(double complex)
+     double cabs(double complex)
+-    
++
+ cimport sage.rings.ring
+ 
+ cimport sage.rings.integer
+@@ -111,10 +113,10 @@ from sage.categories.morphism cimport Mo
+ 
+ def is_ComplexDoubleField(x):
+     """
+-    Return True if x is the complex double field.
+-    
++    Return ``True`` if ``x`` is the complex double field.
++
+     EXAMPLE::
+-    
++
+         sage: from sage.rings.complex_double import is_ComplexDoubleField
+         sage: is_ComplexDoubleField(CDF)
+         True
+@@ -131,22 +133,23 @@ cdef class ComplexDoubleField_class(sage
+     calculations were performed in the true field of complex numbers.
+     This is due to the rounding errors inherent to finite precision
+     calculations.
+-    
+-    ALGORITHMS: Arithmetic is done using GSL (the GNU Scientific
+-    Library).
++
++    ALGORITHM:
++
++    Arithmetic is done using GSL (the GNU Scientific Library).
+     """
+     def __init__(self):
+-        """
++        r"""
+         Construct field of complex double precision numbers.
+-        
++
+         EXAMPLE::
+-        
++
+             sage: from sage.rings.complex_double import ComplexDoubleField_class
+             sage: CDF == ComplexDoubleField_class()
+             True
+             sage: TestSuite(CDF).run(skip = ["_test_prod"])
+ 
+-        .. warning:: due to rounding errors, one can have `x^2 != x*x`::
++        .. WARNING:: due to rounding errors, one can have `x^2 != x*x`::
+ 
+             sage: x = CDF.an_element()
+             sage: x
+@@ -157,11 +160,13 @@ cdef class ComplexDoubleField_class(sage
+         from sage.categories.fields import Fields
+         ParentWithGens.__init__(self, self, ('I',), normalize=False, category = Fields())
+         self._populate_coercion_lists_()
+-        
++
+     def __reduce__(self):
+         """
+-        ::
+-        
++        For pickling.
++
++        EXAMPLES::
++
+             sage: loads(dumps(CDF)) is CDF
+             True
+         """
+@@ -169,26 +174,36 @@ cdef class ComplexDoubleField_class(sage
+ 
+     cpdef bint is_exact(self) except -2:
+         """
+-        Returns whether or not this field is exact, which is always false.
+-        
+-        EXAMPLE::
+-        
++        Returns whether or not this field is exact, which is always ``False``.
++
++        EXAMPLES::
++
+             sage: CDF.is_exact()
+             False
+         """
+         return False
+-        
++
+     def __richcmp__(left, right, int op):
++        """
++        Rich comparison of ``left`` against ``right``.
++
++        EXAMPLES::
++
++            sage: cmp(CDF, CDF)
++            0
++        """
+         return (<Parent>left)._richcmp_helper(right, op)
+-        
++
+     cdef int _cmp_c_impl(left, Parent right) except -2:
+         # There is only one CDF.
+         return cmp(type(left),type(right))
+-    
++
+     def __hash__(self):
+         """
++        Return the hash for ``self``.
++
+         TEST::
+-        
++
+             sage: hash(CDF) % 2^32 == hash(str(CDF)) % 2^32
+             True
+         """
+@@ -197,11 +212,10 @@ cdef class ComplexDoubleField_class(sage
+ 
+     def characteristic(self):
+         """
+-        Return the characteristic of this complex double field, which is
+-        0.
+-        
++        Return the characteristic of the complex double field, which is 0.
++
+         EXAMPLES::
+-        
++
+             sage: CDF.characteristic()
+             0
+         """
+@@ -211,10 +225,10 @@ cdef class ComplexDoubleField_class(sage
+     def random_element(self, double xmin=-1, double xmax=1, double ymin=-1, double ymax=1):
+         """
+         Return a random element of this complex double field with real and
+-        imaginary part bounded by xmin, xmax, ymin, ymax.
+-        
++        imaginary part bounded by ``xmin``, ``xmax``, ``ymin``, ``ymax``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF.random_element()
+             -0.436810529675 + 0.736945423566*I
+             sage: CDF.random_element(-10,10,-10,10)
+@@ -234,38 +248,40 @@ cdef class ComplexDoubleField_class(sage
+     def _repr_(self):
+         """
+         Print out this complex double field.
+-        
++
+         EXAMPLES::
+-        
+-            sage: ComplexDoubleField()
++
++            sage: ComplexDoubleField() # indirect doctest
+             Complex Double Field
+-            sage: CDF
++            sage: CDF # indirect doctest
+             Complex Double Field
+         """
+         return "Complex Double Field"
+-        
++
+     def _latex_(self):
+         r"""
+         Return a LaTeX representation of ``self``.
+-        
++
+         OUTPUT:
+-        
++
+         - a string.
+-        
++
+         TESTS::
+-        
++
+             sage: print CDF._latex_()
+             \Bold{C}
+         """
+         return r"\Bold{C}"
+-    
++
+     def _cmp_(self, x):
+         """
++        Compare ``x`` to ``self``.
++
+         EXAMPLES::
+-        
+-            sage: CDF == 5
++
++            sage: CDF == 5 # indirect doctest
+             False
+-            sage: loads(dumps(CDF)) == CDF
++            sage: loads(dumps(CDF)) == CDF # indirect doctest
+             True
+         """
+         if PY_TYPE_CHECK(x, ComplexDoubleField_class):
+@@ -274,37 +290,37 @@ cdef class ComplexDoubleField_class(sage
+ 
+     def __call__(self, x, im=None):
+         """
+-        Create a complex double using x and optionally an imaginary part
+-        im.
+-        
++        Create a complex double using ``x`` and optionally an imaginary part
++        ``im``.
++
+         EXAMPLES::
+-        
+-            sage: CDF(0,1)
++
++            sage: CDF(0,1) # indirect doctest
+             1.0*I
+-            sage: CDF(2/3)
++            sage: CDF(2/3) # indirect doctest
+             0.666666666667
+-            sage: CDF(5)
++            sage: CDF(5) # indirect doctest
+             5.0
+-            sage: CDF('i')
++            sage: CDF('i') # indirect doctest
+             1.0*I
+-            sage: CDF(complex(2,-3))
++            sage: CDF(complex(2,-3)) # indirect doctest
+             2.0 - 3.0*I
+-            sage: CDF(4.5)
++            sage: CDF(4.5) # indirect doctest
+             4.5
+-            sage: CDF(1+I)
++            sage: CDF(1+I) # indirect doctest
+             1.0 + 1.0*I
+-        
+-        A TypeError is raised if the coercion doesn't make sense::
+-        
++
++        A ``TypeError`` is raised if the coercion doesn't make sense::
++
+             sage: CDF(QQ['x'].0)
+             Traceback (most recent call last):
+             ...
+             TypeError: cannot coerce nonconstant polynomial to float
+-        
++
+         One can convert back and forth between double precision complex
+         numbers and higher-precision ones, though of course there may be
+         loss of precision::
+-        
++
+             sage: a = ComplexField(200)(-2).sqrt(); a
+             1.4142135623730950488016887242096980785696718753769480731767*I
+             sage: b = CDF(a); b
+@@ -316,18 +332,18 @@ cdef class ComplexDoubleField_class(sage
+             sage: b == CC(a)
+             True
+         """
+-        # We implement __call__ to gracefully accept the second argument. 
++        # We implement __call__ to gracefully accept the second argument.
+         if im is not None:
+             x = x, im
+         return Parent.__call__(self, x)
+-        
++
+     def _element_constructor_(self, x):
+         """
+-        See ``__call__``.
+-        
++        See ``__call__()``.
++
+         EXAMPLES::
+-        
+-            sage: CDF((1,2))
++
++            sage: CDF((1,2)) # indirect doctest
+             1.0 + 2.0*I
+         """
+         cdef pari_sp sp
+@@ -359,35 +375,32 @@ cdef class ComplexDoubleField_class(sage
+ 
+     cpdef _coerce_map_from_(self, S):
+         """
+-        Return the canonical coerce of x into the complex double field, if
+-        it is defined, otherwise raise a TypeError.
+-        
++        Return the canonical coerce of `x` into the complex double field, if
++        it is defined, otherwise raise a ``TypeError``.
++
+         The rings that canonically coerce to the complex double field are:
+-        
++
+         - the complex double field itself
+-
+         - anything that canonically coerces to real double field.
+-
+         - mathematical constants
+-
+         - the 53-bit mpfr complex field
+-        
++
+         EXAMPLES::
+-        
+-            sage: CDF._coerce_(5)
++
++            sage: CDF._coerce_(5) # indirect doctest
+             5.0
+             sage: CDF._coerce_(RDF(3.4))
+             3.4
+-        
++
+         Thus the sum of a CDF and a symbolic object is symbolic::
+-        
++
+             sage: a = pi + CDF.0; a
+             pi + 1.0*I
+             sage: parent(a)
+             Symbolic Ring
+-        
++
+         TESTS::
+-        
++
+             sage: CDF(1) + RR(1)
+             2.0
+             sage: CDF.0 - CC(1) - long(1) - RR(1) - QQbar(1)
+@@ -413,10 +426,12 @@ cdef class ComplexDoubleField_class(sage
+ 
+     def _magma_init_(self, magma):
+         r"""
+-        Return a string representation of self in the Magma language.
+-        
++        Return a string representation of ``self`` in the Magma language.
++
+         EXAMPLES::
+-        
++
++            sage: CDF._magma_init_(magma) # optional - magma
++            'ComplexField(53 : Bits := true)'
+             sage: magma(CDF) # optional - magma
+             Complex field of precision 15
+             sage: floor(RR(log(2**53, 10)))
+@@ -429,23 +444,23 @@ cdef class ComplexDoubleField_class(sage
+     def prec(self):
+         """
+         Return the precision of this complex double field (to be more
+-        similar to ComplexField). Always returns 53.
+-        
++        similar to :class:`ComplexField`). Always returns 53.
++
+         EXAMPLES::
+-        
++
+             sage: CDF.prec()
+             53
+         """
+         return 53
+-        
++
+     def to_prec(self, prec):
+         """
+         Returns the complex field to the specified precision. As doubles
+         have fixed precision, this will only return a complex double field
+         if prec is exactly 53.
+-        
++
+         EXAMPLES::
+-        
++
+             sage: CDF.to_prec(53)
+             Complex Double Field
+             sage: CDF.to_prec(250)
+@@ -463,24 +478,24 @@ cdef class ComplexDoubleField_class(sage
+         Return the generator of the complex double field.
+ 
+         EXAMPLES::
+-        
++
+             sage: CDF.0
+             1.0*I
+-            sage: CDF.gens()
+-            (1.0*I,)
++            sage: CDF.gen(0)
++            1.0*I
+         """
+         if n != 0:
+             raise ValueError, "only 1 generator"
+         return I
+ 
+     def ngens(self):
+-        """
+-        The number of generators of this complex field as an RR-algebra.
+-        
+-        There is one generator, namely sqrt(-1).
+-        
++        r"""
++        The number of generators of this complex field as an `\RR`-algebra.
++
++        There is one generator, namely ``sqrt(-1)``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF.ngens()
+             1
+         """
+@@ -488,7 +503,7 @@ cdef class ComplexDoubleField_class(sage
+ 
+     def algebraic_closure(self):
+         r"""
+-        Returns the algebraic closure of self, i.e., the complex double
++        Returns the algebraic closure of ``self``, i.e., the complex double
+         field.
+ 
+         EXAMPLES::
+@@ -512,11 +527,11 @@ cdef class ComplexDoubleField_class(sage
+         return real_double.RDF
+ 
+     def pi(self):
+-        """
+-        Returns pi as a double precision complex number.
+-        
++        r"""
++        Returns `\pi` as a double precision complex number.
++
+         EXAMPLES::
+-        
++
+             sage: CDF.pi()
+             3.14159265359
+         """
+@@ -524,11 +539,11 @@ cdef class ComplexDoubleField_class(sage
+ 
+     def construction(self):
+         """
+-        Returns the functorial construction of self, namely, algebraic
++        Returns the functorial construction of ``self``, namely, algebraic
+         closure of the real double field.
+-        
++
+         EXAMPLES::
+-        
++
+             sage: c, S = CDF.construction(); S
+             Real Double Field
+             sage: CDF == c(S)
+@@ -538,31 +553,29 @@ cdef class ComplexDoubleField_class(sage
+         return (AlgebraicClosureFunctor(), self.real_double_field())
+ 
+     def zeta(self, n=2):
+-        """
++        r"""
+         Return a primitive `n`-th root of unity in this CDF, for
+-        `n\ge1`.
+-        
++        `n \geq 1`.
++
+         INPUT:
+-        
+-        
+-        -  ``n`` - a positive integer (default: 2)
+-        
+-        
+-        OUTPUT: a complex n-th root of unity.
+-        
++
++        -  ``n`` -- a positive integer (default: 2)
++
++        OUTPUT: a complex `n`-th root of unity.
++
+         EXAMPLES::
+-        
++
+             sage: CDF.zeta(7)
+             0.623489801859 + 0.781831482468*I
+             sage: CDF.zeta(1)
+-            1.0     
++            1.0
+             sage: CDF.zeta()
+             -1.0
+             sage: CDF.zeta() == CDF.zeta(2)
+             True
+-        
++
+         ::
+-        
++
+             sage: CDF.zeta(0.5)
+             Traceback (most recent call last):
+             ...
+@@ -601,7 +614,7 @@ cdef class ComplexDoubleField_class(sage
+ 
+ cdef ComplexDoubleElement new_ComplexDoubleElement():
+     """
+-    Creates a new (empty) ComplexDoubleElement.
++    Creates a new (empty) :class:`ComplexDoubleElement`.
+     """
+     cdef ComplexDoubleElement z
+     z = PY_NEW(ComplexDoubleElement)
+@@ -609,10 +622,10 @@ cdef ComplexDoubleElement new_ComplexDou
+ 
+ def is_ComplexDoubleElement(x):
+     """
+-    Return True if x is a is_ComplexDoubleElement.
+-    
++    Return ``True`` if ``x`` is a :class:`ComplexDoubleElement`.
++
+     EXAMPLES::
+-    
++
+         sage: from sage.rings.complex_double import is_ComplexDoubleElement
+         sage: is_ComplexDoubleElement(0)
+         False
+@@ -629,19 +642,27 @@ cdef class ComplexDoubleElement(FieldEle
+     calculations were performed with true complex numbers. This is due
+     to the rounding errors inherent to finite precision calculations.
+     """
+-    
++
+     __array_interface__ = {'typestr': '=c16'}
+-    
++
+     def __cinit__(self):
++        r"""
++        Initialize ``self`` as an element of `\CC`.
++
++        EXAMPLES::
++
++            sage: ComplexDoubleElement(1,-2) # indirect doctest
++            1.0 - 2.0*I
++        """
+         self._parent = _CDF
+-        
++
+     def __init__(self, real, imag):
+         """
+         Constructs an element of a complex double field with specified real
+         and imaginary values.
+-        
+-        EXAMPLE::
+-        
++
++        EXAMPLES::
++
+             sage: ComplexDoubleElement(1,-2)
+             1.0 - 2.0*I
+         """
+@@ -649,8 +670,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __reduce__(self):
+         """
++        For pickling.
++
+         EXAMPLES::
+-        
++
+             sage: a = CDF(-2.7, -3)
+             sage: loads(dumps(a)) == a
+             True
+@@ -660,8 +683,8 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     cdef ComplexDoubleElement _new_c(self, gsl_complex x):
+         """
+-        C-level code for creating a ComplexDoubleElement from a
+-        gsl_complex.
++        C-level code for creating a :class:`ComplexDoubleElement` from a
++        ``gsl_complex``.
+         """
+         cdef ComplexDoubleElement z = <ComplexDoubleElement>PY_NEW(ComplexDoubleElement)
+         z._complex = x
+@@ -669,15 +692,14 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     cdef _new_from_gen_c(self, GEN g, pari_sp sp):
+         """
+-        C-level code for creating a ComplexDoubleElement from a PARI gen.
+-        
++        C-level code for creating a :class:`ComplexDoubleElement` from a
++        PARI gen.
++
+         INPUT:
+-        
+-        
+-        -  ``g`` - GEN
+-        
+-        -  ``sp`` - stack pointer; if nonzero resets avma to
+-           sp.
++
++        -  ``g`` -- GEN
++
++        -  ``sp`` -- stack pointer; if nonzero resets avma to sp.
+         """
+         cdef gsl_complex x
+         sig_on()
+@@ -691,11 +713,11 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __hash__(self):
+         """
+-        Returns the hash of self, which coincides with the python float and
+-        complex (and often int) types for self.
+-        
+-        EXAMPLE::
+-        
++        Returns the hash of ``self``, which coincides with the python ``float``
++        and ``complex`` (and often ``int``) types for ``self``.
++
++        EXAMPLES::
++
+             sage: hash(CDF(1.2)) == hash(1.2r)
+             True
+             sage: hash(CDF(-1))
+@@ -706,33 +728,44 @@ cdef class ComplexDoubleElement(FieldEle
+         return hash(complex(self))
+ 
+     def __richcmp__(left, right, int op):
++        """
++        Rich comparison between ``left`` and ``right``.
++
++        EXAMPLES::
++
++            sage: cmp(CDF(1.2), CDF(i))
++            1
++            sage: cmp(CDF(1), CDF(2))
++            -1
++            sage: cmp(CDF(1 + i), CDF(-1 - i))
++            1
++        """
+         return (<Element>left)._richcmp(right, op)
++
+     cdef int _cmp_c_impl(left, Element right) except -2:
+         """
+         We order the complex numbers in dictionary order by real parts then
+         imaginary parts.
+-        
++
+         This order, of course, does not respect the field structure, though
+         it agrees with the usual order on the real numbers.
+-        
++
+         EXAMPLES::
+-        
++
+             sage: CDF(2,3) < CDF(3,1)
+             True
+             sage: CDF(2,3) > CDF(3,1)
+             False
+             sage: CDF(2,-1) < CDF(2,3)
+             True
+-        
++
+         It's dictionary order, not absolute value::
+-        
++
+             sage: CDF(-1,3) < CDF(-1,-20)
+             False
+-        
+-        Numbers are coerced before comparison.
+-        
+-        ::
+-        
++
++        Numbers are coerced before comparison::
++
+             sage: CDF(3,5) < 7
+             True
+             sage: 4.3 > CDF(5,1)
+@@ -750,18 +783,16 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __getitem__(self, n):
+         """
+-        Returns the real or imaginary part of self.
+-        
++        Returns the real or imaginary part of ``self``.
++
+         INPUT:
+-        
+-        
+-        -  ``n`` - integer (either 0 or 1)
+-        
+-        
+-        Raises an IndexError if n 0 or n 1.
+-        
++
++        -  ``n`` -- integer (either 0 or 1)
++
++        Raises an ``IndexError`` if ``n`` is not 0 or 1.
++
+         EXAMPLES::
+-        
++
+             sage: P = CDF(2,3)
+             sage: P[0]
+             2.0
+@@ -778,11 +809,15 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def _magma_init_(self, magma):
+         r"""
++        Return the magma representation of ``self``.
++
+         EXAMPLES::
+-        
+-            sage: magma(CDF(1.2, 0.3)) # optional - magma
++
++            sage: CDF((1.2, 0.3))._magma_init_(magma) # optional - magma
++            'ComplexField(53 : Bits := true)![1.2, 0.3]'
++            sage: magma(CDF(1.2, 0.3)) # optional - magma # indirect doctest
+             1.20000000000000 + 0.300000000000000*$.1
+-            sage: s = magma(CDF(1.2, 0.3)).sage(); s # optional - magma
++            sage: s = magma(CDF(1.2, 0.3)).sage(); s # optional - magma # indirect doctest
+             1.20000000000000 + 0.300000000000000*I
+             sage: s.parent() # optional - magma
+             Complex Field with 53 bits of precision
+@@ -792,10 +827,10 @@ cdef class ComplexDoubleElement(FieldEle
+     def prec(self):
+         """
+         Returns the precision of this number (to be more similar to
+-        ComplexNumber). Always returns 53.
+-        
++        :class:`ComplexNumber`). Always returns 53.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(0).prec()
+             53
+         """
+@@ -807,8 +842,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __int__(self):
+         """
++        Convert ``self`` to an ``int``.
++
+         EXAMPLES::
+-        
++
+             sage: int(CDF(1,1))
+             Traceback (most recent call last):
+             ...
+@@ -820,8 +857,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __long__(self):
+         """
++        Convert ``self`` to a ``long``.
++
+         EXAMPLES::
+-        
++
+             sage: long(CDF(1,1))
+             Traceback (most recent call last):
+             ...
+@@ -833,12 +872,12 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __float__(self):
+         """
+-        Method for converting self to type float. Called by the
++        Method for converting ``self`` to type ``float``. Called by the
+         ``float`` function.  This conversion will throw an error if
+         the number has a nonzero imaginary part.
+-        
++
+         EXAMPLES::
+-        
++
+             sage: a = CDF(1, 0)
+             sage: float(a)
+             1.0
+@@ -860,8 +899,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __complex__(self):
+         """
++        Convert ``self`` to python's ``complex`` object.
++
+         EXAMPLES::
+-        
++
+             sage: a = complex(2303,-3939)
+             sage: CDF(a)
+             2303.0 - 3939.0*I
+@@ -872,12 +913,12 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def _interface_init_(self, I=None):
+         """
+-        Returns self formatted as a string, suitable as input to another
++        Returns ``self`` formatted as a string, suitable as input to another
+         computer algebra system. (This is the default function used for
+         exporting to other computer algebra systems.)
+-        
++
+         EXAMPLES::
+-        
++
+             sage: s1 = CDF(exp(I)); s1
+             0.540302305868 + 0.841470984808*I
+             sage: s1._interface_init_()
+@@ -904,11 +945,11 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __repr__(self):
+         """
+-        Return print version of self.
+-        
++        Return print version of ``self``.
++
+         EXAMPLES::
+-        
+-            sage: a = CDF(2,-3); a
++
++            sage: a = CDF(2,-3); a # indirect doctest
+             2.0 - 3.0*I
+             sage: a^2
+             -5.0 - 12.0*I
+@@ -938,7 +979,7 @@ cdef class ComplexDoubleElement(FieldEle
+                 s = ''
+             else:
+                 return double_to_str(self._complex.dat[0]) # imag is zero
+-            
++
+         cdef double y = self._complex.dat[1]
+         if y:
+             if s != "":
+@@ -953,8 +994,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def _latex_(self):
+         """
++        Return a latex representation of ``self``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1, 2)._latex_()
+             '1.0 + 2.0i'
+             sage: z = CDF(1,2)^100
+@@ -975,10 +1018,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def _pari_(self):
+         """
+-        Return PARI version of self.
+-        
++        Return PARI version of ``self``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,2)._pari_()
+             1.00000000000000 + 2.00000000000000*I
+             sage: pari(CDF(1,2))
+@@ -996,15 +1039,15 @@ cdef class ComplexDoubleElement(FieldEle
+         return x
+ 
+     #######################################################################
+-    # Arithmetic 
++    # Arithmetic
+     #######################################################################
+ 
+     cpdef ModuleElement _add_(self, ModuleElement right):
+         """
+-        Add self and right.
+-        
++        Add ``self`` and ``right``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(2,-3)._add_(CDF(1,-2))
+             3.0 - 5.0*I
+         """
+@@ -1013,10 +1056,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     cpdef ModuleElement _sub_(self, ModuleElement right):
+         """
+-        Subtract self and right.
+-        
++        Subtract ``self`` and ``right``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(2,-3)._sub_(CDF(1,-2))
+             1.0 - 1.0*I
+         """
+@@ -1025,10 +1068,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     cpdef RingElement _mul_(self, RingElement right):
+         """
+-        Multiply self and right.
+-        
++        Multiply ``self`` and ``right``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(2,-3)._mul_(CDF(1,-2))
+             -4.0 - 7.0*I
+         """
+@@ -1037,10 +1080,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     cpdef RingElement _div_(self, RingElement right):
+         """
+-        Divide self by right.
+-        
++        Divide ``self`` by ``right``.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(2,-3)._div_(CDF(1,-2))
+             1.6 + 0.2*I
+         """
+@@ -1049,23 +1092,21 @@ cdef class ComplexDoubleElement(FieldEle
+     def __invert__(self):
+         r"""
+         This function returns the inverse, or reciprocal, of the complex
+-        number `z`,
+-        
+-        .. math::
+-        
++        number `z`:
++
++        .. MATH::
++
+             1/z = (x - i y)/(x^2 + y^2).
+-        
+-        
+-        
++
+         EXAMPLES::
+-        
++
+             sage: ~CDF(2,1)
+             0.4 - 0.2*I
+             sage: 1/CDF(2,1)
+             0.4 - 0.2*I
+-        
+-        The inverse of 0 is nan (it doesn't raise an exception)::
+-        
++
++        The inverse of 0 is ``NaN`` (it doesn't raise an exception)::
++
+             sage: ~(0*CDF(0,1))
+             NaN + NaN*I
+         """
+@@ -1073,27 +1114,29 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     cpdef ModuleElement _neg_(self):
+         """
+-        This function returns the negative of the complex number
+-        `z`, 
+-        .. math::
+-        
++        This function returns the negative of the complex number `z`:
++
++        .. MATH::
++
+             -z = (-x) + i(-y).
+-        
+-        
++
+         EXAMPLES::
+-        
+-            sage: -CDF(2,1)
++
++            sage: -CDF(2,1) # indirect doctest
+             -2.0 - 1.0*I
+         """
+         return self._new_c(gsl_complex_negative(self._complex))
+ 
+     def conjugate(self):
+         r"""
+-        This function returns the complex conjugate of the complex number
+-        `z`, `\overline{z} = x - i y`.
+-        
++        This function returns the complex conjugate of the complex number `z`:
++
++        .. MATH::
++
++            \overline{z} = x - i y.
++
+         EXAMPLES::
+-        
++
+             sage: z = CDF(2,3); z.conjugate()
+             2.0 - 3.0*I
+         """
+@@ -1101,11 +1144,14 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def conj(self):
+         r"""
+-        This function returns the complex conjugate of the complex number
+-        `z`, `\overline{z} = x - i y`.
+-        
++        This function returns the complex conjugate of the complex number `z`:
++
++        .. MATH::
++
++            \overline{z} = x - i y.
++
+         EXAMPLES::
+-        
++
+             sage: z = CDF(2,3); z.conj()
+             2.0 - 3.0*I
+         """
+@@ -1117,12 +1163,11 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def arg(self):
+         r"""
+-        This function returns the argument of the complex number
+-        `z`, `\arg(z)`, where
+-        `-\pi < \arg(z) <= \pi`.
+-        
++        This function returns the argument of ``self``, the complex number
++        `z`, denoted by `\arg(z)`, where `-\pi < \arg(z) <= \pi`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,0).arg()
+             0.0
+             sage: CDF(0,1).arg()
+@@ -1136,14 +1181,13 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def __abs__(self):
+         """
+-        This function returns the magnitude of the complex number
+-        `z`, `|z|`.
+-        
++        This function returns the magnitude of the complex number `z`, `|z|`.
++
+         EXAMPLES::
+-        
+-            sage: abs(CDF(1,2))
++
++            sage: abs(CDF(1,2)) # indirect doctest
+             2.2360679775
+-            sage: abs(CDF(1,0))
++            sage: abs(CDF(1,0)) # indirect doctest
+             1.0
+             sage: abs(CDF(-2,3))   # slightly random-ish arch dependent output
+             3.6055512754639891
+@@ -1152,27 +1196,26 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def abs(self):
+         """
+-        This function returns the magnitude `|z|` of the complex number
+-        `z`.
++        This function returns the magnitude `|z|` of the complex number `z`.
+ 
+         .. SEEALSO::
+ 
+             - :meth:`norm`
+-        
++
+         EXAMPLES::
+-        
++
+             sage: CDF(2,3).abs()   # slightly random-ish arch dependent output
+             3.6055512754639891
+         """
+         return RealDoubleElement(gsl_complex_abs(self._complex))
+-        
++
+     def argument(self):
+         r"""
+-        This function returns the argument of the self, in the interval
+-        `-\pi < arg(self) \le \pi`.
+-        
++        This function returns the argument of the ``self``, the complex number
++        `z`, in the interval `-\pi < arg(z) \leq \pi`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(6).argument()
+             0.0
+             sage: CDF(i).argument()
+@@ -1205,8 +1248,8 @@ cdef class ComplexDoubleElement(FieldEle
+         This function returns the squared magnitude `|z|^2` of the complex
+         number `z`, otherwise known as the complex norm. If `c = a + bi`
+         is a complex number, then the norm of `c` is defined as the product of
+-        `c` and its complex conjugate
+-        
++        `c` and its complex conjugate:
++
+         .. MATH::
+ 
+             \text{norm}(c)
+@@ -1244,21 +1287,20 @@ cdef class ComplexDoubleElement(FieldEle
+         r"""
+         This function returns the natural logarithm of the magnitude of the
+         complex number `z`, `\log|z|`.
+-        
+-        This allows for an accurate evaluation of `\log|z|` when
+-        `|z|` is close to `1`. The direct evaluation of
+-        ``log(abs(z))`` would lead to a loss of precision in
+-        this case.
+-        
++
++        This allows for an accurate evaluation of `\log|z|` when `|z|` is
++        close to `1`. The direct evaluation of ``log(abs(z))`` would lead
++        to a loss of precision in this case.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1.1,0.1).logabs()
+             0.0994254293726
+             sage: log(abs(CDF(1.1,0.1)))
+             0.0994254293726
+-        
++
+         ::
+-        
++
+             sage: log(abs(ComplexField(200)(1.1,0.1)))
+             0.099425429372582595066319157757531449594489450091985182495705
+         """
+@@ -1298,10 +1340,10 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def parent(self):
+         """
+-        Return the complex double field, which is the parent of self.
+-        
++        Return the complex double field, which is the parent of ``self``.
++
+         EXAMPLES::
+-        
++
+             sage: a = CDF(2,3)
+             sage: a.parent()
+             Complex Double Field
+@@ -1317,21 +1359,19 @@ cdef class ComplexDoubleElement(FieldEle
+     def sqrt(self, all=False, **kwds):
+         r"""
+         The square root function.
+-        
++
+         INPUT:
+-        
+-        
+-        -  ``all`` - bool (default: False); if True, return a
++
++        -  ``all`` - bool (default: ``False``); if ``True``, return a
+            list of all square roots.
+-        
+-        
+-        If all is False, the branch cut is the negative real axis. The
++
++        If all is ``False``, the branch cut is the negative real axis. The
+         result always lies in the right half of the complex plane.
+-        
+-        EXAMPLES: We compute several square roots.
+-        
+-        ::
+-        
++
++        EXAMPLES:
++
++        We compute several square roots::
++
+             sage: a = CDF(2,3)
+             sage: b = a.sqrt(); b
+             1.67414922804 + 0.89597747613*I
+@@ -1339,17 +1379,15 @@ cdef class ComplexDoubleElement(FieldEle
+             2.0 + 3.0*I
+             sage: a^(1/2)
+             1.67414922804 + 0.89597747613*I
+-        
+-        We compute the square root of -1.
+-        
+-        ::
+-        
++
++        We compute the square root of -1::
++
+             sage: a = CDF(-1)
+             sage: a.sqrt()
+             1.0*I
+-        
++
+         We compute all square roots::
+-        
++
+             sage: CDF(-2).sqrt(all=True)
+             [1.41421356237*I, -1.41421356237*I]
+             sage: CDF(0).sqrt(all=True)
+@@ -1362,20 +1400,18 @@ cdef class ComplexDoubleElement(FieldEle
+              else:
+                  return [z, -z]
+         return z
+-        
++
+     def nth_root(self, n, all=False):
+         """
+-        The n-th root function.
+-        
++        The ``n``-th root function.
++
+         INPUT:
+-        
+-        
+-        -  ``all`` - bool (default: False); if True, return a
+-           list of all n-th roots.
+-        
+-        
++
++        -  ``all`` -- bool (default: ``False``); if ``True``, return a
++           list of all ``n``-th roots.
++
+         EXAMPLES::
+-        
++
+             sage: a = CDF(125)
+             sage: a.nth_root(3)
+             5.0
+@@ -1396,14 +1432,13 @@ cdef class ComplexDoubleElement(FieldEle
+         else:
+             return z
+ 
+-        
++
+     def is_square(self):
+-        """
+-        This function always returns true as `\CC` is algebraically
+-        closed.
+-        
++        r"""
++        This function always returns ``True`` as `\CC` is algebraically closed.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(-1).is_square()
+             True
+         """
+@@ -1413,49 +1448,47 @@ cdef class ComplexDoubleElement(FieldEle
+         """
+         The function returns the complex number `z` raised to the
+         complex power `a`, `z^a`.
+-        
++
+         INPUT:
+-        
+-        
+-        -  ``self, a`` - both of type ComplexDoubleElement
+-        
+-        
+-        OUTPUT: ComplexDoubleElement
+-        
++
++        -  ``a`` - a :class:`ComplexDoubleElement`
++
++        OUTPUT: :class:`ComplexDoubleElement`
++
+         EXAMPLES::
+-        
++
+             sage: a = CDF(1,1); b = CDF(2,3)
+             sage: a._pow_(b)
+             -0.163450932107 + 0.0960049836089*I
+         """
+         return self._new_c(gsl_complex_pow(self._complex, a._complex))
+-    
++
+     def __pow__(z, a, dummy):
+         r"""
+         The function returns the complex number `z` raised to the
+         complex power `a`, `z^a`.
+-        
++
+         This is computed as `\exp(\log(z)*a)` using complex
+         logarithms and complex exponentials.
+-        
++
+         EXAMPLES::
+-        
++
+             sage: a = CDF(1,1); b = CDF(2,3)
+-            sage: c = a^b; c
++            sage: c = a^b; c # indirect doctest
+             -0.163450932107 + 0.0960049836089*I
+             sage: c^(1/b)
+             1.0 + 1.0*I
+-        
++
+         We compute the cube root of `-1` then cube it and observe a
+         rounding error::
+-        
++
+             sage: a = CDF(-1)^(1/3); a
+             0.5 + 0.866025403784*I
+             sage: a^3                  # slightly random-ish arch dependent output
+             -1.0 + 1.22460635382e-16*I
+-        
++
+         We raise to symbolic powers::
+-        
++
+             sage: x, n = var('x, n')
+             sage: CDF(1.2)^x
+             1.2^x
+@@ -1476,23 +1509,20 @@ cdef class ComplexDoubleElement(FieldEle
+                     return a.parent()(z)**a
+                 except AttributeError:
+                     raise TypeError
+-                
++
+ 
+     def exp(self):
+         r"""
+         This function returns the complex exponential of the complex number
+         `z`, `\exp(z)`.
+-        
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).exp()
+             1.46869393992 + 2.28735528718*I
+-        
+-        We numerically verify a famous identity to the precision of a
+-        double.
+-        
+-        ::
+-        
++
++        We numerically verify a famous identity to the precision of a double::
++
+             sage: z = CDF(0, 2*pi); z
+             6.28318530718*I
+             sage: exp(z)         # somewhat random-ish output depending on platform
+@@ -1505,16 +1535,13 @@ cdef class ComplexDoubleElement(FieldEle
+         This function returns the complex natural logarithm to the given
+         base of the complex number `z`, `\log(z)`. The
+         branch cut is the negative real axis.
+-        
++
+         INPUT:
+-        
+-        
+-        -  ``base`` - default: e, the base of the natural
+-           logarithm
+-        
+-        
++
++        -  ``base`` - default: `e`, the base of the natural logarithm
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).log()
+             0.34657359028 + 0.785398163397*I
+ 
+@@ -1577,11 +1604,14 @@ cdef class ComplexDoubleElement(FieldEle
+     #######################################################################
+     def sin(self):
+         r"""
+-        This function returns the complex sine of the complex number
+-        `z`, `\sin(z) = (\exp(iz) - \exp(-iz))/(2i)`.
+-        
++        This function returns the complex sine of the complex number `z`:
++
++        .. MATH::
++
++            \sin(z) = \frac{e^{iz} - e^{-iz}}{2i}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).sin()
+             1.29845758142 + 0.634963914785*I
+         """
+@@ -1589,11 +1619,14 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def cos(self):
+         r"""
+-        This function returns the complex cosine of the complex number z,
+-        `\cos(z) = (\exp(iz) + \exp(-iz))/2`.
+-        
++        This function returns the complex cosine of the complex number `z`:
++
++        .. MATH::
++
++            \cos(z) = \frac{e^{iz} + e^{-iz}}{2}
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).cos()
+             0.833730025131 - 0.988897705763*I
+         """
+@@ -1601,11 +1634,14 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def tan(self):
+         r"""
+-        This function returns the complex tangent of the complex number z,
+-        `\tan(z) = \sin(z)/\cos(z)`.
+-        
++        This function returns the complex tangent of the complex number `z`:
++
++        .. MATH::
++
++            \tan(z) = \frac{\sin(z)}{\cos(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).tan()
+             0.27175258532 + 1.08392332734*I
+         """
+@@ -1613,11 +1649,14 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def sec(self):
+         r"""
+-        This function returns the complex secant of the complex number
+-        `z`, `{\rm sec}(z) = 1/\cos(z)`.
+-        
++        This function returns the complex secant of the complex number `z`:
++
++        .. MATH::
++
++            {\rm sec}(z) = \frac{1}{\cos(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).sec()
+             0.498337030555 + 0.591083841721*I
+         """
+@@ -1625,11 +1664,14 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def csc(self):
+         r"""
+-        This function returns the complex cosecant of the complex number
+-        `z`, `\csc(z) = 1/\sin(z)`.
+-        
++        This function returns the complex cosecant of the complex number `z`:
++
++        .. MATH::
++
++            \csc(z) = \frac{1}{\sin(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).csc()
+             0.62151801717 - 0.303931001628*I
+         """
+@@ -1637,16 +1679,19 @@ cdef class ComplexDoubleElement(FieldEle
+ 
+     def cot(self):
+         r"""
+-        This function returns the complex cotangent of the complex number
+-        `z`, `\cot(z) = 1/\tan(z)`.
+-        
++        This function returns the complex cotangent of the complex number `z`:
++
++        .. MATH::
++
++            \cot(z) = \frac{1}{\tan(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).cot()
+             0.217621561854 - 0.868014142896*I
+         """
+         return self._new_c(gsl_complex_cot(self._complex))
+-    
++
+     #######################################################################
+     # Inverse Complex Trigonometric Functions
+     #######################################################################
+@@ -1705,37 +1750,45 @@ cdef class ComplexDoubleElement(FieldEle
+         r"""
+         This function returns the complex arccotangent of the complex
+         number `z`, `{\rm arccot}(z) = {\rm arctan}(1/z).`
+-        
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).arccot()
+             0.553574358897 - 0.402359478109*I
+         """
+         return self._new_c(gsl_complex_arccot(self._complex))
+ 
+-    
++
+     #######################################################################
+     # Complex Hyperbolic Functions
+     #######################################################################
+     def sinh(self):
+         r"""
+         This function returns the complex hyperbolic sine of the complex
+-        number `z`, `\sinh(z) = (\exp(z) - \exp(-z))/2`.
+-        
++        number `z`:
++
++        .. MATH::
++
++            \sinh(z) = \frac{e^z - e^{-z}}{2}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).sinh()
+             0.634963914785 + 1.29845758142*I
+         """
+         return self._new_c(gsl_complex_sinh(self._complex))
+-    
++
+     def cosh(self):
+         r"""
+         This function returns the complex hyperbolic cosine of the complex
+-        number `z`, `\cosh(z) = (\exp(z) + \exp(-z))/2`.
+-        
++        number `z`:
++
++        .. MATH::
++
++            \cosh(z) = \frac{e^z + e^{-z}}{2}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).cosh()
+             0.833730025131 + 0.988897705763*I
+         """
+@@ -1744,10 +1797,14 @@ cdef class ComplexDoubleElement(FieldEle
+     def tanh(self):
+         r"""
+         This function returns the complex hyperbolic tangent of the complex
+-        number `z`, `\tanh(z) = \sinh(z)/\cosh(z)`.
+-        
++        number `z`:
++
++        .. MATH::
++
++            \tanh(z) = \frac{\sinh(z)}{\cosh(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).tanh()
+             1.08392332734 + 0.27175258532*I
+         """
+@@ -1757,10 +1814,14 @@ cdef class ComplexDoubleElement(FieldEle
+     def sech(self):
+         r"""
+         This function returns the complex hyperbolic secant of the complex
+-        number `z`, `{\rm sech}(z) = 1/{\rm cosh}(z)`.
+-        
++        number `z`:
++
++        .. MATH::
++
++            {\rm sech}(z) = \frac{1}{{\rm cosh}(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).sech()
+             0.498337030555 - 0.591083841721*I
+         """
+@@ -1769,11 +1830,14 @@ cdef class ComplexDoubleElement(FieldEle
+     def csch(self):
+         r"""
+         This function returns the complex hyperbolic cosecant of the
+-        complex number `z`,
+-        `{\rm csch}(z) = 1/{\rm sinh}(z)`.
+-        
++        complex number `z`:
++
++        .. MATH::
++
++            {\rm csch}(z) = \frac{1}{{\rm sinh}(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).csch()
+             0.303931001628 - 0.62151801717*I
+         """
+@@ -1782,29 +1846,33 @@ cdef class ComplexDoubleElement(FieldEle
+     def coth(self):
+         r"""
+         This function returns the complex hyperbolic cotangent of the
+-        complex number `z`, `\coth(z) = 1/\tanh(z)`.
+-        
++        complex number `z`:
++
++        .. MATH::
++
++            \coth(z) = \frac{1}{\tanh(z)}.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).coth()
+             0.868014142896 - 0.217621561854*I
+         """
+         return self._new_c(gsl_complex_coth(self._complex))
+-    
++
+     #######################################################################
+-    # Inverse Complex Hyperbolic Functions    
++    # Inverse Complex Hyperbolic Functions
+     #######################################################################
+     def arcsinh(self):
+         r"""
+         This function returns the complex hyperbolic arcsine of the complex
+         number `z`, `{\rm arcsinh}(z)`. The branch cuts are
+-        on the imaginary axis, below -i and above i.
+-        
++        on the imaginary axis, below `-i` and above `i`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).arcsinh()
+             1.06127506191 + 0.666239432493*I
+-        """        
++        """
+         return self._new_c(gsl_complex_arcsinh(self._complex))
+ 
+     def arccosh(self):
+@@ -1836,11 +1904,10 @@ cdef class ComplexDoubleElement(FieldEle
+     def arcsech(self):
+         r"""
+         This function returns the complex hyperbolic arcsecant of the
+-        complex number `z`,
+-        `{\rm arcsech}(z) = {\rm arccosh}(1/z)`.
+-        
++        complex number `z`, `{\rm arcsech}(z) = {\rm arccosh}(1/z)`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).arcsech()
+             0.530637530953 - 1.11851787964*I
+         """
+@@ -1849,11 +1916,10 @@ cdef class ComplexDoubleElement(FieldEle
+     def arccsch(self):
+         r"""
+         This function returns the complex hyperbolic arccosecant of the
+-        complex number `z`,
+-        `{\rm arccsch}(z) = {\rm arcsin}(1/z)`.
+-        
++        complex number `z`, `{\rm arccsch}(z) = {\rm arcsin}(1/z)`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).arccsch()
+             0.530637530953 - 0.452278447151*I
+         """
+@@ -1862,11 +1928,10 @@ cdef class ComplexDoubleElement(FieldEle
+     def arccoth(self):
+         r"""
+         This function returns the complex hyperbolic arccotangent of the
+-        complex number `z`,
+-        `{\rm arccoth}(z) = {\rm arctanh(1/z)}`.
+-        
++        complex number `z`, `{\rm arccoth}(z) = {\rm arctanh(1/z)}`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,1).arccoth()
+             0.402359478109 - 0.553574358897*I
+         """
+@@ -1880,91 +1945,79 @@ cdef class ComplexDoubleElement(FieldEle
+         Return the value of the Dedekind `\eta` function on self,
+         intelligently computed using `\mathbb{SL}(2,\ZZ)`
+         transformations.
+-        
++
+         INPUT:
+-        
+-        
++
+         -  ``self`` - element of the upper half plane (if not,
+            raises a ValueError).
+-        
+-        -  ``omit_frac`` - (bool, default: False), if True,
++
++        -  ``omit_frac`` - (bool, default: ``False``), if ``True``,
+            omit the `e^{\pi i z / 12}` factor.
+-        
+-        
++
+         OUTPUT: a complex double number
+-        
++
+         ALGORITHM: Uses the PARI C library, but with some modifications so
+         it always works instead of failing on easy cases involving large
+         input (like PARI does).
+-        
++
+         The `\eta` function is
+-        
+-        .. math::
+-        
+-                        \eta(z) = e^{\pi i z / 12} \prod_{n=1}^{\infty} (1 - e^{2\pi inz})         
+-        
+-        
+-        
+-        EXAMPLES: We compute a few values of eta::
+-        
++
++        .. MATH::
++
++            \eta(z) = e^{\pi i z / 12} \prod_{n=1}^{\infty} (1 - e^{2\pi inz})
++
++        EXAMPLES:
++
++        We compute a few values of :meth:`eta()`::
++
+             sage: CDF(0,1).eta()
+             0.768225422326
+             sage: CDF(1,1).eta()
+             0.742048775837 + 0.19883137023*I
+             sage: CDF(25,1).eta()
+             0.742048775837 + 0.19883137023*I
+-        
+-        Eta works even if the inputs are large.
+-        
+-        ::
+-        
++
++        :meth:`eta()` works even if the inputs are large::
++
+             sage: CDF(0,10^15).eta()
+             0.0
+             sage: CDF(10^15,0.1).eta()     # slightly random-ish arch dependent output
+-            -0.121339721991 - 0.19619461894*I   
+-        
+-        We compute a few values of eta, but with the fractional power of e
+-        omitted.
+-        
+-        ::
+-        
++            -0.121339721991 - 0.19619461894*I
++
++        We compute a few values of :meth:`eta()`, but with the fractional power
++        of `e` omitted::
++
+             sage: CDF(0,1).eta(True)
+             0.998129069926
+-        
+-        We compute eta to low precision directly from the definition.
+-        
+-        ::
+-        
++
++        We compute :meth:`eta()` to low precision directly from the
++        definition::
++
+             sage: z = CDF(1,1); z.eta()
+             0.742048775837 + 0.19883137023*I
+             sage: i = CDF(0,1); pi = CDF(pi)
+             sage: exp(pi * i * z / 12) * prod([1-exp(2*pi*i*n*z) for n in range(1,10)])
+             0.742048775837 + 0.19883137023*I
+-        
++
+         The optional argument allows us to omit the fractional part::
+-        
++
+             sage: z = CDF(1,1)
+             sage: z.eta(omit_frac=True)
+             0.998129069926
+             sage: pi = CDF(pi)
+             sage: prod([1-exp(2*pi*i*n*z) for n in range(1,10)])      # slightly random-ish arch dependent output
+-            0.998129069926 + 4.5908467128e-19*I  
+-        
+-        We illustrate what happens when `z` is not in the upper
+-        half plane.
+-        
+-        ::
+-        
++            0.998129069926 + 4.5908467128e-19*I
++
++        We illustrate what happens when `z` is not in the upper half plane::
++
+             sage: z = CDF(1)
+             sage: z.eta()
+             Traceback (most recent call last):
+             ...
+             ValueError: value must be in the upper half plane
+-        
+-        You can also use functional notation.
+-        
+-        ::
+-        
++
++        You can also use functional notation::
++
+             sage: z = CDF(1,1) ; eta(z)
+             0.742048775837 + 0.19883137023*I
+         """
+@@ -2005,11 +2058,11 @@ cdef class ComplexDoubleElement(FieldEle
+         # and similar remarks apply.
+         cdef double dummy
+         a = dbltor(modf(self._complex.dat[0], &dummy))    # see big comment above
+-        b = dbltor(self._complex.dat[1])  
++        b = dbltor(self._complex.dat[1])
+ 
+         y = cgetg(3, t_COMPLEX)    # allocate space for a complex number
+         set_gel(y,1,a); set_gel(y,2,b)
+-        
++
+         c = eta(y, PREC)
+ 
+         # Convert the PARI complex number c back to a GSL complex number
+@@ -2017,7 +2070,7 @@ cdef class ComplexDoubleElement(FieldEle
+         w = gsl_complex_rect(rtodbl(greal(c)), rtodbl(gimag(c)))
+ 
+         # put the pari stack back; this frees all memory used
+-        # by PARI above. 
++        # by PARI above.
+         avma = sp
+ 
+         if not omit_frac:
+@@ -2026,17 +2079,17 @@ cdef class ComplexDoubleElement(FieldEle
+                             gsl_complex_rect(0,M_PI_4/(<double>3)), self._complex)))
+ 
+         return self._new_c(w)
+-        
++
+     def agm(self, right, algorithm="optimal"):
+-        """
+-        Return the Arithmetic-Geometric Mean (AGM) of self and right.
++        r"""
++        Return the Arithmetic-Geometric Mean (AGM) of ``self`` and ``right``.
+ 
+         INPUT:
+ 
+-        - right (complex) -- another complex number
+-
+-        - algorithm (string, default "optimal") -- the algorithm to use
+-              (see below).
++        - ``right`` (complex) -- another complex number
++
++        - ``algorithm`` (string, default ``"optimal"``) -- the algorithm to use
++          (see below).
+ 
+         OUTPUT:
+ 
+@@ -2044,26 +2097,27 @@ cdef class ComplexDoubleElement(FieldEle
+         this is a multi-valued function, and the algorithm used
+         affects the value returned, as follows:
+ 
+-        - "pari": Call the agm function from the pari library.
+-
+-        - "optimal": Use the AGM sequence such that at each stage
+-              `(a,b)` is replaced by `(a_1,b_1)=((a+b)/2,\pm\sqrt{ab})`
+-              where the sign is chosen so that `|a_1-b_1|\le|a_1+b_1|`, or
+-              equivalently `\Re(b_1/a_1)\ge0`.  The resulting limit is
+-              maximal among all possible values.
+-
+-        - "principal": Use the AGM sequence such that at each stage
+-              `(a,b)` is replaced by `(a_1,b_1)=((a+b)/2,\pm\sqrt{ab})`
+-              where the sign is chosen so that `\Re(b_1/a_1)\ge0` (the
+-              so-called principal branch of the square root).
+-        
++        - ``'pari'``: Call the agm function from the pari library.
++
++        - ``'optimal'``: Use the AGM sequence such that at each stage
++          `(a,b)` is replaced by `(a_1,b_1)=((a+b)/2,\pm\sqrt{ab})`
++          where the sign is chosen so that `|a_1-b_1| \leq |a_1+b_1|`, or
++          equivalently `\Re(b_1/a_1) \geq 0`.  The resulting limit is
++          maximal among all possible values.
++
++        - ``'principal'``: Use the AGM sequence such that at each stage
++          `(a,b)` is replaced by `(a_1,b_1)=((a+b)/2,\pm\sqrt{ab})`
++          where the sign is chosen so that `\Re(b_1/a_1) \geq 0` (the
++          so-called principal branch of the square root).
++
+         EXAMPLES::
+-        
++
+             sage: i = CDF(I)
+             sage: (1+i).agm(2-i)
+             1.62780548487 + 0.136827548397*I
+ 
+-        An example to show that the returned value depends on the algorithm parameter::
++        An example to show that the returned value depends on the algorithm
++        parameter::
+ 
+             sage: a = CDF(-0.95,-0.65)
+             sage: b = CDF(0.683,0.747)
+@@ -2120,23 +2174,21 @@ cdef class ComplexDoubleElement(FieldEle
+                 b1 = csqrt(a*b)
+                 if cabs((b1/a1)-1) < eps: return ComplexDoubleElement_from_doubles(a1.real, a1.imag)
+                 a, b = a1, b1
+-        
++
+         else:
+             raise ValueError, "agm algorithm must be one of 'pari', 'optimal', 'principal'"
+-    
++
+     def dilog(self):
+         r"""
+-        Returns the principal branch of the dilogarithm of `x`,
+-        i.e., analytic continuation of the power series
+-        
+-        .. math::
+-        
+-                          \log_2(x) = \sum_{n \ge 1} x^n / n^2.         
+-        
+-        
+-        
++        Returns the principal branch of the dilogarithm of `x`, i.e., analytic
++        continuation of the power series
++
++        .. MATH::
++
++            \log_2(x) = \sum_{n \ge 1} x^n / n^2.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(1,2).dilog()
+             -0.0594747986738 + 2.07264797177*I
+             sage: CDF(10000000,10000000).dilog()
+@@ -2145,13 +2197,14 @@ cdef class ComplexDoubleElement(FieldEle
+         cdef pari_sp sp
+         sp = avma
+         return self._new_from_gen_c(  dilog(self._gen(), PREC),   sp)
+-    
++
+     def gamma(self):
+-        """
+-        Return the Gamma function evaluated at this complex number.
+-        
++        r"""
++        Return the gamma function `\Gamma(z)` evaluated at ``self``, the
++        complex number `z`.
++
+         EXAMPLES::
+-        
++
+             sage: CDF(5,0).gamma()