Skip to content

question about matrix

3 messages · Cynthia He, Douglas Bates, Spencer Graves

#
Cynthia He <dingdong1205 at yahoo.com> writes:
Use the outer product function, as in
[,1] [,2] [,3] [,4]
[1,]    0    0    0    0
[2,]    1    1    1    1
[3,]    2    4    8   16
[4,]    3    9   27   81
[5,]    4   16   64  256
[6,]    5   25  125  625
#
outer(0:2, 1:2, "^")
     [,1] [,2]
[1,]    0    0
[2,]    1    1
[3,]    2    4

      Is this what you want? 

      spencer graves
Cynthia He wrote: