当前位置: 首页>>代码示例>>Python>>正文


Python ZZ.is_squarefree方法代码示例

本文整理汇总了Python中sage.all.ZZ.is_squarefree方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.is_squarefree方法的具体用法?Python ZZ.is_squarefree怎么用?Python ZZ.is_squarefree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sage.all.ZZ的用法示例。


在下文中一共展示了ZZ.is_squarefree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TripleProductLseries

# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import is_squarefree [as 别名]
class TripleProductLseries(object):
    """
    A triple product `L`-series attached to three newforms of level `N`.
    """
    def __init__(self, N, f, g, h):
        """
        INPUT:
            - N -- squarefree integer
            - f -- an object such that for n>=0, we have
              f[n] = a_n(f) = n-th Fourier coefficient of
              a newform on Gamma_0(N).
            - g -- like f
            - h -- like f
        """
        self._N = ZZ(N)
        if not (self._N.is_squarefree() and self._N > 0):
            raise ValueError, "N (=%s) must be a squarefree positive integer"%self._N
        self._newforms = (f,g,h)
        self._gen = RDF['X'].gen()
        self._genC = CDF['X'].gen()
        self._series = RDF[['X']]

    def __repr__(self):
        """
        Return text representation of this triple product `L`-function.
        """
        return "Triple product L-function L(s,f,g,h) of three newforms on Gamma_0(%s)"%self._N

    def level(self):
        """
        Return the common level `N` of the newforms in the triple product.

        OUTPUT:
            - Integer
        
        EXAMPLES::
        """
        return self._N

    def newforms(self):
        """
        Return 3-tuple (f,g,h) of the data that defines the newforms
        in the triple product.

        OUTPUT:
            - 3-tuple
        
        EXAMPLES::
        """
        return self._newforms

    def _local_series(self, p, prec):
        """
        Return power series in `X` (which you should think of as `p^{-s}`)
        that is the expansion to precision prec of the local factor at `p`
        of this `L`-series.

        INPUT:
            - p -- prime
            - prec -- positive integer

        OUTPUT:
            - power series that ends in a term ``O(X^prec)``.
        """
        f = self._series(self.charpoly(p), prec)
        return f**(-1)

    def dirichlet_series(self, prec, eps=1e-10):
        """
        Return the Dirichlet series representation of self, up to the given
        precision.

        INPUT:
           - prec -- positive integer
           - eps -- None or a positive real; any coefficient with absolute
             value less than eps is set to 0.
        """
        coeffs = self.dirichlet_series_coeffs(prec, eps)
        return DirichletSeries(coeffs, 's')
            
    def dirichlet_series_coeffs(self, prec, eps=1e-10):
        """
        Return the coefficients of the Dirichlet series representation
        of self, up to the given precision.

        INPUT:
           - prec -- positive integer
           - eps -- None or a positive real; any coefficient with absolute
             value less than eps is set to 0.
        """
        # Use multiplicativity to compute the Dirichlet series
        # coefficients, then make a DirichletSeries object.
        zero = RDF(0)
        coeffs = [RDF(0),RDF(1)] + [None]*(prec-2)

        from sage.all import log, floor   # TODO: slow
        
        # prime-power indexed coefficients
        for p in prime_range(2, prec):
            B = floor(log(prec, p)) + 1
#.........这里部分代码省略.........
开发者ID:Alwnikrotikz,项目名称:purplesage,代码行数:103,代码来源:triple.py


注:本文中的sage.all.ZZ.is_squarefree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。