1 The Schrodinger equation is
\begin{equation}
-\frac12 \frac{\partial^{2}{\psi}}{\partial{x}^{2}} + V\psi = \mathrm{i} \frac{\partial \psi}{\partial t}
\end{equation}
It is the same thing to use Crank-Nicolson or Caley scheme
2 The result is
\begin{equation}
\left(1+\frac{ \mathrm{i} }{2} \boldsymbol{\mathbf{H}} \Delta t \right) \psi^{n+1} = \left(1-\frac{ \mathrm{i} }{2} \boldsymbol{\mathbf{H}} \Delta t \right) \psi^n
\end{equation}
Among them, the second derivative is calculated by three-point difference, and then
\begin{equation}
\begin{aligned}
\psi_i^{n+1} - \psi_i^n &= \frac{ \mathrm{i} \Delta t}{4\Delta x^2} (\psi_{i-1}^n - 2\psi_i^n + \psi_{i+1}^n + \psi_{i-1}^{n+1} - 2\psi_i^{n+1} + \psi_{i+1}^{n+1})\\
&\qquad\qquad - \frac{ \mathrm{i} \Delta t}{2}(V_i^n\psi_i^n + V_i^{n+1}\psi_i^{n+1})
\end{aligned} \end{equation}
Order $\alpha = \mathrm{i} \Delta t/(4\Delta x^2), \beta = \mathrm{i} \Delta t/2$, can be sorted
\begin{equation}
\begin{aligned}
&\quad -\alpha\psi_{i-1}^{n+1} + (1+2\alpha + \beta V_i^{n+1})\psi_i^{n+1} - \alpha \psi_{i+1}^{n+1}\\
&= \alpha\psi_{i-1}^n + (1 - 2\alpha - \beta V_i^n)\psi_i^n + \alpha \psi_{i+1}^n
\end{aligned} \end{equation}
Among them, $\psi_i^n = \psi(x_i, t_n)$ and $V_i^n = V(x_i, t_n)$.
We divide an interval into intervals with equal lengths of $N_x - 1$, and make $N_x$ grid points as $x_1\dots x_{N_x}$. The simplest boundary condition is to take $\psi(x_1) = \psi(x_{N_x}) = 0$. In this way, the $i$ in eq. 4 can be taken from $i = 2\dots N_x - 1$ to get $N_x - 2$ formulas, of which there are only $\psi_2^{n+1}\dots \psi_{N_x-1}^{n+1}$ and the $N_x - 2$ unknown quantities, and each formula contains at most 3 consecutive unknown quantities. If the linear equation is expressed as a matrix, a tridiagonal matrix can be obtained (the first row and the last row have only two coefficients).
But in fact, you can continue to reduce the amount of calculation. After finishing eq. 2
\begin{equation}
\left(\frac12 + \frac{ \mathrm{i} }{4} \boldsymbol{\mathbf{H}} \Delta t \right) \left(\psi^{n+1}+\psi^n \right) = \psi^n
\end{equation}
To solve this equation, subtract $\psi^n$.
Virtual Time
After using the virtual time, eq. 2 and eq. 5 become
\begin{equation}
\left(1+\frac12 \boldsymbol{\mathbf{H}} \Delta t \right) \psi^{n+1} = \left(1-\frac12 \boldsymbol{\mathbf{H}} \Delta t \right) \psi^n
\end{equation}
\begin{equation}
\left(\frac12 + \frac14 \boldsymbol{\mathbf{H}} \Delta t \right) \left(\psi^{n+1}+\psi^n \right) = \psi^n
\end{equation}
(The code is not completed)
1. ^ Reference [26] .
2. ^ , see [26] section 19.2.