We assume that the numpy module of Python has been imported using the instruction \texttt{import numpy as np}. This thus gives access to the following functions:
\texttt{np.identity( n )} creates $I _ { n }$, the identity matrix of order n;
\texttt{A.shape} gives, in the form of a tuple, the size of array A, for example \texttt{np.identity(5).shape} $\rightarrow ( 5,5 )$;
\texttt{np.dot(A, B)} computes the matrix product of A and B if A and B are two-dimensional arrays compatible with matrix multiplication.
The naive algorithm for computing $B ^ { k }$ is based on its definition, namely: $$\left\{ \begin{array} { l } B ^ { 0 } = I _ { n } \\ B ^ { k } = B B ^ { k - 1 } \quad \forall k \geqslant 1 \end{array} \right.$$ Write a Python function \texttt{puissance1(B, k)} that takes as arguments a square matrix $B$ and a natural number k and returns the matrix $B ^ { k }$ computed using the naive algorithm.
We assume that the numpy module of Python has been imported using the instruction \texttt{import numpy as np}. This thus gives access to the following functions:
\begin{itemize}
\item \texttt{np.identity( n )} creates $I _ { n }$, the identity matrix of order n;
\item \texttt{A.shape} gives, in the form of a tuple, the size of array A, for example \texttt{np.identity(5).shape} $\rightarrow ( 5,5 )$;
\item \texttt{np.dot(A, B)} computes the matrix product of A and B if A and B are two-dimensional arrays compatible with matrix multiplication.
\end{itemize}
The naive algorithm for computing $B ^ { k }$ is based on its definition, namely:
$$\left\{ \begin{array} { l } B ^ { 0 } = I _ { n } \\ B ^ { k } = B B ^ { k - 1 } \quad \forall k \geqslant 1 \end{array} \right.$$
Write a Python function \texttt{puissance1(B, k)} that takes as arguments a square matrix $B$ and a natural number k and returns the matrix $B ^ { k }$ computed using the naive algorithm.