### 6.2.3 Table of values and graph of a recurrent sequence

The tableseq command fills a column of a spreadsheet with a recurrence relation. The spreadsheet can be opened with Alt+T (see Section 2.10).

tableseq takes three arguments, which can be different depending on how many terms are involved in the recurrence relation.

- For a one term recurrence relation, tableseq takes three arguments:
  - f(x), a formula which defines the recurrence, through un+1=f(un).
  - x, the variable.
  - u0, the initial term of the sequence.
- tableseq(f(x),x,u0) fills the current column of the spreadsheet, starting with the selected cell (or cell 0 if the entire column is selected), with the formula f(x), the next cell with the variable x, followed by the terms u0, u1, … of the sequence. (If the current cell is column C, row n, these latter cells will actually contain (if in row k) =evalf(subst(C$n,C$(n+1),C(k−1))), which means if you change the value in one cell, the values in the later cells will change accordingly.) See also Section 19.8.4, for a graphic representation of a one-term recurrence sequence.
- More generally, for a recurrence relation where each term depends on the previous k terms, tableseq takes three arguments:
  - f(x1,x2,…,xk), a formula which defines the recurrence, through un+1=f(un,…,un−k).
  - [x1,…,xk], a list of variables.
  - [u0,…,uk−1], a list of the beginning k terms.
- tableseq(f(x1,…,xk),[x1,…,xk],[u0,…,uk−1]) fills the current column of the spreadsheet, starting with the selected cell (or cell 0 if the entire column is selected), with the formula f(x1,x2,…,xk), followed by the variables x1,…,xk, followed by the terms u0, u1, … of the sequence.

#### Examples

To display the values of the sequence u0=3.5, un+1=sin(un), select a cell of the spreadsheet, say B0, and input tableseq(sin(x),x,3.5) in the command line. By pressing Enter, The corresponding column of the spreadsheet is filled with the recurrence relation and an initial portion of the sequence:

row | B
0 | sin(x)
1 | x
2 | 3.5
3 | −0.35078322769
4 | −0.343633444925
5 | −0.336910330426
… | …

To display the values of the Fibonacci sequence u0=1, u1=1,…, un+2=un+un+1, select a cell, say B0, and input tableseq(x+y,[x,y],[1,1]) in the commandline. You get:

row | B
0 | x+y
1 | x
2 | y
3 | 1
4 | 1
5 | 2
… | …