Macaulay2 » Documentation
Packages » Macaulay2Doc :: table
next | previous | forward | backward | up | index | toc

table -- make a table from a binary function

Synopsis

Description

The command table(m, n, f) is equivalent to table(0..(m-1), 0..(n-1), f).

i1 : t1 = table({1,3,5,7}, {0,1,2,4}, (i,j) -> i^j)

o1 = {{1, 1, 1, 1}, {1, 3, 9, 81}, {1, 5, 25, 625}, {1, 7, 49, 2401}}

o1 : List
i2 : t2 = table(5, 5, (i,j) -> i+j)

o2 = {{0, 1, 2, 3, 4}, {1, 2, 3, 4, 5}, {2, 3, 4, 5, 6}, {3, 4, 5, 6, 7}, {4,
     ------------------------------------------------------------------------
     5, 6, 7, 8}}

o2 : List

Tables can be displayed nicely using netList.

i3 : netList t1

     +-+-+--+----+
o3 = |1|1|1 |1   |
     +-+-+--+----+
     |1|3|9 |81  |
     +-+-+--+----+
     |1|5|25|625 |
     +-+-+--+----+
     |1|7|49|2401|
     +-+-+--+----+

See also

For the programmer

The object table is a function closure.