algebra-cyclic
creates a space isomorphic to Zp: the cyclic ring of order p, where p is prime
Installation | API | Examples | License
{:.responsive}
Installation
With npm do
npm install algebra-cyclic
API
algebraCyclic(elements)
- @param
{Array|String}
elements - @returns
{Object}
cyclic ring
algebraCyclic.error
An object exposing the following error messages:
- numberOfElementsIsNotPrime
- elementsAreNotUnique
Examples
All code in the examples below is intended to be contained into a single file.
var algebraCyclic = // Cyclic ring of vowels.var vowel = vowel // truevowel // truevowel // truevowel // truevowel // true vowel // falsevowel // falsevowel // falsevowel // false vowel // 'a'vowel // 'e'vowel // 'i'vowel // 'o'vowel // 'u'vowel // 'i'vowel // 'o'vowel // 'u'vowel // 'u'vowel // 'a'vowel // 'e'vowel // 'e'vowel // 'i'vowel // 'o' vowel // 'a'vowel // 'u'vowel // 'o'vowel // 'i'vowel // 'e'vowel // 'a'vowel // 'u'vowel // 'o'vowel // 'i'vowel // 'a'vowel // 'u'vowel // 'o'vowel // 'a'vowel // 'u'vowel // 'a' vowel // 'a'vowel // 'u'vowel // 'o'vowel // 'i'vowel // 'e' // 'a' is considered as zero, and the following operation should throws// cannotDivideByZerovowel // 'e' vowel // 'e'vowel // 'o'vowel // 'i'vowel // 'u' // TODO complete operations (multiplication and divison)
The number of elements must be prime, and elements are required to be unique. The following snippets will throw.
// numberOfElementsIsNotPrime // elementsAreNotUnique