3
$\begingroup$
L = 2   
V[x_] = 
  Piecewise[{
    {Infinity, x <= -L}, 
    {0, -L < x < L},
    {Infinity, x >= L}
  }];

{vals, funs} = 
  NDEigensystem[
    {-Laplacian[u[x], {x}] + V[x]*u[x],
     DirichletCondition[u[x] == 0, True]},
    u[x], {x, -2, 2}, 10,
    Method -> {"SpatialDiscretization" -> {"FiniteElement", {"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}
  ]

Where have I made a mistake?

$\endgroup$

2 Answers 2

4
$\begingroup$

You don't need to specify the potential beyond the Dirichlet boundaries:

L = 2;

V[x_] = 0;  (*  will only be used in [-L,+L]  *)

{vals, funs} = 
  NDEigensystem[{-Laplacian[u[x], {x}] + V[x]*u[x], 
    DirichletCondition[u[x] == 0, True]},
    u[x], {x, -L, L}, 10, 
    Method -> {"SpatialDiscretization" -> {"FiniteElement", {"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}]

The eigenvalues are correct numerically:

vals - Table[(n*π/4)^2, {n, 10}]

(*    {4.27502*10^-12, 2.12463*10^-10, 2.37989*10^-9,
       1.33551*10^-8, 5.09357*10^-8, 1.5208*10^-7,
       3.83468*10^-7, 8.54395*10^-7, 1.732*10^-6,
       3.25887*10^-6}                                    *)
$\endgroup$
4
$\begingroup$

Do not use Infinity for a numerical value. Use e.g. 10^6:

L = 2
V[x_] = Piecewise[{{10^6, x <= -L}, {0, -L < x < L}, {\[Infinity], 
     x >= L}}];
{vals, funs} = 
 NDEigensystem[{-Laplacian[u[x], {x}] + V[x]*u[x], 
   DirichletCondition[u[x] == 0, True]}, u[x], {x, -2, 2}, 10, 
  Method -> {"SpatialDiscretization" -> {"FiniteElement", \
{"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}]

The first 6 eigenfunction look like:

Plot[Evaluate@funs[[;; 6]], {x, -2, 2}]

enter image description here

$\endgroup$

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.