## Ising Model

The Ising model is a physical model of a magnetic system consisting of a discrete $1D$ lattice of interacting spins that can be used to study ferromagnetism. In this model, there are $N$ quantum particles with spin $1/2$, where each spin can be oriented "upward" or "downward," represented by the values $+1$ and $-1$.

It has been used to study phase transitions in magnetic systems, where the system goes from an ordered state at low temperature to a disordered state at high temperature. Ising's model has also been used to describe a wide range of phenomena, including order in biological systems, protein aggregation, neural network formation, and even game theory. The energy of the system depends on the spin interactions and the energies of each particle, such that the Hamiltonian is:
$$
\widehat{H} = \lambda \sum_{j=1}^N \sigma^{(j)}_z + \sum_{j=1}^{N-1} \sigma^{(j)}_x \sigma^{(j+1)}_x,
$$
where $\sigma_x$ and $\sigma_z$ are two of the three Pauli matrices given by:
$$ \sigma_x = \begin{pmatrix}
0 & 1 \\
1 & 0
\end{pmatrix} \, \, \, \, \, \sigma_z = \begin{pmatrix}
1 & 0 \\
0 & -1
\end{pmatrix} $$
The eigenvalues of the Ising model are distributed differently depending on the value of the parameter $\lambda$ representing the strength of the interaction between the spins.

In particular, for values of $\lambda$ close to 0, the eigenvalues become degenerate, that is, they cluster into a limited number of values, while for values of $\lambda$ greater than 0, the eigenvalues begin to distinguish themselves.

The energy of the system is given by the sum of the interaction energies between the spins. Specifically, each pair of neighboring spins contributes to the total energy of the system according to their interaction, which can be ferromagnetic or antiferromagnetic. In the former case, the spins tend to align parallel, while in the latter case they tend to align antiparallel.

Ising's model can be solved numerically using the Hamiltonian. The solution of the Hamiltonian makes it possible to calculate properties of the system, such as magnetization and free energy. Given such a Hamiltonian operator, the $j$-th particle contributes to that operator as:

**function. The code also includes a progress bar to monitor the progress of the calculation and an estimate of the expected time.**

*'numpy.linalg.eigh'*The

**class defines a square matrix initialized to $0$ of dimension**

*'Matrix'***.**

*'dim'*The

**function creates two Pauli matrices,**

*'pauli'***and**

*'sigma_x'***, of size $2\times 2$.**

*'sigma_z'*The

**function creates the z part of the Hamiltonian for the Ising model. The z Hamiltonian is a matrix of dimension $2^N \times 2^N$. The Pauli $z$**

*'z_hamiltonian'***matrix is used to create the $z$ Hamiltonian.**

*sigma_z*The

**function creates the x part of the Hamiltonian repredented by a matrix of dimension $2^N \times 2N$. The Pauli $x$**

*'x_hamiltonian'***matrix is used to create the Hamiltonian $x$.**

*sigma_x*The

**function calculates the expected execution time to complete a certain number of iterations based on the average time of previous iterations.**

*'expected_time'*The

**function prints a progress bar with an estimate of the time remaining to complete the execution of the algorithm.**

*'progress_bar'*The Ising model is a physical model of a magnetic system consisting of a discrete $1D$ lattice of interacting spins that can be used to study ferromagnetism. In this model, there are $N$ quantum particles with spin $1/2$, where each spin can be oriented "upward" or "downward," represented by the values $+1$ and $-1$.

It has been used to study phase transitions in magnetic systems, where the system goes from an ordered state at low temperature to a disordered state at high temperature. Ising's model has also been used to describe a wide range of phenomena, including order in biological systems, protein aggregation, neural network formation, and even game theory. The energy of the system depends on the spin interactions and the energies of each particle, such that the Hamiltonian is:
$$
\widehat{H} = \lambda \sum_{j=1}^N \sigma^{(j)}_z + \sum_{j=1}^{N-1} \sigma^{(j)}_x \sigma^{(j+1)}_x,
$$
where $\sigma_x$ and $\sigma_z$ are two of the three Pauli matrices given by:
$$ \sigma_x = \begin{pmatrix}
0 & 1 \\
1 & 0
\end{pmatrix} \, \, \, \, \, \sigma_z = \begin{pmatrix}
1 & 0 \\
0 & -1
\end{pmatrix} $$
The eigenvalues of the Ising model are distributed differently depending on the value of the parameter $\lambda$ representing the strength of the interaction between the spins.

In particular, for values of $\lambda$ close to 0, the eigenvalues become degenerate, that is, they cluster into a limited number of values, while for values of $\lambda$ greater than 0, the eigenvalues begin to distinguish themselves.

The energy of the system is given by the sum of the interaction energies between the spins. Specifically, each pair of neighboring spins contributes to the total energy of the system according to their interaction, which can be ferromagnetic or antiferromagnetic. In the former case, the spins tend to align parallel, while in the latter case they tend to align antiparallel.

Ising's model can be solved numerically using the Hamiltonian. The solution of the Hamiltonian makes it possible to calculate properties of the system, such as magnetization and free energy. Given such a Hamiltonian operator, the $j$-th particle contributes to that operator as:

**function. The code also includes a progress bar to monitor the progress of the calculation and an estimate of the expected time.**

*'numpy.linalg.eigh'*The

**class defines a square matrix initialized to $0$ of dimension**

*'Matrix'***.**

*'dim'*The

**function creates two Pauli matrices,**

*'pauli'***and**

*'sigma_x'***, of size $2\times 2$.**

*'sigma_z'*The

**function creates the z part of the Hamiltonian for the Ising model. The z Hamiltonian is a matrix of dimension $2^N \times 2^N$. The Pauli $z$**

*'z_hamiltonian'***matrix is used to create the $z$ Hamiltonian.**

*sigma_z*The

**function creates the x part of the Hamiltonian repredented by a matrix of dimension $2^N \times 2N$. The Pauli $x$**

*'x_hamiltonian'***matrix is used to create the Hamiltonian $x$.**

*sigma_x*The

**function calculates the expected execution time to complete a certain number of iterations based on the average time of previous iterations.**

*'expected_time'*The

**function prints a progress bar with an estimate of the time remaining to complete the execution of the algorithm.**

*'progress_bar'*