# num-utils

Please test ministat.

## numaverage

Find the average of a set of numbers.

-i Only return the integer portion of the final sum.

-I Only return the decimal portion of the final sum

-m Find the mode (most occuring) of the list of numbers, or when there's more than one mode, the first completed mode.

-M Find the median (middle number) of the list of numbers.

-l When finding the median and the count of numbers in the set is even, use the lower middle number instead of the upper middle number.

$ echo -e '1\n2\n3\n5.0\n\n' | numaverage -i
2
$ echo -e '1\n2\n3\n5.0\n\n' | numaverage -I
.75
$ echo -e '1\n2\n3\n5.0\n\n' | numaverage -M
3
$ echo -e '1\n2\n3\n5.0\n\n' | numaverage -l
2.75

## numbound

Find boundary numbers in files or STDIN.

$ echo -e '1\n2\n3\n5.0\n\n' | numbound
5.0
$ echo -e '1\n2\n3\n5.0\n\n' | numbound -l
1

## numgrep

This program is the numeric equivilent of the grep utility.

## numinterval

Show the numeric intervals between each line in a file.

$ echo -e '1\n2\n3\n5.0\n\n' | numinterval
1
1
2

## numnormalize

Normalize a set of numbers. By default between 0 and 1.

$ echo -e '1\n2\n3\n5.0\n\n' | numnormalize
0.0909090909090909
0.181818181818182
0.272727272727273
0.454545454545455

## numprocess

This program mutates numbers as it encounters them.

Convert from celcius to fahreheit degrees. Multiply by 9, divide by 5 and add 32:

$ echo -e '1\n2\n3\n5.0\n\n' | numprocess /*9,%5,+32/
33.8
35.6
37.4
41

## numrandom

Print out a random number.

$ numrandom /1..10/
7

## numrange

Print out a range of numbers for use in for loops and such.

$ numrange /1..10,15..20/
1 2 3 4 5 6 7 8 9 10 15 16 17 18 19 20

## numround

A program that rounds off numbers it encounters.

-c Force the number to be rounded up. Ceiling.

-f Force the number to be rounded down. Floor.

-n <n> Round numbers to the nearest factor of <n>.

## numsum

-i Only return the integer portion of the final sum.

-I Only return the decimal portion of the final sum.

-c Print out the sum of each column.

-r Print out the sum of each row.

-x <n> Specify a comma seperated list of columns to print.

-y <n> Specify a comma seperated list of rows to print.

-s <string> Specify a string to use as a seperator for columns. This defaults to be consecutive whitespace (\s+).