^
Syntax
Syntax
base^exponent
Operands
- base
- The number to be raised to exponent.
- exponent
- The power to which base is to be raised.
Example
Expression | Result |
---|---|
2 ^ 3
|
8 |
4 ^ {-1, 0, 1}
|
{0.25, 1, 4}
|
{1, 4, 9} ^ (1 / 2)
|
{1, 2, 3}
|
4 ^ { {1, 2}, {3, 4} }
|
{ {4, 16},{64, 256} }
|
{ {1, 2}, {3, 4} } ^ 3
|
{ {1, 8},{27, 64} }
|
Comments
The exponential operator raises base to the power of exponent.
If base and exponent are both scalars, the result is a scalar equal to base raised to the power of exponent. If base is negative, the absolute value of exponent must be greater than or equal to one.
If base is a scalar and exponent is a vector, base is raised to the power of each element in exponent. The result is a vector containing the same number of elements as the original vector. If base is negative, each element of exponent must have an absolute value greater than or equal to one.
If base is a vector and exponent is a scalar, each element in base is raised to the power of exponent. The result is a vector containing the same number of elements as the base argument. If any element of base is negative, the value of exponent must have an absolute value greater than or equal to one.
If base is a scalar and exponent is a matrix, base is raised to the power of each element in exponent. The result is a matrix containing the same dimensions as the original matrix. If base is negative, each element of exponent must have an absolute value greater than or equal to one.
If base is a matrix and exponent is a scalar, each element in base is raised to the power of exponent. The result is a matrix containing the same dimensions as the base argument. If any element of base is negative, the value of exponent must have an absolute value greater than or equal to one.
If base and exponent are both vectors, the result is a vector containing the values of the elements in base raised to the power of the corresponding element in exponent. Both vectors must have the same number of elements. They must also both be row vectors or both be column vectors. In either case, the result is a vector with the same number of elements as the two vectors.
If base and exponent are both matrices, the result is a matrix containing the values of the elements in base raised to the power of the corresponding elements in exponent. Both matrices must have the same number of rows and columns. The result is a matrix with the same dimensions as the two matrices.
For any case where the base is zero, the resultant element is zero. For any case where the exponent is zero, the resultant element is one, except for 0^0, which is defined to be zero in HyperMesh, MotionView, and Templex.