RecursiveSeq(recurrence, yn, n, initial, start) is the sequence yn
(an undefined function applied to the symbol n) defined by yn = recurrence for n >= start, where recurrence uses earlier terms
y(n - k), with the first terms initial (default dummy symbols), as
SymPy's RecursiveSeq. coeff(s, i) and sequence_terms(s, k) give
its terms; recursive_seq_recurrence(s) is the equation yn = recurrence.
Examples
n <- Symbol("n"); y <- Function("y")
fib <- RecursiveSeq(y(n - 1) + y(n - 2), y(n), n, list(0, 1))
sequence_terms(fib, 10)
#> [[1]]
#> 0
#>
#> [[2]]
#> 1
#>
#> [[3]]
#> 1
#>
#> [[4]]
#> 2
#>
#> [[5]]
#> 3
#>
#> [[6]]
#> 5
#>
#> [[7]]
#> 8
#>
#> [[8]]
#> 13
#>
#> [[9]]
#> 21
#>
#> [[10]]
#> 34
#>