Index   <<   >>

Fun with 1

After 0 , the most frequently occurring constant is 1 . J provides a large set of verbs having to do with 1 .

There are primitives for adding 1 (>:), subtracting 1 (<:), subtracting from 1 (-.), and dividing into 1 (%). There is a primitive whose monad and dyad both yield 1 (1:). What are their uses?

One common use for adding 1 is in working with decimal representations, frequently accompanying a use of log base 10 . For example, to treat the digits of a positive integer separately, the number of 10’s needed to give the full representation of the number is 1 more than the floor of the log base 10 of the number. Another common use is to convert the number resulting from the fixed 0-origin of J to 1-origin, for example, in giving the matchups of players in a tournament.

Subtracting 1 from occurs in iterations, in working with the beta and gamma functions and with Taylor series.

George Boole used “subtracting 1 from” to define logical “not” in his truth calculus. Thus 1-0 is 1 and 1-1 is 0 . J generalizes logical “not” in the same way as Boole, but extends the domain to fractions, to facilitate dealing with probabilities, and arbitrary numbers.

“Dividing into 1” is an old APL primitive (reciprocal) and doesn’t need discussion here.

The “constant 1” verb 1: is discussed on the sheet Forever the same.