Definition

Notice that there is no subtraction expression. A subtraction is an addition operation where the sustraend is a negative expression, it is

Behavior

This expression must have at least two children.

Children names

The subexpressions should be named "Addend 1", "Addend 2", etc. First addend must be numbered as one, contrary to several programming languages, in which first element is numbered as zero.

Localization packages could be created in order to provide the names in languages other than English.

Visualization

There could be different visualizations, being the most popular the infix one, that us, using the (+) symbol between each consecutive pair of addends

Other form of visualization could exist, like the prefix form and rarely the postfix form.

Edition

There could be several editions. The most obvious is: Given a selected expression, it is replaced by a new addition expression with two children, the first one is the expressions that was selected, and the second one is a new Null expression. The latter becomes the new selected expression.

This visualization awares whether some of its children belong to the parentheses category Parentheses as operator. In such that case, these children are drawn between parentheses.

In the following example, the second addend is also an addition. Because this expression also belongs to the parentheses category Parentheses as operator (see below), the parent addition shows its children addition between parentheses.

This visualization belongs to the category Parentheses as operator. It means that if this visualization is a child of a parent visualization that awares of this, that such parent expression will show this child between parentheses.

In the following example, the Math.Arithmetic.Negative visualization awares of its unique child to belong of that category, to show it between parentheses:

This visualization belongs to the category Parentheses as super/subscripted. It means that if this visualization is a child of a parent visualization that awares of this, that such parent expression will show this child between parentheses.

In the following example, the Math.Arithmetic.Exponentiation visualization awares of either its base or exponent to belong of that category, to show either the base or the exponente between parentheses (in this case is the base):

Edition

There are several editions in this package, which are the combinations of a default edition with three variants:

Variation

Meaning

default (no variation)

Creates a new Math.Arithmetic.Addition Expression, the current selected expression becomes the first addend, a new Null expression is created and becomes the second addend.

Subtraction

A Math.Arithmetic.Negative expression containing a Null expression is created as the second addend, in order to resemble a subtraction. Remember that, according to the Arithmetic canon, subtraction does not exist, the expression is an addition with a negative addend, such like

Before

The new expression (usually a Null expression) will be created as the first addend, instead of the second one

Forced

Usually, if the current selected expression is already a Math.Arithmetic.Addition expression, or an addend of a Math.Arithmetic.Addition expression, a new addend is not created. With this option an addition is always created.

In the following examples, the selected expression is neither a Math.Arithmetic.Addition or an addend, so the "Forced" variant behaves as the default edition.

Example

Edition performed

Result

Addition

Addition (forced)

Addition (before)

Addition (forced, before)

Subtraction

Subtraction (forced)

Subtraction (before)

Subtraction (forced, before)

In the following examples, the selected expression is a Math.Arithmetic.Addition or an addend one, so the "Forced" variation applies:

Example

Edition performed

Result

Addition

Addition (before)

Addition (forced)

Addition (forced, before)

Subtraction

Subtraction (before)

Subtraction (forced)

Subtraction (forced, before)

Addition

Addition (before)

Addition (forced)

Addition (forced, before)

Subtraction

Subtraction (before)

Subtraction (forced)

Subtraction (forced, before)

Addition

Addition (before)

Addition (forced)

Addition (forced, before)

Subtraction

Subtraction (before)

Subtraction (forced)

Subtraction (forced, before)

Addition

Addition (before)

Addition (forced)

Addition (forced, before)

Subtraction

Subtraction (before)

Subtraction (forced)

Subtraction (forced, before)

Reduction

Addition of numeric addends

This reducer searches on the Math.Arithmetic.Addition children, for numeric expressions. If there are more than one, performs a numeric addition. According to Arithmetic canon, a numeric expression is either:

The following are examples. In these examples, expressions , and are supposed not to be numeric expressions.

Expression before reduction

Expression after reduction

Explanation

The same

It does not reduce, there are no numeric expressions as addends.

The same

It does not reduce, there are not two or more numeric expressions as addends.

According to Arithmetic canon, if any operand is a decimal number, the result must be either.

According to Arithmetic canon, if any operand is a decimal number, the result must be either.

If there is a reduction, and the numeric result of this reduction is zero, it will be removed of the Math.Arithmetic.Addition expression, unless it remains as the only expression.

The following are examples. Again, and are supposed not to be numeric expressions.

Expression before reduction

Expression after reduction

Explanation

Zero is removed.

Zero is not removed, it remains as the only child.

According to Arithmetic canon, if any operand is a decimal number, the result must be either.

Flatten nested additions

This reducer searches into the current Math.Arithmetic.Addition for children being also Math.Arithmetic.Addition expressions. For each one of them, it integrates their addends as addends of the current Math.Arithmetic.Addition expression.

For example, the following -three addends- addition:

reduces to the following -five addends- addition:

In the above example, and expressions are supposed not to be Math.Arithmetic.Addition expressions.

Flatten negative additions as negative addends

This reducer searches into the current Math.Arithmetic.Addition for children being a Math.Arithmetic.Negative expression containing a Math.Arithmetic.Addition expressions. For each one of them, it integrates their addends as negative addends -math.Arithmetic.Negative- of the current Math.Arithmetic.Addition expression.

For example, the following -three addends- addition:

reduces to the following -five addends- addition:

In the above example, and expressions are supposed not to be Math.Arithmetic.Addition expressions.

This package does not contain visualizers nor editors for the Math.Arithmetic.Addition expression.

Reduction

Matrix addition

This reducer searches for Structure.List addends. These lists must also contain identical number of Structure.List expressions also containing identical number of sub-lists. Then they are matrices of same dimension. If there are two or more such matrices, a matrix addition is performed

The following are examples. In these examples, expressions , and are supposed not to be matrices, according to the definition already given.

Expression before reduction

Expression after reduction

Explanation

The same

It does not reduce, there are no matrix expressions as addends.

The same

It does not reduce, there are not two or more matrix expressions as addends.