JPhrases/FunctionTables
< JPhrases
Jump to navigation
Jump to search
1D. Function Tables
d0=: +/ Addition table d1=: */ Multiplication table d2=: >./ Maximum table d3=: [ by ] over +/ Bordered addition table d4=: by=: ' '&;@,.@[,.] Format function d5=: over=: ({.;}.)@":@, Format function m6=: +/~@i. Addition table on first y integers m7=: bc=: !/~@i. Binomial coefficients of order y a8=: ft=: 1 : 'x/~@i.' Function table a9=: bft=: 1 : 'i. by i. over x/~@i.' Bordered function table (Explicit definition)
The first three phrases produce function tables as illustrated below:
2 3 5 (d0 ; d1 ; d2) 0 1 2 3 4 5 +----------------------------------------+ |2 3 4 5 6 7|0 2 4 6 8 10|2 2 2 3 4 5| |3 4 5 6 7 8|0 3 6 9 12 15|3 3 3 3 4 5| |5 6 7 8 9 10|0 5 10 15 20 25|5 5 5 5 5 5| +----------------------------------------+
The next produces an addition table bordered by its arguments for easy reading; m6 and m7 produce tables on lists of integers, and the adverb a9 produces a bordered function table:
2 3 5 d3 0 1 2 3 4 5 +--------------+ | |0 1 2 3 4 5| +-+------------+ |2|2 3 4 5 6 7| |3|3 4 5 6 7 8| |5|5 6 7 8 9 10| +--------------+ (m6 ; m7) 5 +-------------------+ |0 1 2 3 4|1 1 1 1 1| |1 2 3 4 5|0 1 2 3 4| |2 3 4 5 6|0 0 1 3 6| |3 4 5 6 7|0 0 0 1 4| |4 5 6 7 8|0 0 0 0 1| +-------------------+ % a9 5 +------------------------+ | |0 1 2 3 4| +-+----------------------+ |0|0 0 0 0 0| |1|_ 1 0.5 0.3333333 0.25| |2|_ 2 1 0.6666667 0.5| |3|_ 3 1.5 1 0.75| |4|_ 4 2 1.33333 1| +-+----------------------+