Esempio n. 1
0
def specialValueTriple(L, s, sLatex_analytic, sLatex_arithmetic):
    ''' Returns [L_arithmetic, L_analytic, L_val]
        Currently only used for genus 2 curves
        and Dirichlet characters.
        Eventually want to use for all L-functions.
    '''
    number_of_decimals = 10
    val = None
    if L.fromDB:  #getattr(L, 'fromDB', False):
        s_alg = s + L.analytic_normalization
        for x in L.values:
            # the numbers here are always half integers
            # so this comparison is exact
            if x[0] == s_alg:
                val = x[1]
                break
    if val is None:
        if L.fromDB:
            val = "not computed"
        else:
            val = L.sageLfunction.value(s)
            logger.warning(
                "a value of an L-function has been computed on the fly")

    if sLatex_arithmetic:
        lfunction_value_tex_arithmetic = L.texname_arithmetic.replace(
            's)', sLatex_arithmetic + ')')
    else:
        lfunction_value_tex_arithmetic = ''
    if sLatex_analytic:
        lfunction_value_tex_analytic = L.texname.replace(
            '(s', '(' + sLatex_analytic)
    else:
        lfunction_value_tex_analytic = ''

    if isinstance(val, string_types):
        Lval = val
    else:
        ccval = CDF(val)
        # We must test for NaN first, since it would show as zero otherwise
        # Try "RR(NaN) < float(1e-10)" in sage -- GT
        if ccval.real().is_NaN():
            Lval = r"$\infty$"
        else:
            Lval = display_complex(ccval.real(), ccval.imag(),
                                   number_of_decimals)

    return [lfunction_value_tex_analytic, lfunction_value_tex_arithmetic, Lval]
Esempio n. 2
0
def specialValueTriple(L, s, sLatex_analytic, sLatex_arithmetic):
    ''' Returns [L_arithmetic, L_analytic, L_val]
        Currently only used for genus 2 curves
        and Dirichlet characters.
        Eventually want to use for all L-functions.
    '''
    number_of_decimals = 10
    val = None
    if L.fromDB: #getattr(L, 'fromDB', False):
        s_alg = s + L.analytic_normalization
        for x in L.values:
            # the numbers here are always half integers
            # so this comparison is exact
            if x[0] == s_alg:
                val = x[1]
                break
    if val is None:
        if L.fromDB:
            val = "not computed"
        else:
            val = L.sageLfunction.value(s)
            logger.warning("a value of an L-function has been computed on the fly")

    if sLatex_arithmetic:
        lfunction_value_tex_arithmetic = L.texname_arithmetic.replace('s)',  sLatex_arithmetic + ')')
    else:
        lfunction_value_tex_arithmetic = ''
    if sLatex_analytic:
        lfunction_value_tex_analytic = L.texname.replace('(s', '(' + sLatex_analytic)
    else:
        lfunction_value_tex_analytic = ''

    if isinstance(val, basestring):
        Lval = val
    else:
        ccval = CDF(val)
        # We must test for NaN first, since it would show as zero otherwise
        # Try "RR(NaN) < float(1e-10)" in sage -- GT
        if ccval.real().is_NaN():
            Lval = "$\\infty$"
        else:
            Lval = display_complex(ccval.real(), ccval.imag(), number_of_decimals)

    return [lfunction_value_tex_analytic, lfunction_value_tex_arithmetic, Lval]