Ticket #5739: 5739-CC-RR.patch

File 5739-CC-RR.patch, 2.5 KB (added by robertwb, 10 years ago)

apply this and 5739-CDF-zeta.patch

  • sage/rings/complex_number.pyx

    diff -r f7e8996928f1 -r eeed7c13d168 sage/rings/complex_number.pyx
    a b  
    18651865            0.58215806 - 0.92684856*I
    18661866            sage: zeta(z)
    18671867            0.58215806 - 0.92684856*I
     1868
     1869            sage: CC(1).zeta()
     1870            Infinity
     1871            sage: zeta(1)
     1872            Infinity
    18681873        """
     1874        if mpfr_zero_p(self.__im) and mpfr_cmp_ui(self.__re, 1) == 0:
     1875            import infinity
     1876            return infinity.unsigned_infinity
    18691877        return self._parent(self._pari_().zeta())
    18701878
    18711879    def algdep(self, n, **kwds):
  • sage/rings/real_double.pyx

    diff -r f7e8996928f1 -r eeed7c13d168 sage/rings/real_double.pyx
    a b  
    21322132        r"""
    21332133        Return the Riemann zeta function evaluated at this real number.
    21342134       
    2135         .. note::
    2136 
    2137            PARI is vastly more efficient at computing the Riemann zeta
    2138            function. See the example below for how to use it.
    2139        
    21402135        EXAMPLES::
    21412136       
    21422137            sage: RDF(2).zeta()
     
    21462141            sage: RDF(-2).zeta()       # slightly random-ish arch dependent output
    21472142            -2.37378795339e-18
    21482143            sage: RDF(1).zeta()
    2149             +infinity
     2144            Infinity
    21502145        """
    21512146        if self._value == 1:
    2152             return self._new_c(1)/self._new_c(0)
     2147            import infinity
     2148            return infinity.unsigned_infinity
    21532149        return self._new_c(gsl_sf_zeta(self._value))
    21542150
    21552151    def algdep(self, n):
  • sage/rings/real_mpfr.pyx

    diff -r f7e8996928f1 -r eeed7c13d168 sage/rings/real_mpfr.pyx
    a b  
    39283928            sage: R(-2).zeta()
    39293929            0.000000000000000
    39303930            sage: R(1).zeta()
    3931             +infinity
     3931            Infinity
    39323932       
    39333933        Computing zeta using PARI is much more efficient in difficult
    39343934        cases. Here's how to compute zeta with at least a given precision::
     
    39543954            sage: R(z)
    39553955            1.64493406684823
    39563956        """
    3957         cdef RealNumber x
    3958         x = self._new()
     3957        if mpfr_cmp_ui(self.value, 1) == 0:
     3958            import infinity
     3959            return infinity.unsigned_infinity
     3960        cdef RealNumber x = self._new()
    39593961        _sig_on
    39603962        mpfr_zeta(x.value, self.value, (<RealField>self._parent).rnd)
    39613963        _sig_off