Example #1
0
def search_src(string,
               extra1='',
               extra2='',
               extra3='',
               extra4='',
               extra5='',
               interact=True):
    r"""
    Search \Sage library source code for lines containing \code{string}.
    The search is not case sensitive.

    INPUT:
        -- string: a string to find in the \Sage source code.
        -- extra1, ..., extra5: additional strings to require.

    NOTE:
        The extraN parameters are present only because
        search_src(string, *extras, interact=None)
        is not parsed correctly by Python 2.6; see http://bugs.python.org/issue1909.

    EXAMPLES:
        sage: print search_src(" fetch(", "def", interact=False) # random # long
        matrix/matrix0.pyx:    cdef fetch(self, key):
        matrix/matrix0.pxd:    cdef fetch(self, key)
        
        sage: print search_src(" fetch(", "def", interact=False) # random # long
        matrix/matrix0.pyx:    cdef fetch(self, key):
        matrix/matrix0.pxd:    cdef fetch(self, key)

        sage: print search_src(" fetch(", "def", "pyx", interact=False) # random # long
        matrix/matrix0.pyx:    cdef fetch(self, key):
    """
    cmd = 'sage -grep "%s"' % string
    for extra in [extra1, extra2, extra3, extra4, extra5]:
        if not extra:
            continue
        cmd += '| grep "%s"' % extra

    old_banner = os.environ.has_key('SAGE_BANNER')
    if old_banner:
        old_banner = os.environ['SAGE_BANNER']
    os.environ['SAGE_BANNER'] = "no"
    r = os.popen(cmd).read()
    if old_banner == False:
        del os.environ['SAGE_BANNER']
    else:
        os.environ['SAGE_BANNER'] = old_banner

    if not interact:
        return r
    from sage.server.support import EMBEDDED_MODE
    if EMBEDDED_MODE:  # I.e., running from the notebook
        print format_search_as_html('Source Code', r, string + extra)
    else:
        from sage.misc.all import pager
        pager()(r)
Example #2
0
 def help(self):
     try:
         h = self.__help
     except AttributeError:
         h = "-" * 70 + '\n'
         h += "   Call lcalc with one argument, e.g., \n"
         h += "      sage: lcalc('--tau -z 1000')\n"
         h += "   is translated into the command line\n"
         h += "      $ lcalc --tau -z 1000\n"
         h += "-" * 70 + '\n'
         h += '\n' + self('--help')
         self.__help = h
     pager()(h)
Example #3
0
 def help(self):
     try:
         h = self.__help
     except AttributeError:
         h = "-"*70 + '\n'
         h += "   Call lcalc with one argument, e.g., \n"
         h += "      sage: lcalc('--tau -z 1000')\n"
         h += "   is translated into the command line\n"
         h += "      $ lcalc --tau -z 1000\n"
         h += "-"*70 + '\n'
         h += '\n' + self('--help')
         self.__help = h
     pager()(h)
Example #4
0
def search_src(string, extra1='', extra2='', extra3='', extra4='', extra5='', interact=True):
    r"""
    Search \Sage library source code for lines containing \code{string}.
    The search is not case sensitive.

    INPUT:
        -- string: a string to find in the \Sage source code.
        -- extra1, ..., extra5: additional strings to require.

    NOTE:
        The extraN parameters are present only because
        search_src(string, *extras, interact=None)
        is not parsed correctly by Python 2.6; see http://bugs.python.org/issue1909.

    EXAMPLES:
        sage: print search_src(" fetch(", "def", interact=False) # random # long
        matrix/matrix0.pyx:    cdef fetch(self, key):
        matrix/matrix0.pxd:    cdef fetch(self, key)
        
        sage: print search_src(" fetch(", "def", interact=False) # random # long
        matrix/matrix0.pyx:    cdef fetch(self, key):
        matrix/matrix0.pxd:    cdef fetch(self, key)

        sage: print search_src(" fetch(", "def", "pyx", interact=False) # random # long
        matrix/matrix0.pyx:    cdef fetch(self, key):
    """
    cmd = 'sage -grep "%s"' % string
    for extra in [ extra1, extra2, extra3, extra4, extra5 ]:
        if not extra:
            continue
        cmd += '| grep "%s"' % extra

    old_banner = os.environ.has_key('SAGE_BANNER')
    if old_banner:
        old_banner = os.environ['SAGE_BANNER']
    os.environ['SAGE_BANNER'] = "no"
    r = os.popen(cmd).read()
    if old_banner == False:
        del os.environ['SAGE_BANNER']
    else:
        os.environ['SAGE_BANNER'] = old_banner
    
    if not interact:
        return r
    from sage.server.support import EMBEDDED_MODE
    if EMBEDDED_MODE:   # I.e., running from the notebook
        print format_search_as_html('Source Code', r, string + extra)
    else:
        from sage.misc.all import pager
        pager()(r)
