# 10 - PRODUTORIO-SOMATORIO-SERIES-MATEMATICAS

## 1081 days ago by jmarcellopereira

SOMATÓRIO, PRODUTÓRIO E SÉRIES MATEMÁTICAS

SOMATÓRIO

var('k') sum(1/k^5, k, 1, 10).n()
 1.03690734134469 1.03690734134469
# de 1 até o infinito sum(1/k^5, k, 1, oo).n()
 1.03692775514337 1.03692775514337

PRODUTÓRIO

prod([1,2,3])
 6 6
prod([2,4], 5)
 40 40
prod((2,4), 5)
 40 40
F = factor(1084200) F
 2^3 * 3 * 5^2 * 13 * 139 2^3 * 3 * 5^2 * 13 * 139
prod(F)
 1084200 1084200
prod?
 File: /home/jmarcellopereira/SageMath/src/sage/misc/misc_c.pyx Type: Definition: prod(x, z=None, recursion_cutoff=5) Docstring: Return the product of the elements in the list x. If optional argument z is not given, start the product with the first element of the list, otherwise use z. The empty product is the int 1 if z is not specified, and is z if given. This assumes that your multiplication is associative; we don’t promise which end of the list we start at. EXAMPLES: sage: prod([1,2,34]) 68 sage: prod([2,3], 5) 30 sage: prod((1,2,3), 5) 30 sage: F = factor(-2006); F -1 * 2 * 17 * 59 sage: prod(F) -2006  AUTHORS: Joel B. Mohler (2007-10-03): Reimplemented in Cython and optimized Robert Bradshaw (2007-10-26): Balanced product tree, other optimizations, (lazy) generator support Robert Bradshaw (2008-03-26): Balanced product tree for generators and iterators File: /home/jmarcellopereira/SageMath/src/sage/misc/misc_c.pyx Type: Definition: prod(x, z=None, recursion_cutoff=5) Docstring: Return the product of the elements in the list x. If optional argument z is not given, start the product with the first element of the list, otherwise use z. The empty product is the int 1 if z is not specified, and is z if given. This assumes that your multiplication is associative; we don’t promise which end of the list we start at. EXAMPLES: sage: prod([1,2,34]) 68 sage: prod([2,3], 5) 30 sage: prod((1,2,3), 5) 30 sage: F = factor(-2006); F -1 * 2 * 17 * 59 sage: prod(F) -2006  AUTHORS: Joel B. Mohler (2007-10-03): Reimplemented in Cython and optimized Robert Bradshaw (2007-10-26): Balanced product tree, other optimizations, (lazy) generator support Robert Bradshaw (2008-03-26): Balanced product tree for generators and iterators
taylor?
 File: /home/jmarcellopereira/SageMath/local/lib/python2.7/site-packages/sage/calculus/functional.py Type: Definition: taylor(f, *args) Docstring: Expands self in a truncated Taylor or Laurent series in the variable v around the point a, containing terms through (x - a)^n. Functions in more variables are also supported. INPUT: *args - the following notation is supported x, a, n - variable, point, degree (x, a), (y, b), ..., n - variables with points, degree of polynomial EXAMPLES: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6) -1/720*(45*k^6 - 60*k^4 + 16*k^2)*x^6 - 1/24*(3*k^4 - 4*k^2)*x^4 - 1/2*k^2*x^2 + 1  sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1  sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1  Taylor polynomial in two variables: sage: x,y=var('x y'); taylor(x*y^3,(x,1),(y,-1),4) (x - 1)*(y + 1)^3 - 3*(x - 1)*(y + 1)^2 + (y + 1)^3 + 3*(x - 1)*(y + 1) - 3*(y + 1)^2 - x + 3*y + 3  File: /home/jmarcellopereira/SageMath/local/lib/python2.7/site-packages/sage/calculus/functional.py Type: Definition: taylor(f, *args) Docstring: Expands self in a truncated Taylor or Laurent series in the variable v around the point a, containing terms through (x - a)^n. Functions in more variables are also supported. INPUT: *args - the following notation is supported x, a, n - variable, point, degree (x, a), (y, b), ..., n - variables with points, degree of polynomial EXAMPLES: sage: var('x,k,n') (x, k, n) sage: taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6) -1/720*(45*k^6 - 60*k^4 + 16*k^2)*x^6 - 1/24*(3*k^4 - 4*k^2)*x^4 - 1/2*k^2*x^2 + 1  sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1  sage: taylor ((x + 1)^n, x, 0, 4) 1/24*(n^4 - 6*n^3 + 11*n^2 - 6*n)*x^4 + 1/6*(n^3 - 3*n^2 + 2*n)*x^3 + 1/2*(n^2 - n)*x^2 + n*x + 1  Taylor polynomial in two variables: sage: x,y=var('x y'); taylor(x*y^3,(x,1),(y,-1),4) (x - 1)*(y + 1)^3 - 3*(x - 1)*(y + 1)^2 + (y + 1)^3 + 3*(x - 1)*(y + 1) - 3*(y + 1)^2 - x + 3*y + 3 
