Infinite Potential Well 3D (Particle in a 3D-Box)

The three-dimensional infinite potential well (particle in a 3D-box) is one of the simplest models for a three-dimensional quantum mechanical system.

Definitions

Antique.InfinitePotentialWell3DType

Model

This model is described with the time-independent Schrödinger equation

\[ \hat{H} \psi(x,y,z) = E \psi(x,y,z),\]

and the Hamiltonian

\[ \hat{H} = - \frac{\hbar^2}{2m} \left(\frac{\partial^2}{\partial x ^2} + \frac{\partial^2}{\partial y ^2} + \frac{\partial^2}{\partial z ^2}\right) + V(x,y,z).\]

Parameters are specified with the following struct:

IPW3D = InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0)

$L$ is a vector of the lengths of the box in $x$,$y$,$z$-direction, $m$ is the mass of particle and $\hbar$ is the reduced Planck constant (Dirac's constant).

References

source

Potential

Antique.VMethod

V(model::InfinitePotentialWell3D, x...)

\[V(x,y,z) = \left\{ \begin{array}{ll} 0 & 0 \leq x \leq L_x \ \mathrm{and}\ 0 \leq y \leq L_y \ \mathrm{and}\ 0 \leq z \leq L_z \\ \infty & \mathrm{elsewhere} \end{array} \right.\]

source

Eigenvalues

Antique.EMethod

E(model::InfinitePotentialWell3D; n::Vector{Int64}=[1,1,1])

\[E_{n_x,n_y,n_z} = \frac{\hbar^2 n_x^2 \pi^2}{2 m L_x^2} + \frac{\hbar^2 n_y^2 \pi^2}{2 m L_y^2} + \frac{\hbar^2 n_z^2 \pi^2}{2 m L_z^2}\]

source

Eigenfunctions

Antique.ψMethod

ψ(model::InfinitePotentialWell3D, x...; n::Vector{Int64}=[1,1,1])

The wave functions can be expressed as products of wave functions in a one-dimensional box.

\[\begin{aligned} \psi_{n_x,n_y,n_z}(x,y,z) &= \psi_{n_x}(x) \times \psi_{n_y}(y) \times \psi_{n_z}(z) \\ &= \sqrt{\frac{2}{L_x}} \sin \frac{n_x \pi x}{L_x} \times \sqrt{\frac{2}{L_y}} \sin \frac{n_y \pi y}{L_y} \times \sqrt{\frac{2}{L_z}} \sin \frac{n_z \pi z}{L_z} \end{aligned}\]

source

Usage & Examples

Install Antique.jl for the first use and run using Antique before each use. The energy E(), wavefunction ψ() and potential V() will be exported. In this system, the model is generated by InfinitePotentialWell3D and several parameters Lx, Ly, Lz, m and are set as optional arguments.

using Antique
IPW3D = InfinitePotentialWell3D(L=[1.0,1.0,1.0], m=1.0, ℏ=1.0)

Parameters:

julia> IPW3D.L3-element Vector{Float64}:
 1.0
 1.0
 1.0
julia> IPW3D.m1.0
julia> IPW3D.ℏ1.0

Eigenvalues:

julia> E(IPW3D, n=[1,1,1])14.804406601634037
julia> E(IPW3D, n=[2,1,1])29.608813203268078
julia> E(IPW3D, n=[1,2,1])29.608813203268078
julia> E(IPW3D, n=[1,1,2])29.608813203268074
julia> E(IPW3D, n=[2,2,1])44.41321980490211
julia> E(IPW3D, n=[2,1,2])44.41321980490211
julia> E(IPW3D, n=[1,2,2])44.41321980490211
julia> E(IPW3D, n=[2,2,2])59.21762640653615

Wave functions:

using CairoMakie

# settings
f = Figure()
ax = Axis(f[1,1], xlabel=L"$x$", ylabel=L"$\psi(x,0.5,0.5)$")

# plot
w1 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[1,1,1]))
w2 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[2,1,1]))
w3 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[1,2,1]))
w4 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[3,1,1]))
w5 = lines!(ax, 0..1, x -> ψ(IPW3D, x,0.5,0.5, n=[4,1,1]))

