Sharedlatex-tests / example.sagetex.sage.pyOpen in CoCalc
## -*- encoding: utf-8 -*-

# This file was *autogenerated* from the file example.sagetex.sage
from sage.all_cmdline import *   # import sage library

_sage_const_3 = Integer(3); _sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_0 = Integer(0); _sage_const_7 = Integer(7); _sage_const_6 = Integer(6); _sage_const_5 = Integer(5); _sage_const_4 = Integer(4); _sage_const_104 = Integer(104); _sage_const_9 = Integer(9); _sage_const_8 = Integer(8); _sage_const_266 = Integer(266); _sage_const_28 = Integer(28); _sage_const_29 = Integer(29); _sage_const_15 = Integer(15); _sage_const_9999 = Integer(9999); _sage_const_41 = Integer(41); _sage_const_42 = Integer(42); _sage_const_43 = Integer(43); _sage_const_131 = Integer(131); _sage_const_45 = Integer(45); _sage_const_60 = Integer(60); _sage_const_48 = Integer(48); _sage_const_85 = Integer(85); _sage_const_86 = Integer(86); _sage_const_80 = Integer(80); _sage_const_82 = Integer(82); _sage_const_155 = Integer(155); _sage_const_172 = Integer(172); _sage_const_175 = Integer(175); _sage_const_0p4 = RealNumber('0.4'); _sage_const_150 = Integer(150); _sage_const_100000 = Integer(100000); _sage_const_152 = Integer(152); _sage_const_193 = Integer(193); _sage_const_122 = Integer(122); _sage_const_191 = Integer(191); _sage_const_197 = Integer(197); _sage_const_64 = Integer(64); _sage_const_2019 = Integer(2019); _sage_const_13 = Integer(13); _sage_const_12 = Integer(12); _sage_const_11 = Integer(11); _sage_const_10 = Integer(10); _sage_const_59 = Integer(59); _sage_const_31 = Integer(31); _sage_const_55 = Integer(55); _sage_const_32 = Integer(32); _sage_const_53 = Integer(53); _sage_const_36 = Integer(36); _sage_const_108 = Integer(108); _sage_const_99 = Integer(99); _sage_const_76 = Integer(76); _sage_const_71 = Integer(71); _sage_const_73 = Integer(73); _sage_const_125 = Integer(125); _sage_const_100 = Integer(100); _sage_const_92 = Integer(92); _sage_const_102 = Integer(102); _sage_const_169 = Integer(169); _sage_const_79 = Integer(79); _sage_const_94 = Integer(94); _sage_const_144 = Integer(144); _sage_const_113 = Integer(113); _sage_const_146 = Integer(146); _sage_const_141 = Integer(141); _sage_const_120 = Integer(120); _sage_const_117 = Integer(117)## This file (example.sagetex.sage) was *autogenerated* from example.tex with sagetex.sty version 2015/08/26 v3.0-92d9f7a.
import sagetex
_st_ = sagetex.SageTeXProcessor('example', version='2015/08/26 v3.0-92d9f7a', version_check=True)
try:
 _st_.current_tex_line = _sage_const_28 
 _st_.inline(_sage_const_0 , latex(_sage_const_2 +_sage_const_2 ))
except:
 _st_.goboom(_sage_const_28 )
try:
 _st_.current_tex_line = _sage_const_29 
 _st_.inline(_sage_const_1 , latex(mod(_sage_const_2019 , _sage_const_100 )))
except:
 _st_.goboom(_sage_const_29 )
try:
 _st_.current_tex_line = _sage_const_31 
 _st_.inline(_sage_const_2 , latex(Integer(mod(_sage_const_2019 , _sage_const_100 ))**_sage_const_9 ))
except:
 _st_.goboom(_sage_const_31 )
try:
 _st_.current_tex_line = _sage_const_32 
 _st_.inline(_sage_const_3 , latex(_sage_const_2019 %_sage_const_42 ))
except:
 _st_.goboom(_sage_const_32 )
_st_.current_tex_line = _sage_const_36 
_st_.blockbegin()
try:
   _sage_const_1 +_sage_const_1 
   var('a,b,c,d')
   eqn = [a+b*c==_sage_const_1 , b-a*c==_sage_const_0 , a+b==_sage_const_5 ]
   s = solve(eqn, a,b,c)
