from sage.all_cmdline import *
_sage_const_3 = Integer(3); _sage_const_2 = Integer(2); _sage_const_1 = Integer(1); _sage_const_200 = Integer(200); _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_0 = Integer(0); _sage_const_22 = Integer(22); _sage_const_23 = Integer(23); _sage_const_20 = Integer(20); _sage_const_21 = Integer(21); _sage_const_24 = Integer(24); _sage_const_25 = Integer(25); _sage_const_3p4 = RealNumber('3.4'); _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_15 = Integer(15); _sage_const_14 = Integer(14); _sage_const_19 = Integer(19); _sage_const_18 = Integer(18)
import sagetex
_st_ = sagetex.SageTeXProcessor('P3b', version='2015/08/26 v3.0-92d9f7a', version_check=True)
_st_.current_tex_line = _sage_const_4
_st_.blockbegin()
try:
_sage_const_4 * (_sage_const_10 // _sage_const_4 ) + _sage_const_10 % _sage_const_4 == _sage_const_10
_sage_const_3 **_sage_const_2 *_sage_const_4 + _sage_const_2 %_sage_const_5
sqrt(_sage_const_3p4 )
sin(pi/_sage_const_3 )
exp(_sage_const_2 )
sin(_sage_const_10 ).n(digits=_sage_const_5 )
N(sin(_sage_const_10 ),digits=_sage_const_10 )
sqrt(pi).numerical_approx()
numerical_approx(pi, prec=_sage_const_200 )
except:
_st_.goboom(_sage_const_14 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_0 , r"""
sage: a = 5
sage: type(a)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_5 )
try:
_st_.current_tex_line = _sage_const_6
_st_.commandline(_sage_const_1 , r"""
sage: a = 5/3
sage: type(a)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_9 )
try:
_st_.current_tex_line = _sage_const_10
_st_.commandline(_sage_const_2 , r"""
sage: a = 'hello'
sage: type(a)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_13 )
_st_.current_tex_line = _sage_const_3
_st_.blockbegin()
try:
x = var('x')
solve(x**_sage_const_2 + _sage_const_3 *x + _sage_const_2 , x)
except:
_st_.goboom(_sage_const_6 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_7
_st_.inline(_sage_const_0 , latex(solve(x**_sage_const_2 + _sage_const_3 *x + _sage_const_2 , x)))
except:
_st_.goboom(_sage_const_7 )
_st_.current_tex_line = _sage_const_10
_st_.blockbegin()
try:
x, b, c = var('x b c')
solve([x**_sage_const_2 + b*x + c == _sage_const_0 ],x)
except:
_st_.goboom(_sage_const_13 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_14
_st_.inline(_sage_const_1 , latex(solve([x**_sage_const_2 + b*x + c == _sage_const_0 ],x)))
except:
_st_.goboom(_sage_const_14 )
_st_.current_tex_line = _sage_const_3
_st_.blockbegin()
try:
var('x y p q')
eq1 = p+q==_sage_const_9
eq2 = q*y+p*x==-_sage_const_6
eq3 = q*y**_sage_const_2 +p*x**_sage_const_2 ==_sage_const_24
solve([eq1,eq2,eq3,p==_sage_const_1 ],p,q,x,y)
except:
_st_.goboom(_sage_const_9 )
_st_.blockend()
_st_.current_tex_line = _sage_const_10
_st_.blockbegin()
try:
s = solve([eq1,eq2,eq3,p==_sage_const_1 ],p,q,x,y)
except:
_st_.goboom(_sage_const_12 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_13
_st_.inline(_sage_const_2 , latex(s[_sage_const_0 ]))
except:
_st_.goboom(_sage_const_13 )
try:
_st_.current_tex_line = _sage_const_13
_st_.inline(_sage_const_3 , latex(s[_sage_const_1 ]))
except:
_st_.goboom(_sage_const_13 )
try:
_st_.current_tex_line = _sage_const_3
_st_.commandline(_sage_const_3 , r"""
sage: phi = var('phi')
sage: find_root(cos(phi)==sin(phi),0,pi/2)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_6 )
try:
_st_.current_tex_line = _sage_const_8
_st_.commandline(_sage_const_4 , r"""
sage: solve(x^2+x-1 > 0, x)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_10 )
_st_.current_tex_line = _sage_const_5
_st_.blockbegin()
try:
s = (x**_sage_const_3 +_sage_const_2 *x+_sage_const_1 ).roots(x)
except:
_st_.goboom(_sage_const_7 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_11
_st_.inline(_sage_const_4 , latex(s[_sage_const_0 ]))
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_11
_st_.inline(_sage_const_5 , latex(s[_sage_const_1 ]))
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_11
_st_.inline(_sage_const_6 , latex(s[_sage_const_2 ]))
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_11
_st_.inline(_sage_const_4 , latex(s[_sage_const_0 ]))
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_11
_st_.inline(_sage_const_5 , latex(s[_sage_const_1 ]))
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_11
_st_.inline(_sage_const_6 , latex(s[_sage_const_2 ]))
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_5
_st_.inline(_sage_const_7 , latex((x**_sage_const_3 +_sage_const_2 *x+_sage_const_1 ).roots(x, ring=RR)))
except:
_st_.goboom(_sage_const_5 )
_st_.current_tex_line = _sage_const_9
_st_.blockbegin()
try:
s = (x**_sage_const_3 +_sage_const_2 *x+_sage_const_1 ).roots(x, ring=CC)
except:
_st_.goboom(_sage_const_11 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_13
_st_.inline(_sage_const_8 , latex(s[_sage_const_0 ]))
except:
_st_.goboom(_sage_const_13 )
try:
_st_.current_tex_line = _sage_const_13
_st_.inline(_sage_const_9 , latex(s[_sage_const_1 ]))
except:
_st_.goboom(_sage_const_13 )
try:
_st_.current_tex_line = _sage_const_13
_st_.inline(_sage_const_10 , latex(s[_sage_const_2 ]))
except:
_st_.goboom(_sage_const_13 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_5 , r"""
sage: diff(sin(x^2), x, 4)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_4 )
try:
_st_.current_tex_line = _sage_const_5
_st_.commandline(_sage_const_6 , r"""
sage: x, y = var('x,y')
sage: f = x^2 + 17*y^2
sage: f.diff(y)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_9 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_7 , r"""
sage: integral(x*sin(x^2), x)
sage: integral(x/(x^2+1), x, 0, 1)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_5 )
try:
_st_.current_tex_line = _sage_const_8
_st_.commandline(_sage_const_8 , r"""
sage: f = 1/((1+x)*(x-1))
sage: f.partial_fraction(x)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_9 , r"""
sage: simplify(arccos(sin(pi/3)))
sage: simplify(exp(i*pi/6))
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_5 )
try:
_st_.current_tex_line = _sage_const_6
_st_.commandline(_sage_const_10 , r"""
sage: a = var('a')
sage: y = cos(x+a) * (x+1)
sage: y.subs(a=-x)
sage: y.subs(x=pi/2, a=pi/3)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_11 , r"""
sage: y, z = var('y, z')
sage: f = x^3 + y^2 + z
sage: f.subs_expr(x^3 == y^2, z==1)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_6 )
try:
_st_.current_tex_line = _sage_const_7
_st_.commandline(_sage_const_12 , r"""
sage: f(x)=(2*x+1)^3
sage: f(-3)
sage: f.expand()
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_11 )
try:
_st_.current_tex_line = _sage_const_12
_st_.commandline(_sage_const_13 , r"""
sage: ((x+y+sin(x))^2).expand().collect(sin(x))
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_14 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_14 , r"""
sage: u = sin(x) + x*cos(y)
sage: v = u.function(x, y)
sage: v
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_6 )
try:
_st_.current_tex_line = _sage_const_7
_st_.commandline(_sage_const_15 , r"""
sage: f = (e^x-1) / (1+e^(x/2))
sage: f.simplify_exp()
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_10 )
try:
_st_.current_tex_line = _sage_const_11
_st_.commandline(_sage_const_16 , r"""
sage: f = cos(x)^6 + sin(x)^6 + 3 * sin(x)^2 * cos(x)^2
sage: f.simplify_trig()
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_14 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_17 , r"""
sage: f = cos(x)^6
sage: f.reduce_trig()
sage: f = sin(5 * x)
sage: f.expand_trig()
sage: n = var('n')
sage: f = factorial(n+1)/factorial(n)
sage: f.simplify_factorial()
sage: f = sqrt(abs(x)^2)
sage: f.simplify_radical()
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_12 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_18 , r"""
sage: assume(x > 0)
sage: bool(sqrt(x^2) == x)
sage: forget(x > 0)
sage: bool(sqrt(x^2) == x)
sage: n = var('n')
sage: assume(n, 'integer')
sage: sin(n*pi).simplify()
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_10 )
try:
_st_.current_tex_line = _sage_const_3
_st_.commandline(_sage_const_19 , r"""
sage: t = var('t')
sage: x = function('x',t)
sage: DE = diff(x, t) + x - 1
sage: desolve(DE, [x,t])
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_8 )
try:
_st_.current_tex_line = _sage_const_9
_st_.commandline(_sage_const_20 , r"""
sage: x = var('x')
sage: y = function('y', x)
sage: desolve(diff(y,x,x) + x*diff(y,x) + y == 0, y, [0,0,1])
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_13 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_21 , r"""
sage: k, n = var('k, n')
sage: sum(k, k, 1, n).factor()
sage: sum(k * binomial(n, k), k, 0, n)
sage: n, k, y = var('n, k, y')
sage: sum(binomial(n,k) * x^k * y^(n-k), k, 0, n)
sage: a, q, k, n = var('a, q, k, n')
sage: sum(a*q^k, k, 0, n)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_10 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_22 , r"""
sage: a, q, k, n = var('a, q, k, n')
sage: sum(a*q^k, k, 0, n)
sage: assume(abs(q) < 1)
sage: sum(a*q^k, k, 0, infinity)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_7 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_23 , r"""
sage: limit((x**(1/3) - 2) / ((x + 19)**(1/3) - 3), x = 8)
sage: f(x) = (cos(pi/4-x)-tan(x))/(1-sin(pi/4 + x))
sage: limit(f(x), x = pi/4)
sage: limit(f(x), x = pi/4, dir='minus')
sage: limit(f(x), x = pi/4, dir='plus')
sage: u(n) = n^100 / 100^n
sage: limit(u(n), n=infinity)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_10 )
try:
_st_.current_tex_line = _sage_const_2
_st_.commandline(_sage_const_24 , r"""
sage: taylor((1+arctan(x))**(1/x), x, 0, 3)
sage: (ln(2*sin(x))).series(x==pi/6, 3)
sage: (ln(2*sin(x))).series(x==pi/6, 3).truncate()
sage: f = arctan(x).series(x, 10)
sage: f
sage: (16*f.subs(x==1/5) - 4*f.subs(x==1/239)).n()
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_9 )
try:
_st_.current_tex_line = _sage_const_7
_st_.inline(_sage_const_11 , latex(matrix([[_sage_const_1 , _sage_const_2 ], [_sage_const_3 ,_sage_const_4 ]])**_sage_const_2 ))
except:
_st_.goboom(_sage_const_7 )
try:
_st_.current_tex_line = _sage_const_7
_st_.plot(_sage_const_0 , format='png', _p_=plot(sin(x), _sage_const_0 , pi), axes=False)
except:
_st_.goboom(_sage_const_7 )
_st_.current_tex_line = _sage_const_12
_st_.blockbegin()
try:
var('x')
__tmp__=var("x"); f = symbolic_expression(sin(x) - _sage_const_1 ).function(x)
__tmp__=var("x"); g = symbolic_expression(log(x)).function(x)
__tmp__=var("x"); h = symbolic_expression(diff(f(x) * g(x), x)).function(x)
except:
_st_.goboom(_sage_const_17 )
_st_.blockend()
try:
_st_.current_tex_line = _sage_const_9
_st_.inline(_sage_const_12 , latex(h(_sage_const_2 )))
except:
_st_.goboom(_sage_const_9 )
try:
_st_.current_tex_line = _sage_const_11
_st_.commandline(_sage_const_25 , r"""
sage: 1+1
sage: factor(x^2 + 2*x + 1)
""", globals(), locals(), True)
except:
_st_.goboom(_sage_const_14 )
_st_.endofdoc()