Math.Arithmetic.Exponentiation

Math.Arithmetic.Exponentiation is the tag for the expression representing arithmetic exponentiation.

Definition

Math.Arithmetic.Exponentiation is the tag for the expression representing arithmetic exponentiation.

Behavior

This expression has exactly two children.

Children names

The first child should be named "Base" and the second child "Exponent".

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

Visualization

There can be different forms of visualization, the following are examples:

Visualization Notes The most common Knuth's notation ^   As a function

Edition

There could be several editions. The most obvious is: Given a selected expression, it is replaced by a new exponentiation 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.

Reduction

There could be several reductions, see below.

Known implementations

The Standard Arithmetic Package

Visualization

There is one visualization on this package.

This visualization corresponds with the notation.

It tries to align the top of the base with the horizontal baseline of the exponent, like the following figure:

Sometimes it would make that the bottom of the exponent led under the bottom of the base. In such a case, the horizontal baseline of the base is aligned with the bottom of the exponent, like the following figure:

Notice that in both cases, the horizontal and vertical baselines of the entire exponentiation are aligned with the horizontal and vertical baselines of the base. The preservation of the baselines of base gives a more natural visualization when an exponentiation is part of infix opperations, such as addition, like the following:

Parentheses awareness

Parentheses in the base expression

This visualization awares if the base expression belongs to the parentheses category Parentheses as operator, category Parentheses as Super or Subscripted, or it is also a Math.Arithmetic.Exponentiation expression. In such that case, it is drawn between parentheses. See the following examples:

Base expression Base is shown between parenthesis because Example
Addition It belongs to the category Parentheses as operator
It also belongs to the category Parentheses as Super or Subscripted Multiplication It belongs to the category Parentheses as Super or Subscripted Negative It belongs to the category Parentheses as Super or Subscripted Exponentiation It is also a Math.Arithmetic.Exponentiation Parentheses in the exponent expression

This visualization awares if the exponent expression is also an Math.Arithmetic.Exponentiation expression. In such a case, it is drawn between parentheses, like the following example:

Edition

There are two editions in this package. The first one creates an exponentiation expression being the currently selected expression the base and creates a Null expression as the exponent. The second one is the opposite, it creates an exponentiation being the currently selected expression the exponent and creating a Null expression as the base.

This is shown in the following examples:

Reduction

There are 5 reducers in this package.

Reducer 1. Exponentiation of special cases

This reducer awares of the special cases x0, x1, 0x and 1x as follows:

Expression Is reduced to            Reducer 2. Exponentiation of multiplication/division

For this reducer:

• is an integer number

This reducer makes the following transformation

Expression Is reduced to    Reducer 3. Numeric expression to a negative integer exponent

For this reducer:

• is a canonical numeric expression
• is a positive integer number

This reducer makes the following transformation

Expression Is reduced to  Reducer 4. Numeric negative expression to a positive integer exponent

For this reducer:

• is a canonical numeric expression
• is a positive integer number

This reducer makes the following transformation

Expression Is reduced to  Reducer 5. Numeric exponentiation

This reducer calculates the exponentiation when both its base and the exponent are canonical integer or decimal numbers, either positive or negative

Step 1. Conversion from symbolic expressions to numeric ones (if it is necessary).

According to Arithmetic canon, if either the base or exponent is a decimal number, the exponentiation should be performed numerically (not symbolically), so in such a case, the decimal representation of the other element is obtained (when it is possible), in order to perform the actual exponentiation. It is intended by the call of the Math.Arithmetic.Numeric expression.

See the following examples

Expression Is converted to Is reduced to Notes
12.5½ 12.5N(½) 12.50.5
π2.0 N(π)2.0 3.1415926542.0 The number of digits depends on the defined precision at the time of the call
"Hello"3.25 N("Hello")3.25 "Hello"3.25 Expression was not changed

If expression was not changed (like in the last example) the exponentiation is not performed.

Step 2. Performing the actual exponentiation

According to the Arithmetic canon, if both the base and exponent are integer numbers, the calculation will be intended to be exact.

This reducer is able to calculate results that require complex numbers.

Several forms are not supported, because they are reduced from previous reducers to supported forms, see the following examples:

Unsupported form Is converted to By reducer Example  Numeric expression to a negative integer exponent is reduced to , and then is reduced to by this reducer, resulting in   Exponentiation of multiplication/division is reduced to . This reducer reduces as and as , resulting in   or (depending on parity of )
Numeric negative expression to a positive integer exponent is reduced to , and then is reduced to by this reducer, resulting in There are cases that require several steps, such as the following example:

Expression By reducer Initial expression Numeric expression to a negative integer exponent Numeric negative expression to a even positive integer exponent Exponentiation of multiplication/division Numeric exponentiation Reciprocal of fraction

Test cases for numeric exponentiation

In order to show the capacities of these exponentiation reducers with various combinations of values for bases and exponents, the following ones were chosen:

Value Description
- 2/3 A negative rational number
-5 A negative integer number
-6.25 A negative decimal number
0 Integer zero
0.0 Decimal zero
1 Integer one
1.0 Decimal one
3.5 A positive decimal number
3 A positive integer number
2/3 A positive rational number
x A unbound symbol

These 11 values produce 112 = 121 combinations for base/exponent, shown below:

The table shows the value for the base, the value for the exponent, the result of the exponentiation (baseexponent) and the numeric expression for the exponentiation N(baseexponent)