6.2.1 Array of values of a sequence
The tablefunc
command fills two columns of a spreadsheet with
a table of values of a function. The spreadsheet can be opened with
Alt+T (see Section 2.10).
-
tablefunc takes four arguments:
-
f(x), a formula for a function.
- x, the variable.
- x0, the beginning value of x.
- inc, an increment for x.
- tablefunc(f(x),x,x0,inc)
fills two columns of the spreadsheet, the current column and the
following column, starting with the chosen cell. The current column
starts with the variable x, followed by the initial value x0,
then x0+inc, x0+2inc, …. The
following column starts with the formula f(x), followed by f(x)
evaluated at the values in the first column. (If the current cell is
column C, row n, it will contain x, the
cell below it will contain inc, and the cell below it in row k will contain
=C(k−1)+C$(n+1), and the corresponding cells in the
next column will contain
=evalf(subst(D$n,C$n,Ck)).)
Example
To display the values of the sequence un=sin(n),
select a cell of a spreadsheet (for example C0) and input
tablefunc(sin(n),n,0,1) in the spreadsheet commandline.
You get:
row | C | D |
| n | sin(n) |
| 0 | 0.0 |
| 1 | 0.841470984808 |
| 2 | 0.909297426826 |
| 3 | 0.14112000806 |
| 4 | −0.756802495308 |
| ⋮ | ⋮ |
The graphic representation may be plotted with the plotfunc
command (see 19.2.1).