Example #5
0
def search_doc(s, extra=''):
    """
    Full text search of the SAGE HTML documentation for lines
    containing s.  The search is not case sensitive.
    """
    cmd = 'sage -grepdoc "%s" | grep "%s"'%(s,extra)

    old_banner = os.environ.has_key('SAGE_BANNER')
    if old_banner:
        old_banner = os.environ['SAGE_BANNER']
    os.environ['SAGE_BANNER'] = "no"
    r = os.popen(cmd).read()
    if old_banner == False:
        del os.environ['SAGE_BANNER']
    else:
        os.environ['SAGE_BANNER'] = old_banner
    
    from sage.server.support import EMBEDDED_MODE
    if EMBEDDED_MODE:   # I.e., running from the notebook
        print format_search_as_html('Documentation', r, s + extra)
    else:
        from sage.misc.all import pager
        pager()(r)
Example #6
0
def search_doc(s, extra=''):
    """
    Full text search of the SAGE HTML documentation for lines
    containing s.  The search is not case sensitive.
    """
    cmd = 'sage -grepdoc "%s" | grep "%s"' % (s, extra)

    old_banner = os.environ.has_key('SAGE_BANNER')
    if old_banner:
        old_banner = os.environ['SAGE_BANNER']
    os.environ['SAGE_BANNER'] = "no"
    r = os.popen(cmd).read()
    if old_banner == False:
        del os.environ['SAGE_BANNER']
    else:
        os.environ['SAGE_BANNER'] = old_banner

    from sage.server.support import EMBEDDED_MODE
    if EMBEDDED_MODE:  # I.e., running from the notebook
        print format_search_as_html('Documentation', r, s + extra)
    else:
        from sage.misc.all import pager
        pager()(r)
Example #7
0
    def help(self):
        h = """
     sympow('-sp 2p16 -curve "[1,2,3,4,5]"')
will compute L(Sym^2 E,edge) for E=[1,2,3,4,5] to 16 digits of precision
The result
 2n0: 8.370510845377639E-01
 2w0: 8.370510845377586E-01
consists of two calculations using different parameters to test the
functional equation (to see if these are sufficiently close).

     sympow('-sp 3p12d2,4p8 -curve "[1,2,3,4,5]"')
will compute the 0th-2nd derivatives of L(Sym^3 E,center) to 12 digits
and L(Sym^4 E,edge) to 8 digits

Special cases: When a curve has CM, Hecke power can be used instead

     sympow('-sp 7p12d1 -hecke -curve "[0,0,1,-16758,835805]"')

will compute the 0th-1st derivatives of L(Sym^7 psi,special) to 12 digits.

Bloch-Kato numbers can be obtained for powers not congruent to 0 mod 4:

     sympow('-sp 2bp16 -curve "[1,2,3,4,5]"')

should return
 2n0: 4.640000000000006E+02
 2w0: 4.639999999999976E+02
which can be seen to be very close to the integer 464.

Modular degrees can be computed with the -moddeg option.

     sympow('-curve "[1,2,3,4,5]" -moddeg')

should return
Modular Degree is 464

Analytic ranks can be computed with the -analrank option.

     sympow('-curve "[1,2,3,4,5]" -analrank')

should return
Analytic Rank is 1 : L'-value 3.51873e+00

and (if the mesh file for the fifth derivative is present)

     sympow('-curve "[0,0,1,-79,342]" -analrank')

should return
Analytic Rank is 5 : leading L-term 3.02857e+01

========================================================================

Adding new symmetric powers:

SYMPOW keeps data for symmetric powers in the directory datafiles
If a pre-computed mesh of inverse Mellin transform values is not
available for a given symmetric power, SYMPOW will fail. The command

     sympow('-new_data 2')

will add the data the 2nd symmetric power, while

     sympow('-new_data 3d2')

will add the data for the 2nd derivative and 3rd symmetric power,

     sympow('-new_data 6d0h')

will add the data for the 0th derivative of the 6th Hecke power, and

     sympow('-new_data 4c')

will add data for the 4th symmetric power for curves with CM
(these need to be done separately for powers divisible by 4).

The mesh files are stored in binary form, and thus endian-ness is a
worry when moving from one platform to another.

To enable modular degree computations, the 2nd symmetric power must
be extant, and analytic rank requires derivatives of the 1st power.

===================================================================

Output of "!sympow -help":

 -bound #      an upper BOUND for how many ap to compute
 -help         print the help message and exit
 -info [] []   only report local information for primes/sympows
               1st argument is prime range, 2nd is sympow range
 -local        only report local information (bad primes)
 -curve []     input a curve in [a1,a2,a3,a4,a6] form
 -label []     label the given curve
 -quiet        turn off some messages
 -verbose      turn on some messages
 -rootno #     compute the root number of the #th symmetric power
 -moddeg       compute the modular degree
 -analrank     compute the analytic rank
 -sloppy []    for use with -analrank; have X sloppy digits
 -nocm         abort if curve has complex multiplication
 -noqt         ignore even powers of non-minimal quad twists
 -hecke        compute Hecke symmetric powers for a CM curve
 -maxtable     set the max size of factor tables: 2^27 default
 -sp  []       argument to specify which powers
               this is a comma separated list
               in each entry, the 1st datum is the sympow
               then could come b which turns Bloch-Kato on
               then could come w# which specifies how many tests
               then could come s# which says # sloppy digits
               then must come p# which specifies the precision
                    or P# which says ignore BOUND for this power
               then must come d# which says the derivative bound
                    or D# which says do only this derivative
                    (neither need be indicated for even powers)
               default is 2w3s1p32,3bp16d1,4p8
 -new_data []  will compute inverse Mellin transform mesh for
               the given data: the format is [sp]d[dv]{h,c}
               sp is the symmetric power, dv is the derivative,
               h indicates Hecke powers, and c indicates CM case
               d[dv] is given only for odd or Hecke powers
               Examples: 1d3 2 2d1h 3d2 4 4c 5d0 6 7d0h 11d1 12c
               NOTE: new_data runs a shell script that uses GP
Other options are used internally/recursively by -new_data
"""
        pager()(h)