# legend
axislegend(ax, [w1, w2, w3, w4, w5], [L"n=[1,1,1]", L"n=[2,1,1]", L"n=[1,2,1]", L"n=[3,1,1]", L"n=[4,1,1]"], position=:lb)

f
Example block output

Testing

Unit testing and Integration testing were done using numerical integration (QuadGK.jl). The test script is here.

Normalization & Orthogonality of $\psi_{n_x,n_y,n_z}(x,y,z)$

\[\int_{0}^{L_x}\int_{0}^{L_y}\int_{0}^{L_z} \psi_{i_x,i_y,i_z}^\ast(x,y,z) \psi_{j_x,j_y,j_z}(x,y,z) ~\mathrm{d}x \mathrm{d}y\mathrm{d}z = \delta_{i_x,j_x}\delta_{i_y,j_y}\delta_{i_z,j_z}\]

IPW3D = InfinitePotentialWell3D([1.0, 1.0, 1.0], 1.0, 1.0)
ix | iy | iz | jx | jy | jz |        analytical |         numerical 
-- | -- | -- | -- | -- | -- | ----------------- | ----------------- 
 1 |  1 |  1 |  1 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔

IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 1.0)
ix | iy | iz | jx | jy | jz |        analytical |         numerical 
-- | -- | -- | -- | -- | -- | ----------------- | ----------------- 
 1 |  1 |  1 |  1 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔

IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 2.0, 1.0)
ix | iy | iz | jx | jy | jz |        analytical |         numerical 
-- | -- | -- | -- | -- | -- | ----------------- | ----------------- 
 1 |  1 |  1 |  1 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔

IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 2.0)
ix | iy | iz | jx | jy | jz |        analytical |         numerical 
-- | -- | -- | -- | -- | -- | ----------------- | ----------------- 
 1 |  1 |  1 |  1 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  1 |  2 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  1 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 1 |  2 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  1 |  2 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  1 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  1 |  2 |  2 |  1 |  2 |    1.000000000000 |    1.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  1 |  2 |  2 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  1 |  1 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  1 |    1.000000000000 |    1.000000000000 ✔
 2 |  2 |  1 |  2 |  2 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  1 |  2 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  1 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  1 |  2 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  1 |  2 |    0.000000000000 |    0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  1 |    0.000000000000 |   -0.000000000000 ✔
 2 |  2 |  2 |  2 |  2 |  2 |    1.000000000000 |    1.000000000000 ✔

Eigenvalues

\[ \begin{aligned} E_n &= \int_0^L \psi^\ast_n(x) \hat{H} \psi_n(x) ~\mathrm{d}x \\ &= \int_0^L \psi^\ast_n(x) \left[ \hat{V} + \hat{T} \right] \psi(x) ~\mathrm{d}x \\ &= \int_0^L \psi^\ast_n(x) \left[ 0 - \frac{\hbar^2}{2m} \frac{\mathrm{d}^{2}}{\mathrm{d} x^{2}} \right] \psi(x) ~\mathrm{d}x \\ &\simeq \int_0^L \psi^\ast_n(x) \left[ -\frac{\hbar^2}{2m} \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^{2}} \right] ~\mathrm{d}x. \end{aligned}\]

Where, the difference formula for the 2nd-order derivative:

\[\begin{aligned} % 2\psi(x) % + \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} % + O\left(\Delta x^{4}\right) % &= % \psi(x+\Delta x) % + \psi(x-\Delta x) % \\ % \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} % &= % \psi(x+\Delta x) % - 2\psi(x) % + \psi(x-\Delta x) % - O\left(\Delta x^{4}\right) % \\ % \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} % &= % \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^{2}} % - \frac{O\left(\Delta x^{4}\right)}{\Delta x^{2}} % \\ \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} &= \frac{\psi(x+\Delta x) - 2\psi(x) + \psi(x-\Delta x)}{\Delta x^{2}} + O\left(\Delta x^{2}\right) \end{aligned}\]

are given by the sum of 2 Taylor series:

