>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

numeric: numeric utilities

Name Type Description
baserep verb y in base x
clean verb clean y to tolerance of x (default 1e_10)
colsum verb sum data columns of matrix by key
groupndx verb group indices of y in x
int01 verb interval in n steps from 0 to 1 (= steps 0 1,n)
linsert verb linear insert x (default 2) steps into y
randomize verb sets a random value into random link
range verb range from a to b [in steps of c]
recur verb solves recurrence r(i)=a(i)+r(i-1)*m(i-1)
round verb round y to nearest x (e.g. 1000 round 12345)
roundbanker verb round y to nearest x with bankers rounding
rounddist verb round y to nearest x preserving total
rounddown verb round y down to nearest x (e.g. 1000 round 12345)
roundint verb round to nearest integer
roundup verb round y up to nearest x (e.g. 1000 round 12345)
steps verb steps from a to b in c steps

clean

clean y to tolerance of x (default 1e_10)
form: tolerance (default 1e_10) clean numbers
sets values less than tolerance to 0

colsum

sum data columns of matrix by key
form: key colsum mat
sum data columns of matrix on key columns
e.g. if column 2 of mat is age, then
   2 colsum mat
sums the remaining columns by age

groupndx

group indices of y in x
Return group indices of elements of y
x is an integer vector of the starting numbers of each group,
assumed to be in ascending order.
e.g.  0 0 0 1 1 1 2 2  =  0 3 6 groupndx i.8
i.e.  <:@(+/@(<:/))
groupndx=: 4 : '<: (#x) }. (+/\r<#x) /: r=. /: x,y'

range

range from a to b [in steps of c]
range a,b[,c] = range from a to b [in steps of c]

recur

solves recurrence r(i)=a(i)+r(i-1)*m(i-1)
form: r = m recur a
  r(0) = a(0)
  r(i) = a(i)+r(i-1)*m(i-1)
e.g    1.05 1.10 recur 100 100 100
    100 205 325.5

roundbanker

round y to nearest x with bankers rounding

round y to nearest x

if y is a mid point, it is rounded up if even, down if odd

   0.1 roundbanker 1.23 2.15 2.25 2.35 2.45
1.2 2.2 2.2 2.4 2.4

rounddist

round y to nearest x preserving total
distributive rounding

round y to nearest x preserving total to nearest x

e.g.
   0.1 rounddist 6$0.45
0.5 0.4 0.5 0.4 0.5 0.4

steps

steps from a to b in c steps
form: steps a,b,c


>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User