∑
n
=
s
t
C
⋅
f
(
n
)
=
C
⋅
∑
n
=
s
t
f
(
n
)
{\displaystyle \sum _{n=s}^{t}C\cdot f(n)=C\cdot \sum _{n=s}^{t}f(n)}
, onde C é uma constante.
∑
n
=
s
t
f
(
n
)
+
∑
n
=
s
t
g
(
n
)
=
∑
n
=
s
t
[
f
(
n
)
+
g
(
n
)
]
{\displaystyle \sum _{n=s}^{t}f(n)+\sum _{n=s}^{t}g(n)=\sum _{n=s}^{t}\left[f(n)+g(n)\right]}
∑
n
=
s
t
f
(
n
)
−
∑
n
=
s
t
g
(
n
)
=
∑
n
=
s
t
[
f
(
n
)
−
g
(
n
)
]
{\displaystyle \sum _{n=s}^{t}f(n)-\sum _{n=s}^{t}g(n)=\sum _{n=s}^{t}\left[f(n)-g(n)\right]}
∑
i
=
m
n
f
(
i
)
=
∑
i
=
m
+
p
n
+
p
f
(
i
−
p
)
{\displaystyle \sum _{i=m}^{n}f(i)=\sum _{i=m+p}^{n+p}f(i-p)}
∑
n
=
s
t
j
=
∑
n
=
1
t
j
−
∑
n
=
1
s
−
1
j
{\displaystyle \sum \limits _{n=s}^{t}j=\sum \limits _{n=1}^{t}j-\sum \limits _{n=1}^{s-1}j}
∑
n
=
s
j
f
(
n
)
+
∑
n
=
j
+
1
t
f
(
n
)
=
∑
n
=
s
t
f
(
n
)
{\displaystyle \sum _{n=s}^{j}f(n)+\sum _{n=j+1}^{t}f(n)=\sum _{n=s}^{t}f(n)}
, note que
s
≤
j
≤
t
{\displaystyle s\leq j\leq t}
∑
i
=
m
n
i
=
n
(
n
+
1
)
2
−
m
(
m
−
1
)
2
=
(
n
+
1
−
m
)
(
n
+
m
)
2
,
{\displaystyle \sum _{i=m}^{n}i={\frac {n(n+1)}{2}}-{\frac {m(m-1)}{2}}={\frac {(n+1-m)(n+m)}{2}},}
progressão aritmética.
∑
i
=
0
n
i
=
∑
i
=
1
n
i
=
n
(
n
+
1
)
2
{\displaystyle \sum _{i=0}^{n}i=\sum _{i=1}^{n}i={\frac {n(n+1)}{2}}}
∑
k
=
0
n
−
1
2
k
=
2
n
−
1
{\displaystyle \sum \limits _{k=0}^{n-1}{2^{k}}=2^{n}-1}
∑
i
=
s
m
∑
j
=
t
n
a
i
c
j
=
∑
i
=
s
m
a
i
⋅
∑
j
=
t
n
c
j
{\displaystyle \sum _{i=s}^{m}\sum _{j=t}^{n}{a_{i}}{c_{j}}=\sum _{i=s}^{m}a_{i}\cdot \sum _{j=t}^{n}c_{j}}
∑
i
=
0
n
i
3
=
(
∑
i
=
0
n
i
)
2
{\displaystyle \sum _{i=0}^{n}i^{3}=\left(\sum _{i=0}^{n}i\right)^{2}}
∑
i
=
m
n
−
1
a
i
=
a
m
−
a
n
1
−
a
(
m
<
n
)
{\displaystyle \sum _{i=m}^{n-1}a^{i}={\frac {a^{m}-a^{n}}{1-a}}(m<n)}
∑
i
=
0
n
−
1
a
i
=
1
−
a
n
1
−
a
{\displaystyle \sum _{i=0}^{n-1}a^{i}={\frac {1-a^{n}}{1-a}}}
Soma simples
∑
i
=
1
n
x
i
=
x
1
+
x
2
+
.
.
.
+
x
n
{\displaystyle \sum _{i=1}^{n}x_{i}=x_{1}+x_{2}+...+x_{n}}
Soma de quadrados
∑
i
=
1
n
x
i
2
=
x
1
2
+
x
2
2
+
.
.
.
+
x
n
2
{\displaystyle \sum _{i=1}^{n}x_{i}^{2}=x_{1}^{2}+x_{2}^{2}+...+x_{n}^{2}}
Quadrado da soma
(
∑
i
=
1
n
x
i
)
2
=
(
x
1
+
x
2
+
.
.
.
+
x
n
)
2
{\displaystyle (\sum _{i=1}^{n}x_{i})^{2}=(x_{1}+x_{2}+...+x_{n})^{2}}
Soma de produtos
∑
i
=
1
n
x
i
y
i
=
x
1
y
1
+
x
2
y
2
+
.
.
.
+
x
n
y
n
{\displaystyle \sum _{i=1}^{n}x_{i}y_{i}=x_{1}y_{1}+x_{2}y_{2}+...+x_{n}y_{n}}
Produtos das somas
(
∑
i
=
1
n
x
i
)
(
∑
j
=
1
m
y
j
)
=
(
x
1
+
x
2
+
.
.
.
+
x
n
)
(
y
1
+
y
2
+
.
.
.
+
y
n
)
{\displaystyle (\sum _{i=1}^{n}x_{i})(\sum _{j=1}^{m}y_{j})=(x_{1}+x_{2}+...+x_{n})(y_{1}+y_{2}+...+y_{n})}
Elixir
defmodule FMC do
def somatorio(start \\0, finish, callback)
def somatorio(start, finish, callback) when start == finish do
callback.(start)
end
def somatorio(start, finish, callback) do
_somatorio(Enum.to_list(start..finish), callback)
end
defp _somatorio([], _), do: 0
defp _somatorio([head | tail], callback) do
callback.(head) + _somatorio(tail, callback)
end
end