Add pow() function

Add `pow()` function. In addition, convert `squareRoot()` and `invert()` to use `safePow()` instead.

Refs #803.