# algebra-ring

0.6.4 • Public • Published

# algebra-ring

defines an algebra ring structure

With npm do

## Example

All code in the examples below is intended to be contained into a single file.

### Real

Create a ring structure over real numbers.

You get a Ring that is a Group with multiplication operator. The multiplication operator must be closed respect the underlying set; its inverse operator is division.

This is the list of ring operators:

• contains
• notContains
• equality
• disequality
• subtraction
• negation
• multiplication
• division
• inversion

The neutral element for addition and multiplication are, as usual, called zero and one respectively.

### Boolean

It is possible to create a ring over the booleans.

There are only two elements, you know, true and false.

Check that false is the neutral element of addition and true is the neutral element of multiplication.

As usual, it is not allowed to divide by zero: the following code will throw.

## API

### ring(identities, operator)

• @param {Array} identities
• @param {*} identities[0] a.k.a zero
• @param {*} identities1 a.k.a one
• @param {Object} operator
• @param {Function} operator.contains
• @param {Function} operator.equality
• @param {Function} operator.negation
• @param {Function} operator.multiplication
• @param {Function} operator.inversion
• @returns {Object} ring

### ring.error

An object exposing the following error messages:

• cannotDivideByZero
• doesNotContainIdentity
• identityIsNotNeutral

MIT

## Package Sidebar

### Install

npm i algebra-ring

### Repository

github.com/fibo/algebra-ring

### Homepage

g14n.info/algebra-ring

3

0.6.4

MIT

11 kB

7