STICK stands for Scientific Code Kit. The goal of this project is to provide a general purpose, comprehensive math and science library the Ruby programming language. Of course, the name also alludes to "measuring stick", and for good reason. STICK's primary library, units.rb, provides a powerful SI units system which integrates directly into Ruby's method dispatch system. With it, one can quickly perform typed calculations and conversions.
Here are few simple examples:
reqiure 'stick/units' include Units 1.mile.to(feet) 1.acre.to(yd**2) 1.acre.to(sq_yd) 1.gallon.to(self.L) 1.lb.to(kg) 1.m.s.to(m.s) 1.sq_mi.to(km**2) 1.mile.to(km) 1.usd.to(twd) 1.bit/s + 8.bytes/s
Pretty scienterrific, yes?
Also included in the STICK library is a module of real world contants. The constants are stored in the Math::Constants module, but this is included in Math for direct use by other Math libraries. Math::Constants::CGS provides the constants in cm kg s format, instead of the standard m kg s. Some examples...
require 'stick/constants' Math::SPEED_OF_LIGHT #=> 2.99792458e8 m/s Math::CGS::SPEED_OF_LIGHT #=> 2.99792458e10 cm/s
You will also find a new Matrix library include in Stick this is the matrix class, taken from RUby 1.9 and extended with Cosmin Bonschis work from his Google's Summer of Code 2007 project. Combining the matrix and units system, we can perform typed matrix operations.
Matrix[[1,2,3]] * 1.kg => [[1 kg, 2 kg, 3 kg]]
You will also find the Quaternion class in the package. A bit esoteric, but there it is.
An earlier version of Stick contained a set of convenient extensions for Time, in times.rb. We have however deprecated those as they did not integrate with the units systems. We will consider a replacement for this in the future.
STICK is copyright by Peter Vanbroekhoven and Thomas Sawyer. Some adapted works also have respective copyrights to their contributors.
STICK is distributed under the terms of the MIT license.