r"""
This file was *autogenerated* from P3b.tex with sagetex.sty
version 2015/08/26 v3.0-92d9f7a. It contains the contents of all the
sageexample environments from P3b.tex. You should be able to
doctest this file with "sage -t P3b_doctest.sage".
It is always safe to delete this file; it is not used in typesetting your
document.
Sage commandline, line 2::
sage: a = 5
sage: type(a)
Sage commandline, line 6::
sage: a = 5/3
sage: type(a)
Sage commandline, line 10::
sage: a = 'hello'
sage: type(a)
Sage commandline, line 3::
sage: phi = var('phi')
sage: find_root(cos(phi)==sin(phi),0,pi/2)
Sage commandline, line 8::
sage: solve(x^2+x-1 > 0, x)
Sage commandline, line 2::
sage: diff(sin(x^2), x, 4)
Sage commandline, line 5::
sage: x, y = var('x,y')
sage: f = x^2 + 17*y^2
sage: f.diff(y)
Sage commandline, line 2::
sage: integral(x*sin(x^2), x)
sage: integral(x/(x^2+1), x, 0, 1)
Sage commandline, line 8::
sage: f = 1/((1+x)*(x-1))
sage: f.partial_fraction(x)
Sage commandline, line 2::
sage: simplify(arccos(sin(pi/3)))
sage: simplify(exp(i*pi/6))
Sage commandline, line 6::
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)
Sage commandline, line 2::
sage: y, z = var('y, z')
sage: f = x^3 + y^2 + z
sage: f.subs_expr(x^3 == y^2, z==1)
Sage commandline, line 7::
sage: f(x)=(2*x+1)^3
sage: f(-3)
sage: f.expand()
Sage commandline, line 12::
sage: ((x+y+sin(x))^2).expand().collect(sin(x))
Sage commandline, line 2::
sage: u = sin(x) + x*cos(y)
sage: v = u.function(x, y)
sage: v
Sage commandline, line 7::
sage: f = (e^x-1) / (1+e^(x/2))
sage: f.simplify_exp()
Sage commandline, line 11::
sage: f = cos(x)^6 + sin(x)^6 + 3 * sin(x)^2 * cos(x)^2
sage: f.simplify_trig()
Sage commandline, line 2::
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()
Sage commandline, line 2::
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()
Sage commandline, line 3::
sage: t = var('t')
sage: x = function('x',t)
sage: DE = diff(x, t) + x - 1
sage: desolve(DE, [x,t])
Sage commandline, line 9::
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])
Sage commandline, line 2::
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)
Sage commandline, line 2::
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)
Sage commandline, line 2::
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)
Sage commandline, line 2::
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()
Sage commandline, line 11::
sage: 1+1
sage: factor(x^2 + 2*x + 1)
"""