Function pow

Calculates the power of x to y, x ^ y. Matrix exponentiation is supported for square matrices x, and positive integer exponents y.

For cubic roots of negative numbers, the function returns the principal root by default. In order to let the function return the real root, js can be configured with config({predictable: true}). To retrieve all cubic roots of a value, use cbrt(x, true).


pow(x, y)


Parameter Type Description
x number | BigNumber | Complex | Array | Matrix The base
y number | BigNumber | Complex The exponent


Type Description
number | BigNumber | Complex | Array | Matrix The value of x to the power y


pow(2, 3);               // returns number 8

var a = complex(2, 3);
pow(a, 2)                // returns Complex -5 + 12i

var b = [[1, 2], [4, 3]];
pow(b, 2);               // returns Array [[9, 8], [16, 17]]

See also

multiply, sqrt, cbrt, nthRoot