I want to implement the upwind finite difference scheme for the 1D linear advection equation using a finite difference matrix in python:
$$ A =\begin{pmatrix} 1-a\cfrac{\Delta t}{\Delta x} & 0 & 0 & \cdots & a\cfrac{\Delta t}{\Delta x}\\ a\cfrac{\Delta t}{\Delta x} & 1-a\cfrac{\Delta t}{\Delta x} & 0 & \cdots & 0 \\ \vdots & \vdots& \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1-a\cfrac{\Delta t}{\Delta x} \end{pmatrix}$$
with $1 -a\cfrac{\Delta t}{\Delta x}$ on the diagonal and $a\cfrac{\Delta t}{\Delta x}$ on the lower subdiagonal and periodic boundary conditions as indicated by the top right entry of the matrix ($a$ being constant). To generate the velocities at the next time step $n$ I used the following equation:
$$\ U_{n+1} = AU_n $$
My idea is that given inital conditions $ U_1 $, I could apply $ A^{n+1} $ to $U_1$ to get the $U_{n+1}$:
$$\ U_{n+1} = A^{n+1} U_1 $$
I am not entirely sure if this is a valid approach as I am complete novice to the subject. Any help and hints would be greatly appreciated.