rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if pdflatex: | if not engine or engine == "latex": command = "latex" suffix = "ps" return_suffix = "dvi" elif engine == "pdflatex": | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. INPUT: - ``filename`` - string: file to process, including full path - ``debug`` - bool (optional, default False): whether to print verbose debugging output - ``density`` - integer (optional, default 150): how big output image is. - ``pdflatex`` - bool (optional, default False): whether to use pdflatex. - ``png`` - bool (optional, default False): whether to produce a png file. - ``do_in_background`` - bool (optional, default False): whether to run in the background. OUTPUT: string, which could be a string starting with 'Error' (if there was a problem), or it could be 'pdf' or 'dvi'. If ``pdflatex`` is False, then a dvi file is created, but if there appear to be problems with it (because of PS special commands, for example), then a pdf file is created instead. The function returns 'dvi' or 'pdf' to indicate which type of file is created. (Detecting problems requires that dvipng be installed; if it is not, then the dvi file is not checked for problems and 'dvi' is returned.) If ``pdflatex`` is True and there are no errors, then 'pdf' is returned. .. warning:: If ``png`` is True, then when using latex (the default), you must have 'dvipng' (or 'dvips' and 'convert') installed on your operating system, or this command won't work. When using pdflatex, you must have 'convert' installed. EXAMPLES:: sage: from sage.misc.latex import _run_latex_, _latex_file_ sage: file = os.path.join(SAGE_TMP, "temp.tex") sage: O = open(file, 'w') sage: O.write(_latex_file_([ZZ[x], RR])); O.close() sage: _run_latex_(file) # random - depends on whether latex is installed 'dvi' """ if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] if not pdflatex and not have_latex(): print "Error: LaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" if pdflatex and not have_pdflatex(): print "Error: PDFLaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" # if png output + latex, check to see if dvipng or convert is installed. if png: if not pdflatex and not (have_dvipng() or have_convert()): print "" print "Error: neither dvipng nor convert (from the ImageMagick suite)" print "appear to be installed. Displaying LaTeX or PDFLaTeX output" print "requires at least one of these programs, so please install" print "and try again." print "" print "Go to http://sourceforge.net/projects/dvipng/ and" print "http://www.imagemagick.org to download these programs." return "Error" # if png output + pdflatex, check to see if convert is installed. elif pdflatex and not have_convert(): print "" print "Error: convert (from the ImageMagick suite) does not" print "appear to be installed. Displaying PDFLaTeX output" print "requires this program, so please install and try again." print "" print "Go to http://www.imagemagick.org to download it." return "Error" # check_validity: check to see if the dvi file is okay by trying # to convert to a png file. if this fails, return_suffix will be # set to "pdf". return_suffix is the return value for this # function. # # thus if not png output, check validity of dvi output if dvipng # or convert is installed. else: check_validity = have_dvipng() # set up filenames, other strings: base, filename = os.path.split(filename) filename = os.path.splitext(filename)[0] # get rid of extension if len(filename.split()) > 1: raise ValueError, "filename must contain no spaces" if not debug: redirect=' 2>/dev/null 1>/dev/null ' else: redirect='' if do_in_background: background = ' &' else: background = '' if pdflatex: command = "pdflatex" # 'suffix' is used in the string 'convert' ... suffix = "pdf" return_suffix = "pdf" else: command = "latex" suffix = "ps" return_suffix = "dvi" # Define the commands to be used: lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) # dvipng is run with the 'picky' option: this means that if # there are warnings, no png file is created. dvipng = 'cd "%s"&& sage-native-execute dvipng --picky -q -T tight -D %s %s.dvi -o %s.png'%(base, density, filename, filename) dvips = 'sage-native-execute dvips %s.dvi %s'%(filename, redirect) ps2pdf = 'sage-native-execute ps2pdf %s.ps %s'%(filename, redirect) # We seem to need a larger size when using convert compared to # when using dvipng: density = int(1.4 * density / 1.3) convert = 'sage-native-execute convert -density %sx%s -trim %s.%s %s.png %s '%\ (density,density, filename, suffix, filename, redirect) e = 1 # it is possible to get through the following commands # without running a program, so in that case we force error if pdflatex: if png: cmd = ' && '.join([lt, convert]) else: cmd = lt if debug: print cmd e = os.system(cmd + ' ' + redirect + background) else: # latex, not pdflatex if (png or check_validity): if have_dvipng(): cmd = ' && '.join([lt, dvipng]) if debug: print cmd e = os.system(cmd + ' ' + redirect) dvipng_error = not os.path.exists(base + '/' + filename + '.png') # If there is no png file, then either the latex # process failed or dvipng failed. Assume that dvipng # failed, and try running dvips and convert. (If the # latex process failed, then dvips and convert will # fail also, so we'll still catch the error.) if dvipng_error: if png: if have_convert(): cmd = ' && '.join(['cd "%s"'%(base,), dvips, convert]) if debug: print "'dvipng' failed; trying 'convert' instead..." print cmd e = os.system(cmd + ' ' + redirect + background) else: print "Error: 'dvipng' failed and 'convert' is not installed." return "Error: dvipng failed." else: # not png, i.e., check_validity return_suffix = "pdf" cmd = ' && '.join(['cd "%s"'%(base,), dvips, ps2pdf]) if debug: print "bad dvi file; running dvips and ps2pdf instead..." print cmd e = os.system(cmd) if e: # error running dvips and/or ps2pdf command = "pdflatex" lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) if debug: print "error running dvips and ps2pdf; trying pdflatex instead..." print cmd e = os.system(cmd + background) else: # don't have dvipng, so must have convert. run latex, dvips, convert. cmd = ' && '.join([lt, dvips, convert]) if debug: print cmd e = os.system(cmd + ' ' + redirect + background) if e: print "An error occurred." try: print open(base + '/' + filename + '.log').read() except IOError: pass return "Error latexing slide." return return_suffix | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
command = "latex" suffix = "ps" return_suffix = "dvi" | raise ValueError, "Unsupported LaTeX engine." | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. INPUT: - ``filename`` - string: file to process, including full path - ``debug`` - bool (optional, default False): whether to print verbose debugging output - ``density`` - integer (optional, default 150): how big output image is. - ``pdflatex`` - bool (optional, default False): whether to use pdflatex. - ``png`` - bool (optional, default False): whether to produce a png file. - ``do_in_background`` - bool (optional, default False): whether to run in the background. OUTPUT: string, which could be a string starting with 'Error' (if there was a problem), or it could be 'pdf' or 'dvi'. If ``pdflatex`` is False, then a dvi file is created, but if there appear to be problems with it (because of PS special commands, for example), then a pdf file is created instead. The function returns 'dvi' or 'pdf' to indicate which type of file is created. (Detecting problems requires that dvipng be installed; if it is not, then the dvi file is not checked for problems and 'dvi' is returned.) If ``pdflatex`` is True and there are no errors, then 'pdf' is returned. .. warning:: If ``png`` is True, then when using latex (the default), you must have 'dvipng' (or 'dvips' and 'convert') installed on your operating system, or this command won't work. When using pdflatex, you must have 'convert' installed. EXAMPLES:: sage: from sage.misc.latex import _run_latex_, _latex_file_ sage: file = os.path.join(SAGE_TMP, "temp.tex") sage: O = open(file, 'w') sage: O.write(_latex_file_([ZZ[x], RR])); O.close() sage: _run_latex_(file) # random - depends on whether latex is installed 'dvi' """ if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] if not pdflatex and not have_latex(): print "Error: LaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" if pdflatex and not have_pdflatex(): print "Error: PDFLaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" # if png output + latex, check to see if dvipng or convert is installed. if png: if not pdflatex and not (have_dvipng() or have_convert()): print "" print "Error: neither dvipng nor convert (from the ImageMagick suite)" print "appear to be installed. Displaying LaTeX or PDFLaTeX output" print "requires at least one of these programs, so please install" print "and try again." print "" print "Go to http://sourceforge.net/projects/dvipng/ and" print "http://www.imagemagick.org to download these programs." return "Error" # if png output + pdflatex, check to see if convert is installed. elif pdflatex and not have_convert(): print "" print "Error: convert (from the ImageMagick suite) does not" print "appear to be installed. Displaying PDFLaTeX output" print "requires this program, so please install and try again." print "" print "Go to http://www.imagemagick.org to download it." return "Error" # check_validity: check to see if the dvi file is okay by trying # to convert to a png file. if this fails, return_suffix will be # set to "pdf". return_suffix is the return value for this # function. # # thus if not png output, check validity of dvi output if dvipng # or convert is installed. else: check_validity = have_dvipng() # set up filenames, other strings: base, filename = os.path.split(filename) filename = os.path.splitext(filename)[0] # get rid of extension if len(filename.split()) > 1: raise ValueError, "filename must contain no spaces" if not debug: redirect=' 2>/dev/null 1>/dev/null ' else: redirect='' if do_in_background: background = ' &' else: background = '' if pdflatex: command = "pdflatex" # 'suffix' is used in the string 'convert' ... suffix = "pdf" return_suffix = "pdf" else: command = "latex" suffix = "ps" return_suffix = "dvi" # Define the commands to be used: lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) # dvipng is run with the 'picky' option: this means that if # there are warnings, no png file is created. dvipng = 'cd "%s"&& sage-native-execute dvipng --picky -q -T tight -D %s %s.dvi -o %s.png'%(base, density, filename, filename) dvips = 'sage-native-execute dvips %s.dvi %s'%(filename, redirect) ps2pdf = 'sage-native-execute ps2pdf %s.ps %s'%(filename, redirect) # We seem to need a larger size when using convert compared to # when using dvipng: density = int(1.4 * density / 1.3) convert = 'sage-native-execute convert -density %sx%s -trim %s.%s %s.png %s '%\ (density,density, filename, suffix, filename, redirect) e = 1 # it is possible to get through the following commands # without running a program, so in that case we force error if pdflatex: if png: cmd = ' && '.join([lt, convert]) else: cmd = lt if debug: print cmd e = os.system(cmd + ' ' + redirect + background) else: # latex, not pdflatex if (png or check_validity): if have_dvipng(): cmd = ' && '.join([lt, dvipng]) if debug: print cmd e = os.system(cmd + ' ' + redirect) dvipng_error = not os.path.exists(base + '/' + filename + '.png') # If there is no png file, then either the latex # process failed or dvipng failed. Assume that dvipng # failed, and try running dvips and convert. (If the # latex process failed, then dvips and convert will # fail also, so we'll still catch the error.) if dvipng_error: if png: if have_convert(): cmd = ' && '.join(['cd "%s"'%(base,), dvips, convert]) if debug: print "'dvipng' failed; trying 'convert' instead..." print cmd e = os.system(cmd + ' ' + redirect + background) else: print "Error: 'dvipng' failed and 'convert' is not installed." return "Error: dvipng failed." else: # not png, i.e., check_validity return_suffix = "pdf" cmd = ' && '.join(['cd "%s"'%(base,), dvips, ps2pdf]) if debug: print "bad dvi file; running dvips and ps2pdf instead..." print cmd e = os.system(cmd) if e: # error running dvips and/or ps2pdf command = "pdflatex" lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) if debug: print "error running dvips and ps2pdf; trying pdflatex instead..." print cmd e = os.system(cmd + background) else: # don't have dvipng, so must have convert. run latex, dvips, convert. cmd = ' && '.join([lt, dvips, convert]) if debug: print cmd e = os.system(cmd + ' ' + redirect + background) if e: print "An error occurred." try: print open(base + '/' + filename + '.log').read() except IOError: pass return "Error latexing slide." return return_suffix | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
if pdflatex: | if engine == "pdflatex" or engine == "xelatex": | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. INPUT: - ``filename`` - string: file to process, including full path - ``debug`` - bool (optional, default False): whether to print verbose debugging output - ``density`` - integer (optional, default 150): how big output image is. - ``pdflatex`` - bool (optional, default False): whether to use pdflatex. - ``png`` - bool (optional, default False): whether to produce a png file. - ``do_in_background`` - bool (optional, default False): whether to run in the background. OUTPUT: string, which could be a string starting with 'Error' (if there was a problem), or it could be 'pdf' or 'dvi'. If ``pdflatex`` is False, then a dvi file is created, but if there appear to be problems with it (because of PS special commands, for example), then a pdf file is created instead. The function returns 'dvi' or 'pdf' to indicate which type of file is created. (Detecting problems requires that dvipng be installed; if it is not, then the dvi file is not checked for problems and 'dvi' is returned.) If ``pdflatex`` is True and there are no errors, then 'pdf' is returned. .. warning:: If ``png`` is True, then when using latex (the default), you must have 'dvipng' (or 'dvips' and 'convert') installed on your operating system, or this command won't work. When using pdflatex, you must have 'convert' installed. EXAMPLES:: sage: from sage.misc.latex import _run_latex_, _latex_file_ sage: file = os.path.join(SAGE_TMP, "temp.tex") sage: O = open(file, 'w') sage: O.write(_latex_file_([ZZ[x], RR])); O.close() sage: _run_latex_(file) # random - depends on whether latex is installed 'dvi' """ if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] if not pdflatex and not have_latex(): print "Error: LaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" if pdflatex and not have_pdflatex(): print "Error: PDFLaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" # if png output + latex, check to see if dvipng or convert is installed. if png: if not pdflatex and not (have_dvipng() or have_convert()): print "" print "Error: neither dvipng nor convert (from the ImageMagick suite)" print "appear to be installed. Displaying LaTeX or PDFLaTeX output" print "requires at least one of these programs, so please install" print "and try again." print "" print "Go to http://sourceforge.net/projects/dvipng/ and" print "http://www.imagemagick.org to download these programs." return "Error" # if png output + pdflatex, check to see if convert is installed. elif pdflatex and not have_convert(): print "" print "Error: convert (from the ImageMagick suite) does not" print "appear to be installed. Displaying PDFLaTeX output" print "requires this program, so please install and try again." print "" print "Go to http://www.imagemagick.org to download it." return "Error" # check_validity: check to see if the dvi file is okay by trying # to convert to a png file. if this fails, return_suffix will be # set to "pdf". return_suffix is the return value for this # function. # # thus if not png output, check validity of dvi output if dvipng # or convert is installed. else: check_validity = have_dvipng() # set up filenames, other strings: base, filename = os.path.split(filename) filename = os.path.splitext(filename)[0] # get rid of extension if len(filename.split()) > 1: raise ValueError, "filename must contain no spaces" if not debug: redirect=' 2>/dev/null 1>/dev/null ' else: redirect='' if do_in_background: background = ' &' else: background = '' if pdflatex: command = "pdflatex" # 'suffix' is used in the string 'convert' ... suffix = "pdf" return_suffix = "pdf" else: command = "latex" suffix = "ps" return_suffix = "dvi" # Define the commands to be used: lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) # dvipng is run with the 'picky' option: this means that if # there are warnings, no png file is created. dvipng = 'cd "%s"&& sage-native-execute dvipng --picky -q -T tight -D %s %s.dvi -o %s.png'%(base, density, filename, filename) dvips = 'sage-native-execute dvips %s.dvi %s'%(filename, redirect) ps2pdf = 'sage-native-execute ps2pdf %s.ps %s'%(filename, redirect) # We seem to need a larger size when using convert compared to # when using dvipng: density = int(1.4 * density / 1.3) convert = 'sage-native-execute convert -density %sx%s -trim %s.%s %s.png %s '%\ (density,density, filename, suffix, filename, redirect) e = 1 # it is possible to get through the following commands # without running a program, so in that case we force error if pdflatex: if png: cmd = ' && '.join([lt, convert]) else: cmd = lt if debug: print cmd e = os.system(cmd + ' ' + redirect + background) else: # latex, not pdflatex if (png or check_validity): if have_dvipng(): cmd = ' && '.join([lt, dvipng]) if debug: print cmd e = os.system(cmd + ' ' + redirect) dvipng_error = not os.path.exists(base + '/' + filename + '.png') # If there is no png file, then either the latex # process failed or dvipng failed. Assume that dvipng # failed, and try running dvips and convert. (If the # latex process failed, then dvips and convert will # fail also, so we'll still catch the error.) if dvipng_error: if png: if have_convert(): cmd = ' && '.join(['cd "%s"'%(base,), dvips, convert]) if debug: print "'dvipng' failed; trying 'convert' instead..." print cmd e = os.system(cmd + ' ' + redirect + background) else: print "Error: 'dvipng' failed and 'convert' is not installed." return "Error: dvipng failed." else: # not png, i.e., check_validity return_suffix = "pdf" cmd = ' && '.join(['cd "%s"'%(base,), dvips, ps2pdf]) if debug: print "bad dvi file; running dvips and ps2pdf instead..." print cmd e = os.system(cmd) if e: # error running dvips and/or ps2pdf command = "pdflatex" lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) if debug: print "error running dvips and ps2pdf; trying pdflatex instead..." print cmd e = os.system(cmd + background) else: # don't have dvipng, so must have convert. run latex, dvips, convert. cmd = ' && '.join([lt, dvips, convert]) if debug: print cmd e = os.system(cmd + ' ' + redirect + background) if e: print "An error occurred." try: print open(base + '/' + filename + '.log').read() except IOError: pass return "Error latexing slide." return return_suffix | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
else: | else: | def _run_latex_(filename, debug=False, density=150, pdflatex=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files "filename.dvi" (or "filename.pdf"` if ``pdflatex`` is ``True``) and if ``png`` is True, "filename.png". If ``png`` is True and dvipng can't convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. INPUT: - ``filename`` - string: file to process, including full path - ``debug`` - bool (optional, default False): whether to print verbose debugging output - ``density`` - integer (optional, default 150): how big output image is. - ``pdflatex`` - bool (optional, default False): whether to use pdflatex. - ``png`` - bool (optional, default False): whether to produce a png file. - ``do_in_background`` - bool (optional, default False): whether to run in the background. OUTPUT: string, which could be a string starting with 'Error' (if there was a problem), or it could be 'pdf' or 'dvi'. If ``pdflatex`` is False, then a dvi file is created, but if there appear to be problems with it (because of PS special commands, for example), then a pdf file is created instead. The function returns 'dvi' or 'pdf' to indicate which type of file is created. (Detecting problems requires that dvipng be installed; if it is not, then the dvi file is not checked for problems and 'dvi' is returned.) If ``pdflatex`` is True and there are no errors, then 'pdf' is returned. .. warning:: If ``png`` is True, then when using latex (the default), you must have 'dvipng' (or 'dvips' and 'convert') installed on your operating system, or this command won't work. When using pdflatex, you must have 'convert' installed. EXAMPLES:: sage: from sage.misc.latex import _run_latex_, _latex_file_ sage: file = os.path.join(SAGE_TMP, "temp.tex") sage: O = open(file, 'w') sage: O.write(_latex_file_([ZZ[x], RR])); O.close() sage: _run_latex_(file) # random - depends on whether latex is installed 'dvi' """ if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] if not pdflatex and not have_latex(): print "Error: LaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" if pdflatex and not have_pdflatex(): print "Error: PDFLaTeX does not seem to be installed. Download it from" print "ctan.org and try again." return "Error" # if png output + latex, check to see if dvipng or convert is installed. if png: if not pdflatex and not (have_dvipng() or have_convert()): print "" print "Error: neither dvipng nor convert (from the ImageMagick suite)" print "appear to be installed. Displaying LaTeX or PDFLaTeX output" print "requires at least one of these programs, so please install" print "and try again." print "" print "Go to http://sourceforge.net/projects/dvipng/ and" print "http://www.imagemagick.org to download these programs." return "Error" # if png output + pdflatex, check to see if convert is installed. elif pdflatex and not have_convert(): print "" print "Error: convert (from the ImageMagick suite) does not" print "appear to be installed. Displaying PDFLaTeX output" print "requires this program, so please install and try again." print "" print "Go to http://www.imagemagick.org to download it." return "Error" # check_validity: check to see if the dvi file is okay by trying # to convert to a png file. if this fails, return_suffix will be # set to "pdf". return_suffix is the return value for this # function. # # thus if not png output, check validity of dvi output if dvipng # or convert is installed. else: check_validity = have_dvipng() # set up filenames, other strings: base, filename = os.path.split(filename) filename = os.path.splitext(filename)[0] # get rid of extension if len(filename.split()) > 1: raise ValueError, "filename must contain no spaces" if not debug: redirect=' 2>/dev/null 1>/dev/null ' else: redirect='' if do_in_background: background = ' &' else: background = '' if pdflatex: command = "pdflatex" # 'suffix' is used in the string 'convert' ... suffix = "pdf" return_suffix = "pdf" else: command = "latex" suffix = "ps" return_suffix = "dvi" # Define the commands to be used: lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) # dvipng is run with the 'picky' option: this means that if # there are warnings, no png file is created. dvipng = 'cd "%s"&& sage-native-execute dvipng --picky -q -T tight -D %s %s.dvi -o %s.png'%(base, density, filename, filename) dvips = 'sage-native-execute dvips %s.dvi %s'%(filename, redirect) ps2pdf = 'sage-native-execute ps2pdf %s.ps %s'%(filename, redirect) # We seem to need a larger size when using convert compared to # when using dvipng: density = int(1.4 * density / 1.3) convert = 'sage-native-execute convert -density %sx%s -trim %s.%s %s.png %s '%\ (density,density, filename, suffix, filename, redirect) e = 1 # it is possible to get through the following commands # without running a program, so in that case we force error if pdflatex: if png: cmd = ' && '.join([lt, convert]) else: cmd = lt if debug: print cmd e = os.system(cmd + ' ' + redirect + background) else: # latex, not pdflatex if (png or check_validity): if have_dvipng(): cmd = ' && '.join([lt, dvipng]) if debug: print cmd e = os.system(cmd + ' ' + redirect) dvipng_error = not os.path.exists(base + '/' + filename + '.png') # If there is no png file, then either the latex # process failed or dvipng failed. Assume that dvipng # failed, and try running dvips and convert. (If the # latex process failed, then dvips and convert will # fail also, so we'll still catch the error.) if dvipng_error: if png: if have_convert(): cmd = ' && '.join(['cd "%s"'%(base,), dvips, convert]) if debug: print "'dvipng' failed; trying 'convert' instead..." print cmd e = os.system(cmd + ' ' + redirect + background) else: print "Error: 'dvipng' failed and 'convert' is not installed." return "Error: dvipng failed." else: # not png, i.e., check_validity return_suffix = "pdf" cmd = ' && '.join(['cd "%s"'%(base,), dvips, ps2pdf]) if debug: print "bad dvi file; running dvips and ps2pdf instead..." print cmd e = os.system(cmd) if e: # error running dvips and/or ps2pdf command = "pdflatex" lt = 'cd "%s"&& sage-native-execute %s \\\\nonstopmode \\\\input{%s.tex} %s'%(base, command, filename, redirect) if debug: print "error running dvips and ps2pdf; trying pdflatex instead..." print cmd e = os.system(cmd + background) else: # don't have dvipng, so must have convert. run latex, dvips, convert. cmd = ' && '.join([lt, dvips, convert]) if debug: print cmd e = os.system(cmd + ' ' + redirect + background) if e: print "An error occurred." try: print open(base + '/' + filename + '.log').read() except IOError: pass return "Error latexing slide." return return_suffix | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
def __init__(self, debug=False, slide=False, density=150, pdflatex=None): | def __init__(self, debug=False, slide=False, density=150, pdflatex=None, engine=None): | def __init__(self, debug=False, slide=False, density=150, pdflatex=None): self.__debug = debug self.__slide = slide self.__pdflatex = pdflatex self.__density = density | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
density=None, pdflatex=None, locals={}): | density=None, pdflatex=None, engine=None, locals={}): | def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT: | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
- ``pdflatex`` - whether to use pdflatex. | - ``pdflatex`` - whether to use pdflatex. This is deprecated. Use ``engine`` option instead. - ``engine`` - latex engine to use. Currently latex, pdflatex, and xelatex are supported. | def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT: | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
or this command won't work. When using pdflatex, you must | or this command won't work. When using pdflatex or xelatex, you must | def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT: | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
if pdflatex is None: if self.__pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] | if engine is None: if self.__engine is None: engine = _Latex_prefs._option["engine"] | def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT: | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
pdflatex = bool(self.__pdflatex) | engine = self.__engine | def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT: | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
density=density, pdflatex=pdflatex, png=True) | density=density, engine=engine, png=True) | def eval(self, x, globals, strip=False, filename=None, debug=None, density=None, pdflatex=None, locals={}): """ INPUT: | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
def pdflatex(self, t = None): """ | def pdflatex(self, t = None): """ This is deprecated. Use engine("pdflatex") instead. | def pdflatex(self, t = None): """ Controls whether Sage uses PDFLaTeX or LaTeX when typesetting with :func:`view`, in ``%latex`` cells, etc. | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
return _Latex_prefs._option["pdflatex"] _Latex_prefs._option["pdflatex"] = bool(t) | from sage.misc.misc import deprecation deprecation('Use engine() instead.') return _Latex_prefs._option["engine"] == "pdflatex" elif t: from sage.misc.misc import deprecation deprecation('Use engine("pdflatex") instead.') self.engine("pdflatex") else: from sage.misc.misc import deprecation deprecation('Use engine("latex") instead.') self.engine("latex") def engine(self, e = None): r""" Set Sage to use ``e`` as latex engine when typesetting with :func:`view`, in ``%latex`` cells, etc. INPUT: - ``e`` -- 'latex', 'pdflatex', 'xelatex' or None If ``e`` is None, return the current engine. If using the XeLaTeX engine, it will almost always be necessary to set the proper preamble with :func:`extra_preamble` or :func:`add_to_preamble`. For example:: latex.extra_preamble(r'''\usepackage{fontspec,xunicode,xltxtra} \setmainfont[Mapping=tex-text]{some font here} \setmonofont[Mapping=tex-text]{another font here}''') EXAMPLES:: sage: latex.engine() 'latex' sage: latex.engine("pdflatex") sage: latex.engine() 'pdflatex' sage: latex.engine("xelatex") sage: latex.engine() 'xelatex' """ if e is None: return _Latex_prefs._option["engine"] if e == "latex": _Latex_prefs._option["engine"] = "latex" _Latex_prefs._option["engine_name"] = "LaTeX" elif e == "pdflatex": _Latex_prefs._option["engine"] = "pdflatex" _Latex_prefs._option["engine_name"] = "PDFLaTeX" elif e == "xelatex": _Latex_prefs._option["engine"] = e _Latex_prefs._option["engine_name"] = "XeLaTeX" else: raise ValueError, "%s is not a supported LaTeX engine. Use latex, pdflatex, or xelatex" % e | def pdflatex(self, t = None): """ Controls whether Sage uses PDFLaTeX or LaTeX when typesetting with :func:`view`, in ``%latex`` cells, etc. | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, engine=None, viewer = None, tightpage = None, mode='inline', **kwds): | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
- ``pdflatex`` - bool (default: False): use pdflatex. | - ``pdflatex`` - bool (default: False): use pdflatex. This is deprecated. Use 'engine' option instead. - ``engine`` - 'latex', 'pdflatex', or 'xelatex' | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is | If ``pdflatex`` is ``True``, then the latex engine is set to pdflatex. If the engine is either pdflatex or xelatex, it produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. | viewer, even in notebook mode. This also sets the latex engine to be ``pdflatex`` if the current engine is latex. | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
debug=debug, do_in_background=False, pdflatex=pdflatex) | debug=debug, do_in_background=False, engine=engine) | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] | if pdflatex: engine = "pdflatex" else: engine = _Latex_prefs._option["engine"] if viewer == "pdf" and engine == "latex": engine = "pdflatex" | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) | suffix = _run_latex_(tex_file, debug=debug, engine=engine, png=False) | def view(objects, title='SAGE', debug=False, sep='', tiny=False, pdflatex=None, viewer = None, tightpage = None, mode='inline', **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, and display typeset. If used from the command line, this requires that latex be installed. INPUT: - ``objects`` - list (or object) - ``title`` - string (default: 'Sage'): title for the document - ``debug`` - bool (default: False): print verbose output - ``sep`` - string (default: ''): separator between math objects - ``tiny`` - bool (default: False): use tiny font. - ``pdflatex`` - bool (default: False): use pdflatex. - ``viewer`` -- string or None (default: None): specify a viewer to use; currently the only options are None and 'pdf'. - ``tightpage`` - bool (default: False): use the LaTeX package 'preview' with the 'tightpage' option. - ``mode`` -- string (default: 'inline'): 'display' for displaymath or 'inline' for inline math OUTPUT: Display typeset objects. This function behaves differently depending on whether in notebook mode or not. If not in notebook mode, the output is displayed in a separate viewer displaying a dvi (or pdf) file, with the following: the title string is printed, centered, at the top. Beneath that, each object in ``objects`` is typeset on its own line, with the string ``sep`` inserted between these lines. The value of ``sep`` is inserted between each element of the list ``objects``; you can, for example, add vertical space between objects with ``sep='\\vspace{15mm}'``, while ``sep='\\hrule'`` adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. If ``pdflatex`` is ``True``, then this produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets ``pdflatex`` to ``True``. Setting the option ``tightpage`` to ``True`` tells LaTeX to use the package 'preview' with the 'tightpage' option. Then, each object is typeset in its own page, and that page is cropped to exactly the size of the object. This is typically useful for very large pictures (like graphs) generated with tikz. This only works when using a separate viewer. Note that the object are currently typeset in plain math mode rather than displaymath, because the latter imposes a limit on the width of the picture. Technically, ``tightpage`` adds :: \\usepackage[tightpage,active]{preview} \\PreviewEnvironment{page} to the LaTeX preamble, and replaces the ``\\[`` and ``\\]`` around each object by ``\\begin{page}$`` and ``$\\end{page}``. If in notebook mode with ``viewer`` equal to ``None``, this usually uses jsMath -- see the next paragraph for the exception -- to display the output in the notebook. Only the first argument, ``objects``, is relevant; the others are ignored. If ``objects`` is a list, each object is printed on its own line. In the notebook, this *does* *not* use jsMath if the LaTeX code for ``objects`` contains a string in :meth:`latex.jsmath_avoid_list() <Latex.jsmath_avoid_list>`. In this case, it creates and displays a png file. EXAMPLES:: sage: sage.misc.latex.EMBEDDED_MODE = True sage: view(3) <html><span class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</span></html> sage: view(3, mode='display') <html><div class="math">\newcommand{\Bold}[1]{\mathbf{#1}}3</div></html> sage: sage.misc.latex.EMBEDDED_MODE = False """ if isinstance(objects, LatexExpr): s = str(objects) else: if tightpage == True: latex_options = {'extra_preamble':'\\usepackage[tightpage,active]{preview}\\PreviewEnvironment{page}', 'math_left':'\\begin{page}$', 'math_right':'$\\end{page}'} else: latex_options = {} s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) # notebook if EMBEDDED_MODE and viewer is None: jsMath_okay = True for t in latex.jsmath_avoid_list(): if s.find(t) != -1: jsMath_okay = False if not jsMath_okay: break if jsMath_okay: print JSMath().eval(objects, mode=mode) # put comma at end of line? else: base_dir = os.path.abspath("") png_file = graphics_filename(ext='png') png_link = "cell://" + png_file png(objects, os.path.join(base_dir, png_file), debug=debug, do_in_background=False, pdflatex=pdflatex) print '<html><img src="%s"></html>'%png_link # put comma at end of line? return # command line if viewer == "pdf": pdflatex = True if pdflatex is None: pdflatex = _Latex_prefs._option["pdflatex"] tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") open(tex_file,'w').write(s) suffix = _run_latex_(tex_file, debug=debug, pdflatex=pdflatex, png=False) if suffix == "pdf": from sage.misc.viewer import pdf_viewer viewer = pdf_viewer() elif suffix == "dvi": from sage.misc.viewer import dvi_viewer viewer = dvi_viewer() else: print "Latex error" return output_file = os.path.join(tmp, "sage." + suffix) os.system('sage-native-execute %s %s'%(viewer, output_file)) return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
do_in_background=False, tiny=False, pdflatex=True): | do_in_background=False, tiny=False, pdflatex=True, engine='pdflatex'): | def png(x, filename, density=150, debug=False, do_in_background=False, tiny=False, pdflatex=True): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - ``x`` - object to be displayed - ``filename`` - file in which to save the image - ``density`` - integer (default: 150) - ``debug`` - bool (default: False): print verbose output - ``do_in_background`` - bool (default: False): create the file in the background. - ``tiny`` - bool (default: False): use 'tiny' font - ``pdflatex`` - bool (default: False): use pdflatex. EXAMPLES:: sage: from sage.misc.latex import png sage: png(ZZ[x], SAGE_TMP + "zz.png", do_in_background=False) # random - error if no latex """ import sage.plot.all if sage.plot.all.is_Graphics(x): x.save(filename) return # if not graphics: create a string of latex code to write in a file s = _latex_file_([x], math_left='$\\displaystyle', math_right='$', title='', debug=debug, tiny=tiny, extra_preamble='\\textheight=2\\textheight') # path name for permanent png output abs_path_to_png = os.path.abspath(filename) # temporary directory to store stuff tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") png_file = os.path.join(tmp, "sage.png") # write latex string to file open(tex_file,'w').write(s) # run latex on the file, producing png output to png_file e = _run_latex_(tex_file, density=density, debug=debug, png=True, do_in_background=do_in_background, pdflatex=pdflatex) if e.find("Error") == -1: # if no errors, copy png_file to the appropriate place shutil.copy(png_file, abs_path_to_png) else: print "Latex error" if debug: return s return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
- ``pdflatex`` - bool (default: False): use pdflatex. | - ``pdflatex`` - bool (default: True): use pdflatex. This option is deprecated. Use ``engine`` option instead. See below. - ``engine`` - 'latex', 'pdflatex', or 'xelatex' (default: 'pdflatex') | def png(x, filename, density=150, debug=False, do_in_background=False, tiny=False, pdflatex=True): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - ``x`` - object to be displayed - ``filename`` - file in which to save the image - ``density`` - integer (default: 150) - ``debug`` - bool (default: False): print verbose output - ``do_in_background`` - bool (default: False): create the file in the background. - ``tiny`` - bool (default: False): use 'tiny' font - ``pdflatex`` - bool (default: False): use pdflatex. EXAMPLES:: sage: from sage.misc.latex import png sage: png(ZZ[x], SAGE_TMP + "zz.png", do_in_background=False) # random - error if no latex """ import sage.plot.all if sage.plot.all.is_Graphics(x): x.save(filename) return # if not graphics: create a string of latex code to write in a file s = _latex_file_([x], math_left='$\\displaystyle', math_right='$', title='', debug=debug, tiny=tiny, extra_preamble='\\textheight=2\\textheight') # path name for permanent png output abs_path_to_png = os.path.abspath(filename) # temporary directory to store stuff tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") png_file = os.path.join(tmp, "sage.png") # write latex string to file open(tex_file,'w').write(s) # run latex on the file, producing png output to png_file e = _run_latex_(tex_file, density=density, debug=debug, png=True, do_in_background=do_in_background, pdflatex=pdflatex) if e.find("Error") == -1: # if no errors, copy png_file to the appropriate place shutil.copy(png_file, abs_path_to_png) else: print "Latex error" if debug: return s return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
pdflatex=pdflatex) | engine=engine) | def png(x, filename, density=150, debug=False, do_in_background=False, tiny=False, pdflatex=True): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - ``x`` - object to be displayed - ``filename`` - file in which to save the image - ``density`` - integer (default: 150) - ``debug`` - bool (default: False): print verbose output - ``do_in_background`` - bool (default: False): create the file in the background. - ``tiny`` - bool (default: False): use 'tiny' font - ``pdflatex`` - bool (default: False): use pdflatex. EXAMPLES:: sage: from sage.misc.latex import png sage: png(ZZ[x], SAGE_TMP + "zz.png", do_in_background=False) # random - error if no latex """ import sage.plot.all if sage.plot.all.is_Graphics(x): x.save(filename) return # if not graphics: create a string of latex code to write in a file s = _latex_file_([x], math_left='$\\displaystyle', math_right='$', title='', debug=debug, tiny=tiny, extra_preamble='\\textheight=2\\textheight') # path name for permanent png output abs_path_to_png = os.path.abspath(filename) # temporary directory to store stuff tmp = tmp_dir('sage_viewer') tex_file = os.path.join(tmp, "sage.tex") png_file = os.path.join(tmp, "sage.png") # write latex string to file open(tex_file,'w').write(s) # run latex on the file, producing png output to png_file e = _run_latex_(tex_file, density=density, debug=debug, png=True, do_in_background=do_in_background, pdflatex=pdflatex) if e.find("Error") == -1: # if no errors, copy png_file to the appropriate place shutil.copy(png_file, abs_path_to_png) else: print "Latex error" if debug: return s return | 12cbced4c423573c5a4da0ddb9e58a2d0102170d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/12cbced4c423573c5a4da0ddb9e58a2d0102170d/latex.py |
this function is not called) is n=15, but it might have to be | this function is not called) is ``n=15``, but it might have to be | def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n) | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- `n` (long) -- real precision used for floating point | - ``n`` (long) -- real precision used for floating point | def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n) | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
.. note:: This change is global and affects all of Sage. | .. warning:: This change is global and affects *all* of Sage. | def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n) | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
curve using the Curvedata class from eclib, called here an 'mwrank | curve using the ``Curvedata`` class from ``eclib``, called here an 'mwrank | def set_precision(n): r""" Set the global NTL real number precision. This has a massive effect on the speed of mwrank calculations. The default (used if this function is not called) is n=15, but it might have to be increased if a computation fails. In this case, one must recreate the mwrank curve from scratch after resetting this precision. INPUT: - `n` (long) -- real precision used for floating point computations in the library, in decimal digits. .. note:: This change is global and affects all of Sage. EXAMPLES:: sage: mwrank_set_precision(20) """ # don't want to load mwrank every time Sage starts up, so we do # the import here. from sage.libs.mwrank.mwrank import set_precision set_precision(n) | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. If strictly less than 5 invariants are given, then the first ones are set to 0, so, e.g., ``[3,4] means `a_1=a_2=a_3=0` and `a_4=3`, `a_6=4`. INPUT: - `ainvs` (list or tuple) -- a list of <= 5 integers, the coefficients of a nonsingular Weierstrass equation. - `verbose` (bool, default False) -- verbosity flag. If True, then all Selmer group computations will be verbose. | ``ainvs``, which is a list of 5 or less *integers* `a_1`, `a_2`, `a_3`, `a_4`, and `a_5`. See the docstring of this class for full documentation. | def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
This example illustrates that omitted $a$-invariants default to $0$:: sage: e = mwrank_EllipticCurve([3, -4]) sage: e y^2 = x^3 + 3*x - 4 sage: e.ainvs() [0, 0, 0, 3, -4] The entries of the input list are coerced to :class:`int`. If this is impossible then an error is raised:: sage: e = mwrank_EllipticCurve([3, -4.8]); e Traceback (most recent call last): ... TypeError: ainvs must be a list of integers. When you enter a singular model you get an exception:: sage: e = mwrank_EllipticCurve([0, 0]) Traceback (most recent call last): ... ArithmeticError: Invariants (= [0, 0, 0, 0, 0]) do not describe an elliptic curve. | def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
|
if not isinstance(ainvs, list) and len(ainvs) <= 5: raise TypeError, "ainvs must be a list of length at most 5." | if not isinstance(ainvs, (list,tuple)) or not len(ainvs) <= 5: raise TypeError, "ainvs must be a list or tuple of length at most 5." | def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
||
raise TypeError, "ainvs must be a list of integers." | raise TypeError, "ainvs must be a list or tuple of integers." | def __init__(self, ainvs, verbose=False): r""" Create the mwrank elliptic curve with invariants ``a_invs``, which is a list of `\leq 5` \emph{integers} `a_1`, `a_2`, `a_3`, `a_4`, and `a_`$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Set the verbosity of printing of output by the 2-descent and | Set the verbosity of printing of output by the :meth:`two_descent()` and | def set_verbose(self, verbose): """ Set the verbosity of printing of output by the 2-descent and other functions. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- `verbose` (int) -- if positive, print lots of output when | - ``verbose`` (int) -- if positive, print lots of output when | def set_verbose(self, verbose): """ Set the verbosity of printing of output by the 2-descent and other functions. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
sage: E.saturate() | sage: E.saturate() | def set_verbose(self, verbose): """ Set the verbosity of printing of output by the 2-descent and other functions. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Returns the underlying _Curvedata class for this mwrank elliptic curve. | Returns the underlying :class:`_Curvedata` class for this mwrank elliptic curve. | def _curve_data(self): r""" Returns the underlying _Curvedata class for this mwrank elliptic curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- ``verbose`` (bool, default True) -- print what mwrank is doing - ``selmer_only`` (bool, default False) -- selmer_only switch | - ``verbose`` (bool, default ``True``) -- print what mwrank is doing. - ``selmer_only`` (bool, default ``False``) -- ``selmer_only`` switch. | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
quartic point search - ``second_limit`` (int, default 8) -- bound on `\log `max(|x|,|z|)`, i.e. logarithmic | quartic point search. - ``second_limit`` (int, default 8) -- bound on `\log \max(|x|,|z|)`, i.e. logarithmic. | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
quartic search. n_aux=-1 causes default (8) to be used. | quartic search. ``n_aux=-1`` causes default (8) to be used. | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- ``second_descent`` (bool, default True) -- (only relevant | - ``second_descent`` (bool, default ``True``) -- (only relevant | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
descent. Default strongloy recommended. | descent. *Default strongly recommended.* | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Nothing -- nothing is returned | Nothing -- nothing is returned. | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
second_descent = int(second_descent) | second_descent = int(second_descent) | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Returns the rank of this curve, computed using 2-descent. | Returns the rank of this curve, computed using :meth:`two_descent()`. | def rank(self): """ Returns the rank of this curve, computed using 2-descent. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
upper bound may be obtained using the function rank_bound(). | upper bound may be obtained using the function :meth:`rank_bound()`. | def rank(self): """ Returns the rank of this curve, computed using 2-descent. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
the method :meth:`certain`. | the method :meth:`certain()`. | def rank(self): """ Returns the rank of this curve, computed using 2-descent. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
using 2-descent. | using :meth:`two_descent()`. | def rank_bound(self): """ Returns an upper bound for the rank of this curve, computed using 2-descent. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
of order 4, we only obtain an upper bound of 2: | of order 4, we only obtain an upper bound of 2:: | def rank_bound(self): """ Returns an upper bound for the rank of this curve, computed using 2-descent. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
In this case the value returned by :meth:`rank` is only a lower bound in general (though in this is correct):: | In this case the value returned by :meth:`rank()` is only a lower bound in general (though this is correct):: | def rank_bound(self): """ Returns an upper bound for the rank of this curve, computed using 2-descent. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
the computation again but turn off the second descent:: | the computation again but turn off ``second_descent``:: | def selmer_rank(self): r""" Returns the rank of the 2-Selmer group of the curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
but with no 2-torsion, the selmer rank is strictly greater | but with no 2-torsion, the Selmer rank is strictly greater | def selmer_rank(self): r""" Returns the rank of the 2-Selmer group of the curve. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
primes up to bound. | primes up to ``bound``. | def saturate(self, bound=-1): """ Compute the saturation of the Mordell-Weil group at all primes up to bound. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- `bound` (int, default -1) -- Use `-1` (the default) to | - ``bound`` (int, default -1) -- Use `-1` (the default) to | def saturate(self, bound=-1): """ Compute the saturation of the Mordell-Weil group at all primes up to bound. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` | Returns ``True`` if the last :meth:`two_descent()` call provably correctly computed the rank. If :meth:`two_descent()` hasn't been called, then it is first called by :meth:`certain()` | def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
The result is true if and only if the results of the methods :meth:`rank` and :meth:`rank_bound` are equal. | The result is ``True`` if and only if the results of the methods :meth:`rank()` and :meth:`rank_bound()` are equal. | def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
for the curve `y^2 + y = x^3 - x^2 - 120x - 2183`.:: | for the curve `y^2 + y = x^3 - x^2 - 120x - 2183`:: | def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
computing the L-function), but Sha has order 4 and the $2$-torsion is trivial, so mwrank cannot conclusively | computing the `L`-function), but Sha has order 4 and the 2-torsion is trivial, so mwrank cannot conclusively | def certain(self): r""" True if the last :meth:`two_descent` call provably correctly computed the rank. If :meth:`two_descent` hasn't been called, then it is first called by :meth:`certain` using the default parameters. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
floating point number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$. | floating point number `B` such that if `P` is a point on the curve, then the naive logarithmic height `h(P)` is less than `B+\hat{h}(P)`, where `\hat{h}(P)` is the canonical height of `P`. | def CPS_height_bound(self): r""" Return the Cremona-Prickett-Siksek height bound. This is a floating point number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$. | number `B` such that if `P` is a point on the curve, then the naive logarithmic height `h(P)` is less than `B+\hat{h}(P)`, where `\hat{h}(P)` is the canonical height of `P`. | def silverman_bound(self): r""" Return the Silverman height bound. This is a floating point number $B$ such that if $P$ is a point on the curve, then the naive logarithmic height $h(P)$ is less than $B+\hat{h}(P)$, where $\hat{h}(P)$ is the canonical height of $P$. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
INPUT: - `curve` (:class:`mwrank_EllipticCurve`) -- the underlying elliptic curve. - `verbose` (bool, default False) -- verbosity flag (controls amount of output produced in point searches) - `pp` (int, default 1) -- process points flag (if nonzero, the points found are processed, so that at all times only a `\ZZ`-basis for the subgroup generated by the points found so far is stored; if zero, no processing is done and all points found are stored). - `maxr` (int, default 999) -- maximum rank (quit point searching once the points found generate a subgroup of this rank; useful if an upper bound for the rank is already known). | See the docstring of this class for full documentation. | def __init__(self, curve, verbose=True, pp=1, maxr=999): r""" Constructor for the :class:`mwrank_MordellWeil` class. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [] sage: EQ.search(2) The previous command produces the following output:: P1 = [0:1:0] is torsion point, order 1 P1 = [1:-1:1] is torsion point, order 2 P1 = [2:2:1] is torsion point, order 3 P1 = [9:23:1] is torsion point, order 6 sage: E = mwrank_EllipticCurve([0,0,1,-7,6]) sage: EQ = mwrank_MordellWeil(E) sage: EQ.search(2) sage: EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] Example to illustrate the verbose parameter:: sage: E = mwrank_EllipticCurve([0,0,1,-7,6]) sage: EQ = mwrank_MordellWeil(E, verbose=False) sage: EQ.search(1) sage: EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] sage: EQ = mwrank_MordellWeil(E, verbose=True) sage: EQ.search(1) The previous command produces the following output:: P1 = [0:1:0] is torsion point, order 1 P1 = [-3:0:1] is generator number 1 saturating up to 20...Checking 2-saturation Points have successfully been 2-saturated (max q used = 7) Checking 3-saturation Points have successfully been 3-saturated (max q used = 7) Checking 5-saturation Points have successfully been 5-saturated (max q used = 23) Checking 7-saturation Points have successfully been 7-saturated (max q used = 41) Checking 11-saturation Points have successfully been 11-saturated (max q used = 17) Checking 13-saturation Points have successfully been 13-saturated (max q used = 43) Checking 17-saturation Points have successfully been 17-saturated (max q used = 31) Checking 19-saturation Points have successfully been 19-saturated (max q used = 37) done P2 = [-2:3:1] is generator number 2 saturating up to 20...Checking 2-saturation possible kernel vector = [1,1] This point may be in 2E(Q): [14:-52:1] ...and it is! Replacing old generator Points have successfully been 2-saturated (max q used = 7) Index gain = 2^1 Checking 3-saturation Points have successfully been 3-saturated (max q used = 13) Checking 5-saturation Points have successfully been 5-saturated (max q used = 67) Checking 7-saturation Points have successfully been 7-saturated (max q used = 53) Checking 11-saturation Points have successfully been 11-saturated (max q used = 73) Checking 13-saturation Points have successfully been 13-saturated (max q used = 103) Checking 17-saturation Points have successfully been 17-saturated (max q used = 113) Checking 19-saturation Points have successfully been 19-saturated (max q used = 47) done (index = 2). Gained index 2, new generators = [ [1:-1:1] [-2:3:1] ] P3 = [-14:25:8] is generator number 3 saturating up to 20...Checking 2-saturation Points have successfully been 2-saturated (max q used = 11) Checking 3-saturation Points have successfully been 3-saturated (max q used = 13) Checking 5-saturation Points have successfully been 5-saturated (max q used = 71) Checking 7-saturation Points have successfully been 7-saturated (max q used = 101) Checking 11-saturation Points have successfully been 11-saturated (max q used = 127) Checking 13-saturation Points have successfully been 13-saturated (max q used = 151) Checking 17-saturation Points have successfully been 17-saturated (max q used = 139) Checking 19-saturation Points have successfully been 19-saturated (max q used = 179) done (index = 1). P4 = [-1:3:1] = -1*P1 + -1*P2 + -1*P3 (mod torsion) P4 = [0:2:1] = 2*P1 + 0*P2 + 1*P3 (mod torsion) P4 = [2:13:8] = -3*P1 + 1*P2 + -1*P3 (mod torsion) P4 = [1:0:1] = -1*P1 + 0*P2 + 0*P3 (mod torsion) P4 = [2:0:1] = -1*P1 + 1*P2 + 0*P3 (mod torsion) P4 = [18:7:8] = -2*P1 + -1*P2 + -1*P3 (mod torsion) P4 = [3:3:1] = 1*P1 + 0*P2 + 1*P3 (mod torsion) P4 = [4:6:1] = 0*P1 + -1*P2 + -1*P3 (mod torsion) P4 = [36:69:64] = 1*P1 + -2*P2 + 0*P3 (mod torsion) P4 = [68:-25:64] = -2*P1 + -1*P2 + -2*P3 (mod torsion) P4 = [12:35:27] = 1*P1 + -1*P2 + -1*P3 (mod torsion) sage: EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] Example to illustrate the `process points` parameter:: sage: E = mwrank_EllipticCurve([0,0,1,-7,6]) sage: EQ = mwrank_MordellWeil(E, verbose=False, pp=1) sage: EQ.search(1); EQ Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] sage: EQ = mwrank_MordellWeil(E, verbose=False, pp=0) sage: EQ.search(1); EQ Subgroup of Mordell Weil group: [[-3:0:1], [-2:3:1], [-14:25:8], [-1:3:1], [0:2:1], [2:13:8], [1:0:1], [2:0:1], [18:7:8], [3:3:1], [4:6:1], [36:69:64], [68:-25:64], [12:35:27]] | Subgroup of Mordell-Weil group: [] | def __init__(self, curve, verbose=True, pp=1, maxr=999): r""" Constructor for the :class:`mwrank_MordellWeil` class. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
'Subgroup of Mordell Weil group: []' | 'Subgroup of Mordell-Weil group: []' | def __repr__(self): r""" String representation of this Mordell-Weil subgroup. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
'Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]]' """ return "Subgroup of Mordell Weil group: %s"%self.__mw | 'Subgroup of Mordell-Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]]' """ return "Subgroup of Mordell-Weil group: %s"%self.__mw | def __repr__(self): r""" String representation of this Mordell-Weil subgroup. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
This function allows one to add points to a mwrank_MordellWeil object. Process points in the list v, with saturation at primes up to sat. If sat = 0 (the default), do no saturation. | This function allows one to add points to a :class:`mwrank_MordellWeil` object. Process points in the list ``v``, with saturation at primes up to ``sat``. If ``sat`` is zero (the default), do no saturation. | def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- `v` (list of 3-tuples or lists of ints or Integers) -- a | - ``v`` (list of 3-tuples or lists of ints or Integers) -- a | def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- `sat` (int, default 0) --saturate at primes up to sat, or at all primes if sat=0. | - ``sat`` (int, default 0) -- saturate at primes up to ``sat``, or at *all* primes if ``sat`` is zero. | def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
None. But note that if the verbose flag is set, then there | None. But note that if the ``verbose`` flag is set, then there | def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Example to illustrate the saturation parameter:: | Example to illustrate the saturation parameter ``sat``:: | def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
raise TypeError, "v (=%s) must be a list of 3-tuples of ints"%v | raise TypeError, "v (=%s) must be a list of 3-tuples (or 3-element lists) of ints"%v | def process(self, v, sat=0): """ This function allows one to add points to a mwrank_MordellWeil object. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
but the interface currently returns the output as a float. | but the interface currently returns the output as a ``float``. | def regulator(self): """ Return the regulator of the points in this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
(float) the regulator of the points in this subgroup. | (float) The regulator of the points in this subgroup. | def regulator(self): """ Return the regulator of the points in this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
OUTPUT: (int) The rank of this subgroup of the Mordell-Weil group. | def rank(self): """ Return the rank of this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
|
Subgroup of Mordell Weil group: [] | Subgroup of Mordell-Weil group: [] | def rank(self): """ Return the rank of this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] | Subgroup of Mordell-Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] | def rank(self): """ Return the rank of this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
all primes up to `max_prime`. If `-1` (default) then an | all primes up to ``max_prime``. If `-1` (the default), an | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
computed bound is greater than a value set by the eclib | computed bound is greater than a value set by the ``eclib`` | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- ``odd_primes_only`` (bool, default False) -- only do | - ``odd_primes_only`` (bool, default ``False``) -- only do | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
via 2-descent they should alreday be 2-saturated.) | via :meth:``two_descent()`` they should already be 2-saturated.) | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- ``ok`` (bool) is True if and only if the saturation was | - ``ok`` (bool) -- ``True`` if and only if the saturation was | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
the computed saturation bound being too high, then True indicates that the subgroup is saturated at `\emph{all}` | the computed saturation bound being too high, then ``True`` indicates that the subgroup is saturated at *all* | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
- ``index`` (int) is the index of the group generated by the | - ``index`` (int) -- the index of the group generated by the | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
uses floating points methods based on elliptic logarithms to | uses floating point methods based on elliptic logarithms to | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
We emphasize that if this function returns True as the first return argument, and if the default was used for the parameter ``sat_bnd``, then the points in the basis after calling this function are saturated at `\emph{all}` primes, | We emphasize that if this function returns ``True`` as the first return argument (``ok``), and if the default was used for the parameter ``max_prime``, then the points in the basis after calling this function are saturated at *all* primes, | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
saturate up to, and that prime is `\leq` ``max_prime``. | saturate up to, and that prime might be smaller than ``max_prime``. | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
calling search. So calling search up to height 20 then calling saturate results in another search up to height 18. | calling :meth:`search()`. So calling :meth:`search()` up to height 20 then calling :meth:`saturate()` results in another search up to height 18. | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[1547:-2967:343], [2707496766203306:864581029138191:2969715140223272], [-13422227300:-49322830557:12167000000]] | Subgroup of Mordell-Weil group: [[1547:-2967:343], [2707496766203306:864581029138191:2969715140223272], [-13422227300:-49322830557:12167000000]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[-2:3:1], [2707496766203306:864581029138191:2969715140223272], [-13422227300:-49322830557:12167000000]] | Subgroup of Mordell-Weil group: [[-2:3:1], [2707496766203306:864581029138191:2969715140223272], [-13422227300:-49322830557:12167000000]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[-2:3:1], [-14:25:8], [-13422227300:-49322830557:12167000000]] | Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [-13422227300:-49322830557:12167000000]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Of course, the ``process`` function would have done all this | Of course, the :meth:`process()` function would have done all this | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | Subgroup of Mordell-Weil group: [[-2:3:1], [-14:25:8], [1:-1:1]] | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
But we would still need to use the ``saturate`` function to | But we would still need to use the :meth:`saturate()` function to | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
side-effect. It proves that the inde of the points in their | side-effect. It proves that the index of the points in their | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
by reducing the poits modulo all primes of good reduction up | by reducing the points modulo all primes of good reduction up | def saturate(self, max_prime=-1, odd_primes_only=False): r""" Saturate this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
On 32-bit machines, this MUST be < 21.48 else $\exp(h_lim)>2^31$ and overflows. On 64-bit machines it must be at most 43.668. However, this bound is a logarithic | On 32-bit machines, this *must* be < 21.48 else `\exp(h_{\text{lim}}) > 2^{31}` and overflows. On 64-bit machines, it must be *at most* 43.668. However, this bound is a logarithmic | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] In the next example, a serach bound of 12 is needed to find a non-torsin point:: | Subgroup of Mordell-Weil group: [[1:-1:1], [-2:3:1], [-14:25:8]] In the next example, a search bound of 12 is needed to find a non-torsion point:: | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [] | Subgroup of Mordell-Weil group: [] | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subgroup of Mordell Weil group: [[4413270:10381877:27000]] | Subgroup of Mordell-Weil group: [[4413270:10381877:27000]] | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
if height_limit >= 21.4: | if height_limit >= 21.4: | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
verbose == bool(verbose) | verbose = bool(verbose) | def search(self, height_limit=18, verbose=False): r""" Search for new points, and add them to this subgroup of the Mordell-Weil group. | 9932a677a12413086a59217c4c0d425b0543b6eb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/9932a677a12413086a59217c4c0d425b0543b6eb/interface.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.