var('x,k,n')
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(x, k, n\right)
taylor ((x-5)^n, x, 0, 2)
 \newcommand{\Bold}[1]{\mathbf{#1}}-\frac{1}{5} \, \left(-5\right)^{n} n x + \frac{1}{50} \, {\left(\left(-5\right)^{n} n^{2} - \left(-5\right)^{n} n\right)} x^{2} + \left(-5\right)^{n}

%%% FIM SOMATORIO, PRODUTORIO E SERIES MATEMATICAS %%%

sum?
 File: /home/jmarcellopereira/SageMath/local/lib/python2.7/site-packages/sage/misc/functional.py Type: Definition: sum(expression, *args, **kwds) Docstring: Returns the symbolic sum \sum_{v = a}^b expression with respect to the variable v with endpoints a and b. INPUT: expression - a symbolic expression v - a variable or variable name a - lower endpoint of the sum b - upper endpoint of the sum algorithm - (default: 'maxima') one of 'maxima' - use Maxima (the default) 'maple' - (optional) use Maple 'mathematica' - (optional) use Mathematica 'giac' - (optional) use Giac EXAMPLES: sage: k, n = var('k,n') sage: sum(k, k, 1, n).factor() 1/2*(n + 1)*n  sage: sum(1/k^4, k, 1, oo) 1/90*pi^4  sage: sum(1/k^5, k, 1, oo) zeta(5)  Warning This function only works with symbolic expressions. To sum any other objects like list elements or function return values, please use python summation, see http://docs.python.org/library/functions.html#sum In particular, this does not work: sage: n = var('n') sage: list=[1,2,3,4,5] sage: sum(list[n],n,0,3) Traceback (click to the left of this block for traceback) ...  File: /home/jmarcellopereira/SageMath/local/lib/python2.7/site-packages/sage/misc/functional.py Type: Definition: sum(expression, *args, **kwds) Docstring: Returns the symbolic sum \sum_{v = a}^b expression with respect to the variable v with endpoints a and b. INPUT: expression - a symbolic expression v - a variable or variable name a - lower endpoint of the sum b - upper endpoint of the sum algorithm - (default: 'maxima') one of 'maxima' - use Maxima (the default) 'maple' - (optional) use Maple 'mathematica' - (optional) use Mathematica 'giac' - (optional) use Giac EXAMPLES: sage: k, n = var('k,n') sage: sum(k, k, 1, n).factor() 1/2*(n + 1)*n  sage: sum(1/k^4, k, 1, oo) 1/90*pi^4  sage: sum(1/k^5, k, 1, oo) zeta(5)  Warning This function only works with symbolic expressions. To sum any other objects like list elements or function return values, please use python summation, see http://docs.python.org/library/functions.html#sum In particular, this does not work: sage: n = var('n') sage: list=[1,2,3,4,5] sage: sum(list[n],n,0,3) Traceback (most recent call last): ... TypeError: unable to convert n to an integer  Use python sum() instead: sage: sum(list[n] for n in range(4)) 10  Also, only a limited number of functions are recognized in symbolic sums: sage: sum(valuation(n,2),n,1,5) Traceback (most recent call last): ... TypeError: unable to convert n to an integer  Again, use python sum(): sage: sum(valuation(n+1,2) for n in range(5)) 3  (now back to the Sage sum examples) A well known binomial identity: sage: sum(binomial(n,k), k, 0, n) 2^n  The binomial theorem: sage: x, y = var('x, y') sage: sum(binomial(n,k) * x^k * y^(n-k), k, 0, n) (x + y)^n  sage: sum(k * binomial(n, k), k, 1, n) 2^(n - 1)*n  sage: sum((-1)^k*binomial(n,k), k, 0, n) 0  sage: sum(2^(-k)/(k*(k+1)), k, 1, oo) -log(2) + 1  Another binomial identity (trac ticket #7952): sage: t,k,i = var('t,k,i') sage: sum(binomial(i+t,t),i,0,k) binomial(k + t + 1, t + 1)  Summing a hypergeometric term: sage: sum(binomial(n, k) * factorial(k) / factorial(n+1+k), k, 0, n) 1/2*sqrt(pi)/factorial(n + 1/2)  We check a well known identity: sage: bool(sum(k^3, k, 1, n) == sum(k, k, 1, n)^2) True  A geometric sum: sage: a, q = var('a, q') sage: sum(a*q^k, k, 0, n) (a*q^(n + 1) - a)/(q - 1)  The geometric series: sage: assume(abs(q) < 1) sage: sum(a*q^k, k, 0, oo) -a/(q - 1)  A divergent geometric series. Don’t forget to forget your assumptions: sage: forget() sage: assume(q > 1) sage: sum(a*q^k, k, 0, oo) Traceback (most recent call last): ... ValueError: Sum is divergent.  This summation only Mathematica can perform: sage: sum(1/(1+k^2), k, -oo, oo, algorithm = 'mathematica') # optional - mathematica pi*coth(pi)  Use Maple as a backend for summation: sage: sum(binomial(n,k)*x^k, k, 0, n, algorithm = 'maple') # optional - maple (x + 1)^n  Python ints should work as limits of summation (trac ticket #9393): sage: sum(x, x, 1r, 5r) 15  Note Sage can currently only understand a subset of the output of Maxima, Maple and Mathematica, so even if the chosen backend can perform the summation the result might not be convertable into a Sage expression.