\[\begin{aligned} \psi(x+\Delta x) &= \psi(x) + \frac{\mathrm{d} \psi(x)}{\mathrm{d} x} \Delta x + \frac{1}{2!} \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} + \frac{1}{3!} \frac{\mathrm{d}^{3} \psi(x)}{\mathrm{d} x^{3}} \Delta x^{3} + O\left(\Delta x^{4}\right), \\ \psi(x-\Delta x) &= \psi(x) - \frac{\mathrm{d} \psi(x)}{\mathrm{d} x} \Delta x + \frac{1}{2!} \frac{\mathrm{d}^{2} \psi(x)}{\mathrm{d} x^{2}} \Delta x^{2} - \frac{1}{3!} \frac{\mathrm{d}^{3} \psi(x)}{\mathrm{d} x^{3}} \Delta x^{3} + O\left(\Delta x^{4}\right). \end{aligned}\]

IPW3D = InfinitePotentialWell3D([1.0, 1.0, 1.0], 1.0, 1.0)
 nx | ny | nz |        analytical |         numerical 
 -- | -- | -- | ----------------- | ----------------- 
  1 |  1 |  1 |   14.804406476266 |   14.804406601634 ✔
  1 |  1 |  2 |   29.608812468115 |   29.608813203268 ✔
  1 |  2 |  1 |   29.608812464319 |   29.608813203268 ✔
  1 |  2 |  2 |   44.413218454572 |   44.413219804902 ✔
  2 |  1 |  1 |   29.608812464319 |   29.608813203268 ✔
  2 |  1 |  2 |   44.413218454573 |   44.413219804902 ✔
  2 |  2 |  1 |   44.413218455735 |   44.413219804902 ✔
  2 |  2 |  2 |   59.217624443289 |   59.217626406536 ✔

IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 1.0)
 nx | ny | nz |        analytical |         numerical 
 -- | -- | -- | ----------------- | ----------------- 
  1 |  1 |  1 |    4.097525875573 |    4.097525911937 ✔
  1 |  1 |  2 |    4.828607653006 |    4.828607719425 ✔
  1 |  2 |  1 |    5.378183833979 |    5.378183922459 ✔
  1 |  2 |  2 |    6.109265611538 |    6.109265729947 ✔
  2 |  1 |  1 |   14.378363364341 |   14.378363829739 ✔
  2 |  1 |  2 |   15.109445141491 |   15.109445637227 ✔
  2 |  2 |  1 |   15.659021323388 |   15.659021840261 ✔
  2 |  2 |  2 |   16.390103100677 |   16.390103647749 ✔

IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 2.0, 1.0)
 nx | ny | nz |        analytical |         numerical 
 -- | -- | -- | ----------------- | ----------------- 
  1 |  1 |  1 |    2.048762937787 |    2.048762955969 ✔
  1 |  1 |  2 |    2.414303826503 |    2.414303859713 ✔
  1 |  2 |  1 |    2.689091916990 |    2.689091961230 ✔
  1 |  2 |  2 |    3.054632805769 |    3.054632864974 ✔
  2 |  1 |  1 |    7.189181682171 |    7.189181914869 ✔
  2 |  1 |  2 |    7.554722570746 |    7.554722818613 ✔
  2 |  2 |  1 |    7.829510661694 |    7.829510920130 ✔
  2 |  2 |  2 |    8.195051550338 |    8.195051823874 ✔

IPW3D = InfinitePotentialWell3D([1.2, 3.4, 4.5], 1.0, 2.0)
 nx | ny | nz |        analytical |         numerical 
 -- | -- | -- | ----------------- | ----------------- 
  1 |  1 |  1 |   16.390103502294 |   16.390103647749 ✔
  1 |  1 |  2 |   19.314430612024 |   19.314430877701 ✔
  1 |  2 |  1 |   21.512735335918 |   21.512735689837 ✔
  1 |  2 |  2 |   24.437062446150 |   24.437062919789 ✔
  2 |  1 |  1 |   57.513453457366 |   57.513455318954 ✔
  2 |  1 |  2 |   60.437780565964 |   60.437782548907 ✔
  2 |  2 |  1 |   62.636085293552 |   62.636087361042 ✔
  2 |  2 |  2 |   65.560412402708 |   65.560414590995 ✔