^ (circumflex)
The exponentiation operator.
Syntax
-
a^b-
ais a number or a matrix -
bis a number
-
Description
Real numbers
If a is a real (or complex) number and n a positive integer, a^n is equal to the product of n factors each equal to a. This also applies for n = 0 unless a = 0 as well; 0^0 is undefined and will generate an error (“zero raised to the power of zero”).
If n is a negative integer, a^n is defined as 1/a^−n unless a = 0 which is again undefined and will generate a program error (“division by zero”).
If a is a non-negative real number and q a positive integer, a^(1/q) is defined as the unique non-negative real number ξ such that ξ^q = a.
Finally, if a is a non-negative real number, p is an integer and q a positive integer, a^(p/q) is defined as [a^(1/q)]^p, subject to the above restrictions if a = 0.
This defines a^b completely for floating-point numbers.
For a > 0, a^b equals exp(b⋅ln(a)).
Complex numbers
If a and b are complex numbers with a ≠ 0, then a^b is defined as exp(b⋅ln(a)). Notice that this also defines a^b for a and b real, a < 0, and b non-integral.
If a = 0 and Re(b) > 0, then a^b = 0.
Matrices
If A is a square matrix and n a non-negative integer, then A^n is the product of n factors all equal to A, the empty product being the identity matrix the size of A. This also applies if A is the zero matrix.
If n is a negative integer, then A^n = inv(A)^n = inv(A^n) assuming A is non-singular. If A is singular, A^n is undefined and generates an error.
A^b is not defined for non-integral b. However, if A is a positive semidefinite matrix, its unique positive semidefinite square root can be computed as √A or sqrt(A). Computing A^(1/2) is not supported.
Notes
The ^ operator is implemented by the power function.
Examples
∑((−1)^n/n!, n, 0, 100)
0.367879441171 (=e⁻¹)
π^i
0.413292116102 + 0.910598499213⋅i
A ≔ ❨❨3, i❩, ❨−i, 2❩❩
⎛ 3 i⎞ ⎝−i 2⎠
A^5
⎛ 450 275⋅i⎞ ⎝−275⋅i 175⎠
A^−2
⎛ 0.2 −0.2⋅i⎞ ⎝ 0.2⋅i 0.4⎠