matrix_power function

Computes A^n