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