How can I use the Eigenvalues function to find the eigenvalues of a matrix?

Hello,

My question is regarding the Hamiltonian of the cooper pair box. The Hamiltonian looks like

H=E_C(n-n_g)^2\left|n\right\rangle\left\langle n \right|-\frac{E_J}{2}\left[\left|n\right\rangle\left\langle n+1\right|+\left|n+1\right\rangle\left\langle n \right|\right]

Which in matrix form looks like

\begin{pmatrix} E_C(0-n_g)^2 & -\frac{E_J}{2} & 0 & 0 & 0 & 0\\ -\frac{E_J}{2} & E_C(1-n_g)^2 & -\frac{E_J}{2} & 0 & 0 & 0\\ 0 & -\frac{E_J}{2} & E_C(2-n_g)^2 & -\frac{E_J}{2} & 0 & 0\\ 0 & 0 & -\frac{E_J}{2} & E_C(3-n_g)^2 & -\frac{E_J}{2} & 0\\ 0 & 0 & 0 & -\frac{E_J}{2} & E_C(4-n_g)^2 & -\frac{E_J}{2} \\ 0 & 0 & 0 & 0 & -\frac{E_J}{2} & E_C(5-n_g)^2 \end{pmatrix}

For states 0 to 5. I entered this matrix into mathematica like

matr = {{Ec*(0 - ng)^2, -Ej/2, 0, 0, 0, 0}, 
       {-Ej/2, Ec*(1 - ng)^2, -Ej/2, 0, 0, 0}, 
       {0, -Ej/2, Ec*(2 - ng)^2, -Ej/2, 0, 0}, 
       {0, 0, -Ej/2, Ec*(3 - ng)^2, -Ej/2, 0}, 
       {0, 0, 0, -Ej/2, Ec*(4 - ng)^2, -Ej/2}, 
       {0, 0, 0, 0, -Ej/2, Ec*(5 - ng)^2}}

Where Ec is E_C, Ej is E_J and ng is n_g. Then I used the Eigenvalues function with the following code

Eigenvalues[matr]

This produced a lot of lines of output which was fairly indecipherable. Is this the correct way to use this function to return the eigenvalues of this matrix?
I would be grateful for any help.

Mathematica is giving you the eigenvalues as the 6 roots of a 6-degree polynomial, which has no closed form solution. You can however define a function which when provided real values for Eg, Ej, and ng does return a numerical result. Note the use of N to get numbers.

In[1]:= matr = {{Ec*(0 - ng)^2, -Ej/2, 0, 0, 0, 0}, {-Ej/2, 
    Ec*(1 - ng)^2, -Ej/2, 0, 0, 0}, {0, -Ej/2, Ec*(2 - ng)^2, -Ej/2, 
    0, 0}, {0, 0, -Ej/2, Ec*(3 - ng)^2, -Ej/2, 0}, {0, 0, 0, -Ej/2, 
    Ec*(4 - ng)^2, -Ej/2}, {0, 0, 0, 0, -Ej/2, Ec*(5 - ng)^2}};

In[2]:= eigenvalues[Ec_, Ej_, ng_] = Eigenvalues[matr];

In[3]:= eigenvalues[2, 3, 6] // N

Out[3]= {1.63846, 8.13635, 18.0644, 32.0357, 50.023, 72.1021}

Thank you, this was a big help.