# algebra-group

defines an algebra group structure

With npm do

## Examples

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

You get a group object with zero as identity and the following group operators:

• contains
• notContains
• equality
• disequality
• subtraction
• negation

### `R\{0}` multiplicative group

Consider `R\{0}`, the set of Real numbers minus 0, with multiplication as composition law.

It is necessary to remove 0, otherwise there is an element which inverse does not belong to the group, which breaks group laws.

It makes sense to customize group props, which defaults to additive group naming.

You get a group object with one as identity and the following group operators:

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

### `R+` multiplicative group

Create the multiplicative group of positive real numbers `(0,∞)`.

It is a well defined group, since

• it has an indentity
• it is close respect to its composition law
• for every element, its inverse belongs to the set

Let's customize group props, with a shorter naming.

You get a group object with one identity and the following group operators:

• contains
• notContains
• eq
• ne
• mul
• div
• inv

## API

### `group(identity, operator)`

• @param `{Object}` given identity and operators
• @param `{*}` given.identity a.k.a. neutral element
• @param `{Function}` given.contains
• @param `{Function}` given.equality
• @param `{Function}` given.compositionLaw
• @param `{Function}` given.inversion
• @param `{Object}` [naming]
• @param `{String}` [naming.identity=zero]
• @param `{String}` [naming.contains=contains]
• @param `{String}` [naming.equality=equality]
• @param `{String}` [naming.compositionLaw=addition]
• @param `{String}` [naming.inversion=negation]
• @param `{String}` [naming.inverseCompositionLaw=subtraction]
• @param `{String}` [naming.notContains=notContains]
• @returns `{Object}` groups

### `group.error`

An object exposing the following error messages:

For example, the following snippets will throw.