Coder Social home page Coder Social logo

num's Introduction

Num: number utilties for mathematics

Kickstarter project link -- please spread the word -- donate $1 if you can

Num is a command line tool that provides number utilities for mathematics.

Num focuses on ease of use and common functions such as min, max, sum, var, stdev, etc.

Syntax:

num [ options ] [ file ... ]

Examples:

$ echo "1 2 4" | num sum
7

$ echo "1 2 4" | num min max
1 4 7

$ echo "1 2 4" | num median mean
2 2.33333

$ echo "1 2 4" | num sum-of-squares standard-deviation
4.66667 1.24722

Help page:

Install

Download the num script to your own system, and put it somewhere you can run it.

Install using curl:

curl -sSL https://raw.githubusercontent.com/numcommand/num/master/implementations/num-awk/num -o /usr/local/bin/num

Install using wget:

wget https://raw.githubusercontent.com/numcommand/num/master/implementations/num-awk/num -O /usr/local/bin/num

If you use Mac OSX, then you also need GNU awk, such as:

brew install gawk --default-names

Caution: the project is new and is alpha quality, so give it a try, and don't use it for production until we have a 1.0 release in November.

If you have any issues with installation, please contact us directly or create a GitHub issue.

The roadmap includes a smoother safer installation process, using package managers such as apt, yum, brew, etc. If you would like to help with these, please contact us directly or create a GitHub issue.

Functions

Numbers Functions:

all                         All the items.
first                       The first item.
last                        The last item.

n                           The number of items.
count                       "
length                      "
size                        "

minimum                     The minimum value.
min                         "

maximum                     The maximum value.
max                         "

range                       The range, which is maximum - minimum.
spread                      "

sum                         The sum.
total                       "

Statistics Functions:

mean                        The arithmetic mean a.ka. average.
average                     "

median                      The median.
med                         "

median-low                  The low median, i.e. lesser of two middle values.
med-low                     "

median-high                 The high median, i.e. greater of two middle values.
med-high                    "

mode                        The mode, which may be multiple numbers or UNDEF. TODO.

mode-low                    The least value of the mode values or UNDEF. TODO.

mode-high                   The greatest value of the mode values or UNDEF. TODO.

variance                    The variance.
var                         "

sum-of-squares              The sum of squares (SS).
sum2                        "
ss                          "

standard-deviation          The standard deviation (SD).
stdev                       "
sd                          "

coefficient-of-variance     The coefficient of variance (CV).
covar                       "
cv                          "

Input/Output

Input can use stdin or an input file:

$ echo "1 2 4" | num sum
7

$ echo "1 2 4" > data.txt
$ num sum data.txt
7

Input can use an input field separator (FS) and/or input record separator (RS):

$ echo "1,2,3;4,5,6" | num sum FS=',' RS=';'
21

Output can use an output field separator (OFS):

$ echo "1 2 4" | num sum min max mean OFS=','
7,1,4,2.33333

Notation

Command line option dashes are optional, such as:

$ echo "1 2 4" | num sum-of-squares
$ echo "1 2 4" | num sumofsquares

If a value is unknown, or not a number, then it will print as "?". (#TODO)

$ echo "1 2 4" | num mode
?

Project Tracking

Author: Joel Parker Henderson ([email protected])

License: GPL, BSD, MIT

Created: 2015-03-28

Updated: 2015-10-20

Version: 0.2.0

num's People

Contributors

joelparkerhenderson avatar jallwine avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.