except:
 _st_.goboom(_sage_const_41 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_43 
 _st_.inline(_sage_const_4 , latex(eqn))
except:
 _st_.goboom(_sage_const_43 )
try:
 _st_.current_tex_line = _sage_const_45 
 _st_.inline(_sage_const_5 , latex(s[_sage_const_0 ]))
except:
 _st_.goboom(_sage_const_45 )
try:
 _st_.current_tex_line = _sage_const_48 
 _st_.inline(_sage_const_6 , latex(s[_sage_const_1 ]))
except:
 _st_.goboom(_sage_const_48 )
_st_.current_tex_line = _sage_const_53 
_st_.blockbegin()
try:
   E = EllipticCurve("37a")
except:
 _st_.goboom(_sage_const_55 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_59 
 _st_.inline(_sage_const_7 , latex(E))
except:
 _st_.goboom(_sage_const_59 )
try:
 _st_.current_tex_line = _sage_const_60 
 _st_.inline(_sage_const_8 , latex(E.discriminant()))
except:
 _st_.goboom(_sage_const_60 )
_st_.current_tex_line = _sage_const_64 
_st_.blockbegin()
try:
 try:
   E = load('E2')
 except IOError:
   E = EllipticCurve([_sage_const_1 ,_sage_const_2 ,_sage_const_7 ,_sage_const_4 ,_sage_const_5 ])
   E.anlist(_sage_const_100000 )
   E.save('E2')
except:
 _st_.goboom(_sage_const_71 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_73 
 _st_.inline(_sage_const_9 , latex(E))
except:
 _st_.goboom(_sage_const_73 )
try:
 _st_.current_tex_line = _sage_const_73 
 _st_.inline(_sage_const_10 , latex(E.anlist(_sage_const_100000 )[_sage_const_9999 ]))
except:
 _st_.goboom(_sage_const_73 )
_st_.current_tex_line = _sage_const_76 
_st_.blockbegin()
try:
   e = _sage_const_2 
   e = _sage_const_3 *e + _sage_const_1 
except:
 _st_.goboom(_sage_const_79 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_80 
 _st_.inline(_sage_const_11 , latex(e))
except:
 _st_.goboom(_sage_const_80 )
_st_.current_tex_line = _sage_const_82 
_st_.blockbegin()
try:
   var('x')
   __tmp__=var("x"); f = symbolic_expression(log(sin(x)/x)).function(x)
except:
 _st_.goboom(_sage_const_85 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_86 
 _st_.inline(_sage_const_12 , latex( f.taylor(x, _sage_const_0 , _sage_const_10 ) ))
except:
 _st_.goboom(_sage_const_86 )
try:
 _st_.current_tex_line = _sage_const_92 
 _st_.plot(_sage_const_0 , format='notprovided', _p_=E.plot(-_sage_const_3 ,_sage_const_3 ))
except:
 _st_.goboom(_sage_const_92 )
_st_.current_tex_line = _sage_const_94 
_st_.blockbegin()
try:
   # the var line is unecessary unless you've defined x to be something
   # other than a symbolic variable
   var('x')
   __tmp__=var("x"); f = symbolic_expression(-x**_sage_const_3 +_sage_const_4 *x**_sage_const_2 +_sage_const_7 *x-_sage_const_4 ).function(x)
except:
 _st_.goboom(_sage_const_99 )
_st_.blockend()
_st_.current_tex_line = _sage_const_102 
_st_.blockbegin()
try:
   p = plot(f, x, -_sage_const_5 , _sage_const_8 )
except:
 _st_.goboom(_sage_const_104 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_108 
 _st_.plot(_sage_const_1 , format='notprovided', _p_=p)
except:
 _st_.goboom(_sage_const_108 )
try:
 _st_.current_tex_line = _sage_const_113 
 _st_.plot(_sage_const_2 , format='notprovided', _p_=p, axes=False)
except:
 _st_.goboom(_sage_const_113 )
_st_.current_tex_line = _sage_const_117 
_st_.blockbegin()
try:
   f = maxima('sin(.4 * x)^3*cos(x)')
   g = f.integrate('x')
except:
 _st_.goboom(_sage_const_120 )
_st_.blockend()
_st_.current_tex_line = _sage_const_122 
_st_.blockbegin()
try:
   # g is a Maxima thingy, it needs to get converted into a Sage object
   plot1 = plot(g.sage(),x,-_sage_const_1 ,_sage_const_2 *pi)
except:
 _st_.goboom(_sage_const_125 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_131 
 _st_.plot(_sage_const_3 , format='png', _p_=plot1)
except:
 _st_.goboom(_sage_const_131 )
try:
 _st_.current_tex_line = _sage_const_141 
 _st_.plot(_sage_const_4 , format='notprovided', _p_=plot1 + plot(f.sage(),x,-_sage_const_1 ,_sage_const_2 *pi,rgbcolor=hue(_sage_const_0p4 )), figsize=[_sage_const_1 ,_sage_const_2 ])
except:
 _st_.goboom(_sage_const_141 )
try:
 _st_.current_tex_line = _sage_const_144 
 _st_.plot(_sage_const_5 , format='notprovided', _p_=graphs.FlowerSnark().plot())
except:
 _st_.goboom(_sage_const_144 )
_st_.current_tex_line = _sage_const_146 
_st_.blockbegin()
try:
   G4 = DiGraph({_sage_const_1 :[_sage_const_2 ,_sage_const_2 ,_sage_const_3 ,_sage_const_5 ], _sage_const_2 :[_sage_const_3 ,_sage_const_4 ], _sage_const_3 :[_sage_const_4 ], _sage_const_4 :[_sage_const_5 ,_sage_const_7 ], _sage_const_5 :[_sage_const_6 ]},\
   multiedges=True)
   G4plot = G4.plot(layout='circular')
except:
 _st_.goboom(_sage_const_150 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_152 
 _st_.plot(_sage_const_6 , format='notprovided', _p_=G4plot, axes=False)
except:
 _st_.goboom(_sage_const_152 )
_st_.current_tex_line = _sage_const_155 
_st_.blockbegin()
try:
   s     = _sage_const_7 
   s2    = _sage_const_2 **s
   P = GF(_sage_const_2 )['x']; (x,) = P._first_ngens(1)
   M     = matrix(parent(x),s2)
   for i in range(s2):
     p  = (_sage_const_1 +x)**i
     pc = p.coeffs()
     a  = pc.count(_sage_const_1 )
     for j in range(a):
       idx        = pc.index(_sage_const_1 )
       M[i,idx+j] = pc.pop(idx)
 
   matrixprogram = matrix_plot(M,cmap='Greys')
except:
 _st_.goboom(_sage_const_169 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_172 
 _st_.plot(_sage_const_7 , format='notprovided', _p_=matrixprogram)
except:
 _st_.goboom(_sage_const_172 )
try:
 _st_.current_tex_line = _sage_const_175 
 _st_.inline(_sage_const_13 , latex(var('x')))
except:
 _st_.goboom(_sage_const_175 )
_st_.current_tex_line = _sage_const_191 
_st_.blockbegin()
try:
   G = graphs.CubeGraph(_sage_const_5 )
except:
 _st_.goboom(_sage_const_193 )
_st_.blockend()
try:
 _st_.current_tex_line = _sage_const_197 
 _st_.plot(_sage_const_8 , format='png', _p_=G.plot3d(engine='tachyon'))
except:
 _st_.goboom(_sage_const_197 )
print 'SageTeX paused on example.tex line 207'
"""
try:
 _st_.current_tex_line = 209
 _st_.inline(14, latex(factor(2^325 + 1)))
except:
 _st_.goboom(209)
_st_.current_tex_line = 212
_st_.blockbegin()
try:
   import time
   time.sleep(15)
except:
 _st_.goboom(215)
_st_.blockend()
try:
 _st_.current_tex_line = 217
 _st_.plot(9, format='notprovided', _p_=plot(2*sin(x^2) + x^2, (x, 0, 5)))
except:
 _st_.goboom(217)
"""
print 'SageTeX unpaused on example.tex line 219'
try:
 _st_.current_tex_line = _sage_const_266 
 _st_.inline(_sage_const_15 , latex(version()))
except:
 _st_.goboom(_sage_const_266 )
_st_.endofdoc()