[ANN] rubygems roots-1.0.0

This is an announcement of the release of rubygems ‘roots-1.0.0’.

The ‘roots’ gem provides two methods ‘root’ and ‘roots’ which will
compute all n roots of a real or complex number.

The paper describing the math/operation of it can be read/downloaded
here:

The use syntax for ‘root’ and ‘roots’ is shown below.

Use syntax: val.root(n,{k})
root(n,k=0) n is root 1/n exponent, integer > 0
k is nth ccw root 1…n , integer >=0
If k not given default root returned, which are:
for +val => real root |val**(1.0/n)|
for -val => real root -|val**(1.0/n)| when n is odd
for -val => first ccw complex root when n is even

9.root(2); -32.root(5,3); (-100.43).root 6,6

Use syntax: val.roots(n,{opt})
roots(n,opt=0) n is root 1/n exponent, integer > 0
opt, optional string input, are:
0 : default (no input), return array of n ccw roots
‘c’|‘C’: complex, return array of complex roots
‘e’|‘E’: even, return array even numbered roots
‘o’|‘O’: odd , return array odd numbered roots
‘i’|‘I’: imag, return array of imaginary roots
‘r’|‘R’: real, return array of real roots
An empty array is returned for an opt with no members.

9348134943.roots(9); -89.roots(4,‘real’); 2.2.roots 3,‘Im’

Can ask: How many real roots of x: x.roots(n,‘real’).size
What’s the 3rd 5th root of (4+9i): Complex(4,9).root(5,3)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs