Math.Arithmetic.Negative

From Fōrmulæ dictionary
Jump to: navigation, search

It is the tag for the expression representing the negative value of its unique subexpression.

Definition

It is the tag for the expression representing the arithemtic negative value of its unique subexpression.

Please note that the logic negation has a different tag, it is Logic.Negate.

Behavior

This expression should have exactly one subexpression.

Visualization

There could be several visualizations. The most common is showing the minus sign (-) before the expression, like

Edition

The most common edition is the creation of a new negative expression containing as its unique child the currently selected expression.

Reduction

There should be a few reducers associated with this expression, see below.

Known implementations

The Standard arithmetic package

Visualization

This package contains only one visualization that draws the minus sign (-) at at the left of its unique subexpression. The minus sign is aligned with the horizontal baseline of its unique subexpression. The resulting expression has the same vertical baselinea than the subexpression, like the following example:

Metricsnegative.png

If the visualization of it unique child belongs to the category Parentheses as operator, this visualization automatically shows its child between parentheses, in the following example, the child is an Math.Arithmetic.Addition which belongs to this category:

Negative8.png

This visualization belongs to the category Parentheses as super/subscripted. In the following example, the Math.Arithmetic.Exponentiation visualization shows in parentheses any child (base and/or exponent) if it belongs to that category (the negative expression):

Negative9.png

Edition

There are two editions in this package:

Edition 1. Creating a negative expression

This edition inconditinally creates a new Math.Arithmetic.Negative expression and attaches the currently selected expression as its unique child, it takes its place and it becames the new selected expression.

Edition 2. Changing the sign

If the currently selected expression or its parent expression is already a Math.Arithmetic.Negative expression, removes it, otherwise it works like the previous edition. It means that this edition works like an change sign, that commutes between negative and non-negative expression.

Examples

Example Edition performed Result
Negative1.png Negative11.png creating a negative Negative2.png
Negative1.png Negative10.png changing the sign Negative2.png
Negative2.png Negative11.png creating a negative Negative4.png
Negative2.png Negative10.png changing the sign Negative1.png
Negative3.png Negative10.png changing the sign Negative1.png

Reduction

Reducer 1. Negative of zero

In this case the negative expression is eliminated

Negative5.png reduces to Zero.png

Reducer 2. Negative of a negative expression

In this case both negative expression are cancelled:

Negative6.png reduces to X.png

Since the reduction engine tries until no reducer can be applied, the following works:

Negative7.png