power function for array