Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 29889
1
## -*- encoding: utf-8 -*-
2
3
# This file was *autogenerated* from the file example.sagetex.sage
4
from sage.all_cmdline import * # import sage library
5
6
_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.
7
import sagetex
8
_st_ = sagetex.SageTeXProcessor('example', version='2015/08/26 v3.0-92d9f7a', version_check=True)
9
try:
10
_st_.current_tex_line = _sage_const_28
11
_st_.inline(_sage_const_0 , latex(_sage_const_2 +_sage_const_2 ))
12
except:
13
_st_.goboom(_sage_const_28 )
14
try:
15
_st_.current_tex_line = _sage_const_29
16
_st_.inline(_sage_const_1 , latex(mod(_sage_const_2019 , _sage_const_100 )))
17
except:
18
_st_.goboom(_sage_const_29 )
19
try:
20
_st_.current_tex_line = _sage_const_31
21
_st_.inline(_sage_const_2 , latex(Integer(mod(_sage_const_2019 , _sage_const_100 ))**_sage_const_9 ))
22
except:
23
_st_.goboom(_sage_const_31 )
24
try:
25
_st_.current_tex_line = _sage_const_32
26
_st_.inline(_sage_const_3 , latex(_sage_const_2019 %_sage_const_42 ))
27
except:
28
_st_.goboom(_sage_const_32 )
29
_st_.current_tex_line = _sage_const_36
30
_st_.blockbegin()
31
try:
32
_sage_const_1 +_sage_const_1
33
var('a,b,c,d')
34
eqn = [a+b*c==_sage_const_1 , b-a*c==_sage_const_0 , a+b==_sage_const_5 ]
35
s = solve(eqn, a,b,c)
36
except:
37
_st_.goboom(_sage_const_41 )
38
_st_.blockend()
39
try:
40
_st_.current_tex_line = _sage_const_43
41
_st_.inline(_sage_const_4 , latex(eqn))
42
except:
43
_st_.goboom(_sage_const_43 )
44
try:
45
_st_.current_tex_line = _sage_const_45
46
_st_.inline(_sage_const_5 , latex(s[_sage_const_0 ]))
47
except:
48
_st_.goboom(_sage_const_45 )
49
try:
50
_st_.current_tex_line = _sage_const_48
51
_st_.inline(_sage_const_6 , latex(s[_sage_const_1 ]))
52
except:
53
_st_.goboom(_sage_const_48 )
54
_st_.current_tex_line = _sage_const_53
55
_st_.blockbegin()
56
try:
57
E = EllipticCurve("37a")
58
except:
59
_st_.goboom(_sage_const_55 )
60
_st_.blockend()
61
try:
62
_st_.current_tex_line = _sage_const_59
63
_st_.inline(_sage_const_7 , latex(E))
64
except:
65
_st_.goboom(_sage_const_59 )
66
try:
67
_st_.current_tex_line = _sage_const_60
68
_st_.inline(_sage_const_8 , latex(E.discriminant()))
69
except:
70
_st_.goboom(_sage_const_60 )
71
_st_.current_tex_line = _sage_const_64
72
_st_.blockbegin()
73
try:
74
try:
75
E = load('E2')
76
except IOError:
77
E = EllipticCurve([_sage_const_1 ,_sage_const_2 ,_sage_const_7 ,_sage_const_4 ,_sage_const_5 ])
78
E.anlist(_sage_const_100000 )
79
E.save('E2')
80
except:
81
_st_.goboom(_sage_const_71 )
82
_st_.blockend()
83
try:
84
_st_.current_tex_line = _sage_const_73
85
_st_.inline(_sage_const_9 , latex(E))
86
except:
87
_st_.goboom(_sage_const_73 )
88
try:
89
_st_.current_tex_line = _sage_const_73
90
_st_.inline(_sage_const_10 , latex(E.anlist(_sage_const_100000 )[_sage_const_9999 ]))
91
except:
92
_st_.goboom(_sage_const_73 )
93
_st_.current_tex_line = _sage_const_76
94
_st_.blockbegin()
95
try:
96
e = _sage_const_2
97
e = _sage_const_3 *e + _sage_const_1
98
except:
99
_st_.goboom(_sage_const_79 )
100
_st_.blockend()
101
try:
102
_st_.current_tex_line = _sage_const_80
103
_st_.inline(_sage_const_11 , latex(e))
104
except:
105
_st_.goboom(_sage_const_80 )
106
_st_.current_tex_line = _sage_const_82
107
_st_.blockbegin()
108
try:
109
var('x')
110
__tmp__=var("x"); f = symbolic_expression(log(sin(x)/x)).function(x)
111
except:
112
_st_.goboom(_sage_const_85 )
113
_st_.blockend()
114
try:
115
_st_.current_tex_line = _sage_const_86
116
_st_.inline(_sage_const_12 , latex( f.taylor(x, _sage_const_0 , _sage_const_10 ) ))
117
except:
118
_st_.goboom(_sage_const_86 )
119
try:
120
_st_.current_tex_line = _sage_const_92
121
_st_.plot(_sage_const_0 , format='notprovided', _p_=E.plot(-_sage_const_3 ,_sage_const_3 ))
122
except:
123
_st_.goboom(_sage_const_92 )
124
_st_.current_tex_line = _sage_const_94
125
_st_.blockbegin()
126
try:
127
# the var line is unecessary unless you've defined x to be something
128
# other than a symbolic variable
129
var('x')
130
__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)
131
except:
132
_st_.goboom(_sage_const_99 )
133
_st_.blockend()
134
_st_.current_tex_line = _sage_const_102
135
_st_.blockbegin()
136
try:
137
p = plot(f, x, -_sage_const_5 , _sage_const_8 )
138
except:
139
_st_.goboom(_sage_const_104 )
140
_st_.blockend()
141
try:
142
_st_.current_tex_line = _sage_const_108
143
_st_.plot(_sage_const_1 , format='notprovided', _p_=p)
144
except:
145
_st_.goboom(_sage_const_108 )
146
try:
147
_st_.current_tex_line = _sage_const_113
148
_st_.plot(_sage_const_2 , format='notprovided', _p_=p, axes=False)
149
except:
150
_st_.goboom(_sage_const_113 )
151
_st_.current_tex_line = _sage_const_117
152
_st_.blockbegin()
153
try:
154
f = maxima('sin(.4 * x)^3*cos(x)')
155
g = f.integrate('x')
156
except:
157
_st_.goboom(_sage_const_120 )
158
_st_.blockend()
159
_st_.current_tex_line = _sage_const_122
160
_st_.blockbegin()
161
try:
162
# g is a Maxima thingy, it needs to get converted into a Sage object
163
plot1 = plot(g.sage(),x,-_sage_const_1 ,_sage_const_2 *pi)
164
except:
165
_st_.goboom(_sage_const_125 )
166
_st_.blockend()
167
try:
168
_st_.current_tex_line = _sage_const_131
169
_st_.plot(_sage_const_3 , format='png', _p_=plot1)
170
except:
171
_st_.goboom(_sage_const_131 )
172
try:
173
_st_.current_tex_line = _sage_const_141
174
_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 ])
175
except:
176
_st_.goboom(_sage_const_141 )
177
try:
178
_st_.current_tex_line = _sage_const_144
179
_st_.plot(_sage_const_5 , format='notprovided', _p_=graphs.FlowerSnark().plot())
180
except:
181
_st_.goboom(_sage_const_144 )
182
_st_.current_tex_line = _sage_const_146
183
_st_.blockbegin()
184
try:
185
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 ]},\
186
multiedges=True)
187
G4plot = G4.plot(layout='circular')
188
except:
189
_st_.goboom(_sage_const_150 )
190
_st_.blockend()
191
try:
192
_st_.current_tex_line = _sage_const_152
193
_st_.plot(_sage_const_6 , format='notprovided', _p_=G4plot, axes=False)
194
except:
195
_st_.goboom(_sage_const_152 )
196
_st_.current_tex_line = _sage_const_155
197
_st_.blockbegin()
198
try:
199
s = _sage_const_7
200
s2 = _sage_const_2 **s
201
P = GF(_sage_const_2 )['x']; (x,) = P._first_ngens(1)
202
M = matrix(parent(x),s2)
203
for i in range(s2):
204
p = (_sage_const_1 +x)**i
205
pc = p.coeffs()
206
a = pc.count(_sage_const_1 )
207
for j in range(a):
208
idx = pc.index(_sage_const_1 )
209
M[i,idx+j] = pc.pop(idx)
210
211
matrixprogram = matrix_plot(M,cmap='Greys')
212
except:
213
_st_.goboom(_sage_const_169 )
214
_st_.blockend()
215
try:
216
_st_.current_tex_line = _sage_const_172
217
_st_.plot(_sage_const_7 , format='notprovided', _p_=matrixprogram)
218
except:
219
_st_.goboom(_sage_const_172 )
220
try:
221
_st_.current_tex_line = _sage_const_175
222
_st_.inline(_sage_const_13 , latex(var('x')))
223
except:
224
_st_.goboom(_sage_const_175 )
225
_st_.current_tex_line = _sage_const_191
226
_st_.blockbegin()
227
try:
228
G = graphs.CubeGraph(_sage_const_5 )
229
except:
230
_st_.goboom(_sage_const_193 )
231
_st_.blockend()
232
try:
233
_st_.current_tex_line = _sage_const_197
234
_st_.plot(_sage_const_8 , format='png', _p_=G.plot3d(engine='tachyon'))
235
except:
236
_st_.goboom(_sage_const_197 )
237
print 'SageTeX paused on example.tex line 207'
238
"""
239
try:
240
_st_.current_tex_line = 209
241
_st_.inline(14, latex(factor(2^325 + 1)))
242
except:
243
_st_.goboom(209)
244
_st_.current_tex_line = 212
245
_st_.blockbegin()
246
try:
247
import time
248
time.sleep(15)
249
except:
250
_st_.goboom(215)
251
_st_.blockend()
252
try:
253
_st_.current_tex_line = 217
254
_st_.plot(9, format='notprovided', _p_=plot(2*sin(x^2) + x^2, (x, 0, 5)))
255
except:
256
_st_.goboom(217)
257
"""
258
print 'SageTeX unpaused on example.tex line 219'
259
try:
260
_st_.current_tex_line = _sage_const_266
261
_st_.inline(_sage_const_15 , latex(version()))
262
except:
263
_st_.goboom(_sage_const_266 )
264
_st_.endofdoc()
265
266
267