0.0
No commit activity in last 3 years
No release in over 3 years
Wrapper around Math module; Has additional methods.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

mathematics

Wrapper around Ruby Math module; Has additional methods.
http://rubygems.org/gems/mathematics

--------------
mathematics.rb
--------------

IMPORTANT NOTE:
--------------
This program introduces/relies on "Prior Knowledge"
in the domain of mathematics, and avoids
computation where unnecessary.

Also, resorting to computation sometimes doesn't yield
perfect results as known/anticipated. Example:
(environment: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0])

$ ruby -e "puts Math.sin(Math::PI) # I expect 0"
1.2246467991473532e-16

Under the hood of "Prior Knowledge" style/paradigm of programming, some characteristic functions can manifest as "Intelligent Functions".
The intelligent function can rely on proven, tested, established
knowledge bases/answers; retrieving the result(s) can be on one or
more of these lines ...
. from cache (in-memory/local/remote/distributed)
. via delegation
. via rpc/rest/*cloud calls
.. depending on the need/nature of the "intelligent function" in the
domain space, and the prior knowledge of the complexity vis-a-vis
the path to take (not resorting to any call based on judgement,
distills down to a normal function,
which is a subset of the intelligent function).

install

gem install mathematics

use

require 'mathematics'

Mathematics.add(1,2)
Mathematics.sum(1,2,3)
Mathematics.total(1,2,3,4)

Mathematics.average(1,2,3)
Mathematics.avg(1,2,3,4)
Mathematics.mean(1,2,3,4,5)

Mathematics.sin(0)
Mathematics.cos(0)
Mathematics.sin(Math::PI/2)
Mathematics.cos(Math::PI/2)

comments

Feel free to provide comments

LICENSE

MIT - http://opensource.org/licenses/MIT