9!:14 '' j504/2005-03-30/13:35 +/@i. t. i.4 0 _1r2 1r2 0
So, J knows that NB. for n integer > 0 (+/ i. n) = (n*(n-1))%2 (+/ i. n) = (_1r2*n) + 1r2*n*n (+/ i. n) = (0 _1r2 1r2 0 p. n) Then why not n=: 6 f =: +/ @: (2: * i.) NB. sum of first n even numbers (starting at 0) f n NB. n*n-1 30 f t. i.4 |domain error | f t.i.4 g =: +/ @: (1: + 2: * i.) NB. sum of first n odd numbers g n NB. n*n 36 g t. i.4 |domain error | g t.i.4 h =: +/ @: *: @: i. NB. sum of square of first n numbers (starting at 0) h n 55 h t. i.5 NB. probably a third degree polynomial |domain error | h t.i.5 What am I doing wrong? Are the functions f g and h defined in a way that is not acceptable to t. ? Thanks for the help Paul Maurice ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
