Contents Previous Next Subchapters

Element-By-Element Exponentiation
Syntax base ^ exponent
See Also multiplication , division

Description
Element-by-element exponentiation of base to exponent, where base and exponent are integer, real, double-precision, or complex. (One, but not both, of the values may be logical.)

Tutorial

Scalar Exponentiation
If you enter
     6^2
O-Matrix will respond
     36

Exponentiation by a Matrices
If you enter
     x = {[1, 2, 3], [4, 5, 6]}
     y = {[2, 2, 2], [2, 2, 2]}
     x^y
O-Matrix will print
     {
     [ 1 , 4 , 9 ]
     [ 16 , 25 , 36 ]
     }

Exponentiation by a Scalar
If you enter
     x = {[1, 2, 3], [4, 5, 6]}
     x^2
O-Matrix will respond
     {
     [ 1 , 4 , 9 ]
     [ 16 , 25 , 36 ]
     }

Exponentiation of a Scalar
If you enter
     x = {[1, 2, 3], [4, 5, 6]}
     2^x
O-Matrix will respond
     {
     [ 2 , 4 , 8 ]
     [ 16 , 32 , 64]
     }

Reference
If the value types do not agree, O-Matrix will coerce the values as detailed in the coercion table.

Exponentiation to a fractional power can be ambiguous. For example, both i and -i are square roots of -1. O-Matrix uses a polar representation of the base when performing complex exponentiation.

Suppose that z is a complex base and w is a real exponent. O-Matrix expresses z as
            i theta
     z = r e

where r is real and -pi < theta < pi. The result is defined by
      w    w  i theta w
     z  = r  e