from sage.all_cmdline import *
_sage_const_181 = Integer(181); _sage_const_345 = Integer(345); _sage_const_349 = Integer(349); _sage_const_695 = Integer(695); _sage_const_693 = Integer(693); _sage_const_118 = Integer(118); _sage_const_84 = Integer(84); _sage_const_85 = Integer(85); _sage_const_87 = Integer(87); _sage_const_81 = Integer(81); _sage_const_622 = Integer(622); _sage_const_337 = Integer(337); _sage_const_629 = Integer(629); _sage_const_339 = Integer(339); _sage_const_13 = Integer(13); _sage_const_12 = Integer(12); _sage_const_11 = Integer(11); _sage_const_10 = Integer(10); _sage_const_17 = Integer(17); _sage_const_16 = Integer(16); _sage_const_14 = Integer(14); _sage_const_19 = Integer(19); _sage_const_18 = Integer(18); _sage_const_109 = Integer(109); _sage_const_99 = Integer(99); _sage_const_100 = Integer(100); _sage_const_91 = Integer(91); _sage_const_90 = Integer(90); _sage_const_104 = Integer(104); _sage_const_107 = Integer(107); _sage_const_458 = Integer(458); _sage_const_455 = Integer(455); _sage_const_451 = Integer(451); _sage_const_525 = Integer(525); _sage_const_521 = Integer(521); _sage_const_97 = Integer(97); _sage_const_9999 = Integer(9999); _sage_const_64 = Integer(64); _sage_const_136 = Integer(136); _sage_const_63 = Integer(63); _sage_const_60 = Integer(60); _sage_const_68 = Integer(68); _sage_const_420 = Integer(420); _sage_const_426 = Integer(426); _sage_const_484 = Integer(484); _sage_const_253 = Integer(253); _sage_const_100000 = Integer(100000); _sage_const_122 = Integer(122); _sage_const_77 = Integer(77); _sage_const_127 = Integer(127); _sage_const_125 = Integer(125); _sage_const_78 = Integer(78); _sage_const_113 = Integer(113); _sage_const_639 = Integer(639); _sage_const_433 = Integer(433); _sage_const_712 = Integer(712); _sage_const_42 = Integer(42); _sage_const_47 = Integer(47); _sage_const_49 = Integer(49); _sage_const_154 = Integer(154); _sage_const_151 = Integer(151); _sage_const_642 = Integer(642); _sage_const_36 = Integer(36); _sage_const_158 = Integer(158); _sage_const_75 = Integer(75); _sage_const_463 = Integer(463); _sage_const_58 = Integer(58); _sage_const_54 = Integer(54); _sage_const_683 = Integer(683); _sage_const_51 = Integer(51); _sage_const_389 = Integer(389); _sage_const_413 = Integer(413); _sage_const_146 = Integer(146); _sage_const_651 = Integer(651); _sage_const_656 = Integer(656); _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_9 = Integer(9); _sage_const_8 = Integer(8); _sage_const_22 = Integer(22); _sage_const_23 = Integer(23); _sage_const_20 = Integer(20); _sage_const_21 = Integer(21); _sage_const_667 = Integer(667); _sage_const_175 = Integer(175); _sage_const_0p4 = RealNumber('0.4'); _sage_const_709 = Integer(709); _sage_const_178 = Integer(178); _sage_const_519 = Integer(519); _sage_const_518 = Integer(518); _sage_const_351 = Integer(351); _sage_const_448 = Integer(448); _sage_const_355 = Integer(355); _sage_const_512 = Integer(512); _sage_const_2018 = Integer(2018); _sage_const_39 = Integer(39); _sage_const_38 = Integer(38); _sage_const_685 = Integer(685); _sage_const_35 = Integer(35); _sage_const_130 = Integer(130); _sage_const_161 = Integer(161); _sage_const_671 = Integer(671)
import sagetex
_st_ = sagetex.SageTeXProcessor('sagetex', version='2015/08/26 v3.0-92d9f7a', version_check=True)
try:
_st_.current_tex_line = _sage_const_35
_st_.inline(_sage_const_0 , latex(_sage_const_2 +_sage_const_2 ))
except:
_st_.goboom(_sage_const_35 )
try:
_st_.current_tex_line = _sage_const_36
_st_.inline(_sage_const_1 , latex(mod(_sage_const_2018 , _sage_const_100 )))
except:
_st_.goboom(_sage_const_36 )
try:
_st_.current_tex_line = _sage_const_38
_st_.inline(_sage_const_2 , latex(Integer(mod(_sage_const_2018 , _sage_const_100 ))**_sage_const_21 ))
except:
_st_.goboom(_sage_const_38 )
try:
_st_.current_tex_line = _sage_const_39
_st_.inline(_sage_const_3 , latex(_sage_const_2018 %_sage_const_42 ))
except:
_st_.goboom(_sage_const_39 )
_st_.current_tex_line = _sage_const_42
_st_.blockbegin()
try:
_sage_const_1 +_sage_const_1
var('a,b,c')
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_47 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_49
_st_.inline(_sage_const_4 , latex(eqn))
except:
_st_.goboom(_sage_const_49 )
try:
_st_.current_tex_line = _sage_const_51
_st_.inline(_sage_const_5 , latex(s[_sage_const_0 ]))
except:
_st_.goboom(_sage_const_51 )
try:
_st_.current_tex_line = _sage_const_54
_st_.inline(_sage_const_6 , latex(s[_sage_const_1 ]))
except:
_st_.goboom(_sage_const_54 )
_st_.current_tex_line = _sage_const_58
_st_.blockbegin()
try:
E = EllipticCurve("37a")
except:
_st_.goboom(_sage_const_60 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_63
_st_.inline(_sage_const_7 , latex(E))
except:
_st_.goboom(_sage_const_63 )
try:
_st_.current_tex_line = _sage_const_64
_st_.inline(_sage_const_8 , latex(E.discriminant()))
except:
_st_.goboom(_sage_const_64 )
_st_.current_tex_line = _sage_const_68
_st_.blockbegin()
try:
try:
E = load('E2')
except IOError:
E = EllipticCurve([_sage_const_1 ,_sage_const_2 ,_sage_const_3 ,_sage_const_4 ,_sage_const_5 ])
E.anlist(_sage_const_100000 )
E.save('E2')
except:
_st_.goboom(_sage_const_75 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_77
_st_.inline(_sage_const_9 , latex(E))
except:
_st_.goboom(_sage_const_77 )
try:
_st_.current_tex_line = _sage_const_78
_st_.inline(_sage_const_10 , latex(E.anlist(_sage_const_100000 )[_sage_const_9999 ]))
except:
_st_.goboom(_sage_const_78 )
_st_.current_tex_line = _sage_const_81
_st_.blockbegin()
try:
e = _sage_const_2
e = _sage_const_3 *e + _sage_const_1
except:
_st_.goboom(_sage_const_84 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_85
_st_.inline(_sage_const_11 , latex(e))
except:
_st_.goboom(_sage_const_85 )
_st_.current_tex_line = _sage_const_87
_st_.blockbegin()
try:
var('x')
__tmp__=var("x"); f = symbolic_expression(log(sin(x)/x)).function(x)
except:
_st_.goboom(_sage_const_90 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_91
_st_.inline(_sage_const_12 , latex( f.taylor(x, _sage_const_0 , _sage_const_10 ) ))
except:
_st_.goboom(_sage_const_91 )
try:
_st_.current_tex_line = _sage_const_97
_st_.plot(_sage_const_0 , format='notprovided', _p_=E.plot(-_sage_const_3 ,_sage_const_3 ))
except:
_st_.goboom(_sage_const_97 )
_st_.current_tex_line = _sage_const_99
_st_.blockbegin()
try:
var('x')
__tmp__=var("x"); f = symbolic_expression(-x**_sage_const_3 +_sage_const_3 *x**_sage_const_2 +_sage_const_7 *x-_sage_const_4 ).function(x)
except:
_st_.goboom(_sage_const_104 )
_st_.blockend()
_st_.current_tex_line = _sage_const_107
_st_.blockbegin()
try:
p = plot(f, x, -_sage_const_5 , _sage_const_5 )
except:
_st_.goboom(_sage_const_109 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_113
_st_.plot(_sage_const_1 , format='notprovided', _p_=p)
except:
_st_.goboom(_sage_const_113 )
try:
_st_.current_tex_line = _sage_const_118
_st_.plot(_sage_const_2 , format='notprovided', _p_=p, axes=False)
except:
_st_.goboom(_sage_const_118 )
_st_.current_tex_line = _sage_const_122
_st_.blockbegin()
try:
f = maxima('sin(x)^2*exp(x)')
g = f.integrate('x')
except:
_st_.goboom(_sage_const_125 )
_st_.blockend()
_st_.current_tex_line = _sage_const_127
_st_.blockbegin()
try:
plot1 = plot(g.sage(),x,-_sage_const_1 ,_sage_const_2 *pi)
except:
_st_.goboom(_sage_const_130 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_136
_st_.plot(_sage_const_3 , format='png', _p_=plot1)
except:
_st_.goboom(_sage_const_136 )
try:
_st_.current_tex_line = _sage_const_146
_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_146 )
_st_.current_tex_line = _sage_const_151
_st_.blockbegin()
try:
p = plot(x, _sage_const_0 , _sage_const_1 ) + circle((_sage_const_0 ,_sage_const_0 ), _sage_const_1 )
p.set_aspect_ratio(_sage_const_1 )
except:
_st_.goboom(_sage_const_154 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_158
_st_.plot(_sage_const_5 , format='notprovided', _p_=p)
except:
_st_.goboom(_sage_const_158 )
_st_.current_tex_line = _sage_const_161
_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.coefficients(sparse=False)
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_175 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_178
_st_.plot(_sage_const_6 , format='notprovided', _p_=matrixprogram)
except:
_st_.goboom(_sage_const_178 )
try:
_st_.current_tex_line = _sage_const_181
_st_.inline(_sage_const_13 , latex(var('x')))
except:
_st_.goboom(_sage_const_181 )
try:
_st_.current_tex_line = _sage_const_253
_st_.inline(_sage_const_14 , latex(var('x')))
except:
_st_.goboom(_sage_const_253 )
_st_.current_tex_line = _sage_const_337
_st_.blockbegin()
try:
x, y = var('x y')
except:
_st_.goboom(_sage_const_339 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_345
_st_.plot(_sage_const_7 , format='notprovided', _p_=plot3d(sin(pi*(x**_sage_const_2 +y**_sage_const_2 ))/_sage_const_2 ,(x,-_sage_const_1 ,_sage_const_1 ),(y,-_sage_const_1 ,_sage_const_1 )))
except:
_st_.goboom(_sage_const_345 )
_st_.current_tex_line = _sage_const_349
_st_.blockbegin()
try:
G = graphs.CubeGraph(_sage_const_5 )
except:
_st_.goboom(_sage_const_351 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_355
_st_.plot(_sage_const_8 , format='png', _p_=G.plot3d())
except:
_st_.goboom(_sage_const_355 )
print 'SageTeX paused on sagetex.tex line 365'
"""
try:
_st_.current_tex_line = 367
_st_.inline(15, latex(factor(2^325 + 1)))
except:
_st_.goboom(367)
_st_.current_tex_line = 370
_st_.blockbegin()
try:
import time
time.sleep(15)
except:
_st_.goboom(373)
_st_.blockend()
try:
_st_.current_tex_line = 375
_st_.plot(9, format='notprovided', _p_=plot(2*sin(x^2) + x^2, (x, 0, 5)))
except:
_st_.goboom(375)
"""
print 'SageTeX unpaused on sagetex.tex line 377'
_st_.current_tex_line = _sage_const_389
_st_.blockbegin()
try:
def pascals_triangle(n):
s = [r"\begin{tabular}{cc|" + "r" * (n+_sage_const_1 ) + "}"]
s.append(r" & & $k$: & \\")
s.append(r" & ")
for k in (ellipsis_range(_sage_const_0 ,Ellipsis,n)):
s.append("& {0} ".format(k))
s.append(r"\\")
s.append(r"\hline" + "\n" + r"$n$: & 0 & 1 & \\")
for r in (ellipsis_range(_sage_const_1 ,Ellipsis,n)):
s.append(" & {0} ".format(r))
for k in (ellipsis_range(_sage_const_0 ,Ellipsis,r)):
s.append("& {0} ".format(binomial(r, k)))
s.append(r"\\")
s.append(r"\end{tabular}")
return ''.join(s)
n = _sage_const_8
except:
_st_.goboom(_sage_const_413 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_420
_st_.inline(_sage_const_16 , pascals_triangle(n))
except:
_st_.goboom(_sage_const_420 )
try:
_st_.current_tex_line = _sage_const_426
_st_.doctest(_sage_const_17 , r"""
sage: 2+2
4
sage: print 'middle'
middle
sage: factor(x^2 + 2*x + 1)
(x + 1)^2
""", globals(), locals(), False)
except:
_st_.goboom(_sage_const_433 )
try:
_st_.current_tex_line = _sage_const_448
_st_.doctest(_sage_const_18 , r"""
sage: print 'middle'
middle
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_451 )
try:
_st_.current_tex_line = _sage_const_455
_st_.doctest(_sage_const_19 , r"""
sage: is_prime(57)
toothpaste
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_458 )
try:
_st_.current_tex_line = _sage_const_463
_st_.doctest(_sage_const_20 , r"""
sage: gcd([5656565656,
....: 4747474747,
....: 123456789])
1
sage: mystr = '''my
....: string
....: has
....: several
....: lines.'''
sage: len(mystr)
28
sage: def f(a):
....: '''This function is really quite nice,
....: although perhaps not very useful.'''
....: print "f called with a = ", a
....: y = integrate(SR(cyclotomic_polynomial(10)) + a, x)
....: return y + 1
sage: f(x)
f called with a = x
1/5*x^5 - 1/4*x^4 + 1/3*x^3 + x + 1
""", globals(), locals(), False)
except:
_st_.goboom(_sage_const_484 )
try:
_st_.current_tex_line = _sage_const_512
_st_.doctest(_sage_const_21 , r"""
sage: 1; 2; a=4; 3; a
1
2
3
4
""", globals(), locals(), False)
except:
_st_.goboom(_sage_const_518 )
try:
_st_.current_tex_line = _sage_const_519
_st_.inline(_sage_const_22 , latex(a))
except:
_st_.goboom(_sage_const_519 )
try:
_st_.current_tex_line = _sage_const_521
_st_.doctest(_sage_const_23 , r"""
sage: f(a)
f called with a = 4
1/5*x^5 - 1/4*x^4 + 1/3*x^3 - 1/2*x^2 + 5*x + 1
""", globals(), locals(), False)
except:
_st_.goboom(_sage_const_525 )
try:
_st_.current_tex_line = _sage_const_622
_st_.commandline(_sage_const_0 , r"""
sage: 1+1
sage: is_prime(57)
sage: if is_prime(57):
....: print 'prime'
....: else:
....: print 'composite'
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_629 )
try:
_st_.current_tex_line = _sage_const_639
_st_.commandline(_sage_const_1 , r"""
sage: x = 2010; len(x.divisors())
sage: print 'Hola, mundo!'
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_642 )
try:
_st_.current_tex_line = _sage_const_651
_st_.commandline(_sage_const_2 , r"""
sage: l = matrix([[1,0,0],[3/5,1,0],[-2/5,-2,1]])
sage: d = diagonal_matrix([15, -1, 4]) #@\label{diagonal}
sage: u = matrix([[1,0,1/3],[0,1,2],[0,0,1]]) #@\label{anotherlabel} \# foo
sage: l*d*u # this is a comment
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_656 )
try:
_st_.current_tex_line = _sage_const_667
_st_.commandline(_sage_const_3 , r"""
sage: l*d*u
sage: x = var('x')
sage: (1-cos(x)^2).trig_simplify()
""", globals(), locals(), False)
except:
_st_.goboom(_sage_const_671 )
try:
_st_.current_tex_line = _sage_const_683
_st_.commandline(_sage_const_4 , r"""
sage: pi.n(100)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_685 )
try:
_st_.current_tex_line = _sage_const_693
_st_.commandline(_sage_const_5 , r"""
sage: plot(sin(x), (x, 0, 2*pi))
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_695 )
try:
_st_.current_tex_line = _sage_const_709
_st_.commandline(_sage_const_6 , r"""
sage: factor(x^2 + 2*x + 1)
(x + 999)^2
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_712 )
_st_.endofdoc()