Common.Real.Sequence.Arithmetic #
A characterization of an arithmetic sequence, i.e. a sequence with a common difference between each term.
Returns the value of the n
th term of an arithmetic sequence.
This function calculates the value of this term directly. Keep in mind the
sequence is 0
th-indexed.
Equations
- Real.Arithmetic.termClosed seq n = seq.a₀ + seq.Δ * ↑n
Instances For
Returns the value of the n
th term of an arithmetic sequence.
This function calculates the value of this term recursively. Keep in mind the
sequence is 0
th-indexed.
Equations
- Real.Arithmetic.termRecursive x 0 = x.a₀
- Real.Arithmetic.termRecursive x (Nat.succ n) = x.Δ + Real.Arithmetic.termRecursive x n
Instances For
The recursive and closed term definitions of an arithmetic sequence agree with one another.
A term is equal to the next in the sequence minus the common difference.
The summation of the first n + 1
terms of an arithmetic sequence.
This function calculates the sum directly.
Equations
- Real.Arithmetic.sumClosed seq n = (↑n + 1) * (seq.a₀ + Real.Arithmetic.termClosed seq n) / 2
Instances For
The summation of the first n + 1
terms of an arithmetic sequence.
This function calculates the sum recursively.
Equations
- Real.Arithmetic.sumRecursive x 0 = x.a₀
- Real.Arithmetic.sumRecursive x (Nat.succ n) = Real.Arithmetic.termClosed x (n + 1) + Real.Arithmetic.sumRecursive x n
Instances For
The recursive and closed definitions of the sum of an arithmetic sequence agree with one another.