0
$\begingroup$

I am trying to implement reflecting boundary conditions of

$ \begin{align} \psi_N \equiv \psi_{N-1}, \end{align} $

$ \begin{align} \psi_{-1} \equiv \psi_0, \end{align} $

to the hamiltonian matrix and then trying to find the 101 lowest energy eigen values. I am using a dimensionless schroedinger equation so $\hbar = 1$ and $m = \frac{1}{2}$ and also the potential $V = 0$. How can I implement the boundary conditions to the square matrix? Here is the matrix and eigenvalue and eigenvector calculation without boundary conditions:

H = (dx**-2)*diags([-1, 2, -1], [-1, 0, 1], shape=(N, N))
eigval, eigvec = eigsh(H, 101, which="SM")

If there is any ambiguity in my question please let me know so I can make it clearer

$\endgroup$

1 Answer 1

1
$\begingroup$

You probably consider the following system of equations $$ \frac1{dx^2}(2\psi_i - \psi_{i-1} - \psi_{i+1}) = E\psi_i,\quad \forall i = 0,\ldots, N-1, \quad (*) $$ where, by definition, $\psi_N \equiv \psi_{N-1}$ and $\psi_{-1} = \psi_0$. There is no need to especially implement boundary conditions. Substitution of $\psi_N$ and $\psi_{-1}$ into equations $(*)$ gives a matrix slightly different from the matrix in your code.

According to the condition $\psi_{-1} = \psi_0$, you just need to rewrite the first equation $$ \frac1{dx^2}(2\psi_0-\psi_{-1}-\psi_1) = E\psi_0 $$ in the following form $$ \frac1{dx^2}(\psi_0-\psi_1) = E\psi_0. $$ And you should rewrite the $N$-th equation in the same way.

$\endgroup$
5
  • $\begingroup$ You are correct, how will I have to modify the H matrix? I am aware the H[0,0] is psi_0 so where would psi_(-1) be in the H matrix ? I was told that I must somehow alter the first and last row of the H matrix in order to implement the reflecting boundary conditions $\endgroup$
    – Σ baryon
    Commented Oct 31, 2020 at 20:28
  • $\begingroup$ @Σbaryon See the updated answer. $\endgroup$
    – Gec
    Commented Oct 31, 2020 at 20:43
  • $\begingroup$ So I simply multiply the very first and very last terms in the H matrix by 0.5? $\endgroup$
    – Σ baryon
    Commented Oct 31, 2020 at 20:46
  • $\begingroup$ I hope you can write the right matrix for a system of linear equations. $\endgroup$
    – Gec
    Commented Oct 31, 2020 at 20:56
  • $\begingroup$ Haha it seems to work I just wanted to clarify :) $\endgroup$
    – Σ baryon
    Commented Oct 31, 2020 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.