Example #8
0
    def help(self):
        h = """
     sympow('-sp 2p16 -curve "[1,2,3,4,5]"')
will compute L(Sym^2 E,edge) for E=[1,2,3,4,5] to 16 digits of precision
The result
 2n0: 8.370510845377639E-01
 2w0: 8.370510845377586E-01
consists of two calculations using different parameters to test the
functional equation (to see if these are sufficiently close).

     sympow('-sp 3p12d2,4p8 -curve "[1,2,3,4,5]"')
will compute the 0th-2nd derivatives of L(Sym^3 E,center) to 12 digits
and L(Sym^4 E,edge) to 8 digits

Special cases: When a curve has CM, Hecke power can be used instead

     sympow('-sp 7p12d1 -hecke -curve "[0,0,1,-16758,835805]"')

will compute the 0th-1st derivatives of L(Sym^7 psi,special) to 12 digits.

Bloch-Kato numbers can be obtained for powers not congruent to 0 mod 4:

     sympow('-sp 2bp16 -curve "[1,2,3,4,5]"')

should return
 2n0: 4.640000000000006E+02
 2w0: 4.639999999999976E+02
which can be seen to be very close to the integer 464.

Modular degrees can be computed with the -moddeg option.

     sympow('-curve "[1,2,3,4,5]" -moddeg')

should return
Modular Degree is 464

Analytic ranks can be computed with the -analrank option.

     sympow('-curve "[1,2,3,4,5]" -analrank')

should return
Analytic Rank is 1 : L'-value 3.51873e+00

and (if the mesh file for the fifth derivative is present)

     sympow('-curve "[0,0,1,-79,342]" -analrank')

should return
Analytic Rank is 5 : leading L-term 3.02857e+01

========================================================================

Adding new symmetric powers:

SYMPOW keeps data for symmetric powers in the directory datafiles
If a pre-computed mesh of inverse Mellin transform values is not
available for a given symmetric power, SYMPOW will fail. The command

     sympow('-new_data 2')

will add the data the 2nd symmetric power, while

     sympow('-new_data 3d2')

will add the data for the 2nd derivative and 3rd symmetric power,

     sympow('-new_data 6d0h')

will add the data for the 0th derivative of the 6th Hecke power, and

     sympow('-new_data 4c')

will add data for the 4th symmetric power for curves with CM
(these need to be done separately for powers divisible by 4).

The mesh files are stored in binary form, and thus endian-ness is a
worry when moving from one platform to another.

To enable modular degree computations, the 2nd symmetric power must
be extant, and analytic rank requires derivatives of the 1st power.

===================================================================

Output of "!sympow -help":

 -bound #      an upper BOUND for how many ap to compute
 -help         print the help message and exit
 -info [] []   only report local information for primes/sympows
               1st argument is prime range, 2nd is sympow range
 -local        only report local information (bad primes)
 -curve []     input a curve in [a1,a2,a3,a4,a6] form
 -label []     label the given curve
 -quiet        turn off some messages
 -verbose      turn on some messages
 -rootno #     compute the root number of the #th symmetric power
 -moddeg       compute the modular degree
 -analrank     compute the analytic rank
 -sloppy []    for use with -analrank; have X sloppy digits
 -nocm         abort if curve has complex multiplication
 -noqt         ignore even powers of non-minimal quad twists
 -hecke        compute Hecke symmetric powers for a CM curve
 -maxtable     set the max size of factor tables: 2^27 default
 -sp  []       argument to specify which powers
               this is a comma separated list
               in each entry, the 1st datum is the sympow
               then could come b which turns Bloch-Kato on
               then could come w# which specifies how many tests
               then could come s# which says # sloppy digits
               then must come p# which specifies the precision
                    or P# which says ignore BOUND for this power
               then must come d# which says the derivative bound
                    or D# which says do only this derivative
                    (neither need be indicated for even powers)
               default is 2w3s1p32,3bp16d1,4p8
 -new_data []  will compute inverse Mellin transform mesh for
               the given data: the format is [sp]d[dv]{h,c}
               sp is the symmetric power, dv is the derivative,
               h indicates Hecke powers, and c indicates CM case
               d[dv] is given only for odd or Hecke powers
               Examples: 1d3 2 2d1h 3d2 4 4c 5d0 6 7d0h 11d1 12c
               NOTE: new_data runs a shell script that uses GP
Other options are used internally/recursively by -new_data
"""
        pager()(h)