BigMathR
This is a math module that using the BigDecimal class. Multiple-precision arithmetic supports real and complex solutions.
Installation
It doesn't use any external libraries that have dependencies. Use only the BigDecimal class.
gem install bigdecimal-math_r
Usage
When it is called, the BigDecimal class is also called.
require 'bigdecimal/math_r'
The functions at the top level BigMathR
of the module, are mathematical constants in uppercase letters, and mathematical functions in lowercase.
Mathematical functions are compatible with both real and complex solutions.
Constants:
:E (Constant e),
:LOG2 (Natural logarithm of 2)
:LOG_PI (Natural logarithm of pi)
:LOG10 (Natural logarithm of 10)
:SQRT2 (Square root of 2)
:SQRT3 (Square root of 3)
:PI (Constant pi)
Functions:
:exp (Exponential function)
:exp2 (Base-2 (Binary) exponent)
:log (Natural logarithm)
:log2 (Binary logarithm)
:log10 (Common logarithm)
:log1p (log(1+x))
:hypot (Hypotenuse)
:sqrt (Square root)
:cbrt (Cubic root)
:sin (Sine)
:cos (Cosine)
:tan (Tangent)
:sec (Secant)
:csc (Cosecant)
:cot (Cotangent)
:sinh (Hyperbolic sine)
:cosh (Hyperbolic cosine)
:tanh (Hyperbolic tangent)
:csch (Hyperbolic cosecant)
:sech (Hyperbolic secant)
:coth (Hyperbolic cotangent)
:asin (Inverse Sine)
:acos (Inverse Cosine)
:atan, :atan2 (Inverse Tangent)
:acsc (Inverse Cosecant)
:asec (Inverse Secant)
:acot (Inverse Cotangent)
:acosh (Inverse Hyperbolic Sine)
:asinh (Inverse Hyperbolic Cosine)
:atanh (Inverse Hyperbolic Tangent)
:acsch (Inverse Hyperbolic Cosecant)
:asech (Inverse Hyperbolic Secant)
:acoth (Inverse Hyperbolic Cotangent)
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/tribusonz-2/bigdecimal-math_r. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Bigdecimal::MathR project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.