Roots Module (code)

Module 'Roots' provides two methods 'root' and 'roots' which will
find all the nth roots for all real, and complex , numerical types.

View and download code here:

Install process:
Place module file 'roots.rb' into 'lib' directory of ruby version.
Then from irb session, or a source code file, do:

require 'roots'
#For extended math features also do: require 'mathn'
#Mixin 'Roots' into class Numeric
class Numeric; include Roots end

Can now find nth root(s) of all numerical types:

<floats>.root(s) n, opt
<integer>.root(s) n, opt
<rational>.root(s) n, opt
<complex>.root(s) n, opt
<bigdecimal>.root(s) n, opt

It would be nice for this capability to be considered for Ruby core.

Jabari Zakiya