Sharedlatex-tests / example.sagetex.sageOpen in CoCalc
## -*- encoding: utf-8 -*-
## 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 = 28
 _st_.inline(0, latex(2+2))
except:
 _st_.goboom(28)
try:
 _st_.current_tex_line = 29
 _st_.inline(1, latex(mod(2019, 100)))
except:
 _st_.goboom(29)
try:
 _st_.current_tex_line = 31
 _st_.inline(2, latex(Integer(mod(2019, 100))^9))
except:
 _st_.goboom(31)
try:
 _st_.current_tex_line = 32
 _st_.inline(3, latex(2019%42))
except:
 _st_.goboom(32)
_st_.current_tex_line = 36
_st_.blockbegin()
try:
   1+1
   var('a,b,c,d')
   eqn = [a+b*c==1, b-a*c==0, a+b==5]
   s = solve(eqn, a,b,c)
except:
 _st_.goboom(41)
_st_.blockend()
try:
 _st_.current_tex_line = 43
 _st_.inline(4, latex(eqn))
except:
 _st_.goboom(43)
try:
 _st_.current_tex_line = 45
 _st_.inline(5, latex(s[0]))
except:
 _st_.goboom(45)
try:
 _st_.current_tex_line = 48
 _st_.inline(6, latex(s[1]))
except:
 _st_.goboom(48)
_st_.current_tex_line = 53
_st_.blockbegin()
try:
   E = EllipticCurve("37a")
except:
 _st_.goboom(55)
_st_.blockend()
try:
 _st_.current_tex_line = 59
 _st_.inline(7, latex(E))
except:
 _st_.goboom(59)
try:
 _st_.current_tex_line = 60
 _st_.inline(8, latex(E.discriminant()))
except:
 _st_.goboom(60)
_st_.current_tex_line = 64
_st_.blockbegin()
try:
 try:
   E = load('E2')
 except IOError:
   E = EllipticCurve([1,2,7,4,5])
   E.anlist(100000)
   E.save('E2')
except:
 _st_.goboom(71)
_st_.blockend()
try:
 _st_.current_tex_line = 73
 _st_.inline(9, latex(E))
except:
 _st_.goboom(73)
try:
 _st_.current_tex_line = 73
 _st_.inline(10, latex(E.anlist(100000)[9999]))
except:
 _st_.goboom(73)
_st_.current_tex_line = 76
_st_.blockbegin()
try:
   e = 2
   e = 3*e + 1
except:
 _st_.goboom(79)
_st_.blockend()
try:
 _st_.current_tex_line = 80
 _st_.inline(11, latex(e))
except:
 _st_.goboom(80)
_st_.current_tex_line = 82
_st_.blockbegin()
try:
   var('x')
   f(x) = log(sin(x)/x)
except:
 _st_.goboom(85)
_st_.blockend()
try:
 _st_.current_tex_line = 86
 _st_.inline(12, latex( f.taylor(x, 0, 10) ))
except:
 _st_.goboom(86)
try:
 _st_.current_tex_line = 92
 _st_.plot(0, format='notprovided', _p_=E.plot(-3,3))
except:
 _st_.goboom(92)
_st_.current_tex_line = 94
_st_.blockbegin()
try:
   # the var line is unecessary unless you've defined x to be something
   # other than a symbolic variable
   var('x')
   f(x) = -x^3+4*x^2+7*x-4
except:
 _st_.goboom(99)
_st_.blockend()
_st_.current_tex_line = 102
_st_.blockbegin()
try:
   p = plot(f, x, -5, 8)
except:
 _st_.goboom(104)
_st_.blockend()
try:
 _st_.current_tex_line = 108
 _st_.plot(1, format='notprovided', _p_=p)
except:
 _st_.goboom(108)
try:
 _st_.current_tex_line = 113
 _st_.plot(2, format='notprovided', _p_=p, axes=False)
except:
 _st_.goboom(113)
_st_.current_tex_line = 117
_st_.blockbegin()
try:
   f = maxima('sin(.4 * x)^3*cos(x)')
   g = f.integrate('x')
except:
 _st_.goboom(120)
_st_.blockend()
_st_.current_tex_line = 122
_st_.blockbegin()
try:
   # g is a Maxima thingy, it needs to get converted into a Sage object
   plot1 = plot(g.sage(),x,-1,2*pi)
except:
 _st_.goboom(125)
_st_.blockend()
try:
 _st_.current_tex_line = 131
 _st_.plot(3, format='png', _p_=plot1)
except:
 _st_.goboom(131)
try:
 _st_.current_tex_line = 141
 _st_.plot(4, format='notprovided', _p_=plot1 + plot(f.sage(),x,-1,2*pi,rgbcolor=hue(0.4)), figsize=[1,2])
except:
 _st_.goboom(141)
try:
 _st_.current_tex_line = 144
 _st_.plot(5, format='notprovided', _p_=graphs.FlowerSnark().plot())
except:
 _st_.goboom(144)
_st_.current_tex_line = 146
_st_.blockbegin()
try:
   G4 = DiGraph({1:[2,2,3,5], 2:[3,4], 3:[4], 4:[5,7], 5:[6]},\
   multiedges=True)
   G4plot = G4.plot(layout='circular')
except:
 _st_.goboom(150)
_st_.blockend()
try:
 _st_.current_tex_line = 152
 _st_.plot(6, format='notprovided', _p_=G4plot, axes=False)
except:
 _st_.goboom(152)
_st_.current_tex_line = 155
_st_.blockbegin()
try:
   s     = 7
   s2    = 2^s
   P.<x> = GF(2)[]
   M     = matrix(parent(x),s2)
   for i in range(s2):
     p  = (1+x)^i
     pc = p.coeffs()
     a  = pc.count(1)
     for j in range(a):
       idx        = pc.index(1)
       M[i,idx+j] = pc.pop(idx)
 
   matrixprogram = matrix_plot(M,cmap='Greys')
except:
 _st_.goboom(169)
_st_.blockend()
try:
 _st_.current_tex_line = 172
 _st_.plot(7, format='notprovided', _p_=matrixprogram)
except:
 _st_.goboom(172)
try:
 _st_.current_tex_line = 175
 _st_.inline(13, latex(var('x')))
except:
 _st_.goboom(175)
_st_.current_tex_line = 191
_st_.blockbegin()
try:
   G = graphs.CubeGraph(5)
except:
 _st_.goboom(193)
_st_.blockend()
try:
 _st_.current_tex_line = 197
 _st_.plot(8, format='png', _p_=G.plot3d(engine='tachyon'))
except:
 _st_.goboom(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 = 266
 _st_.inline(15, latex(version()))
except:
 _st_.goboom(266)
_st_.endofdoc()