Skip to main content
added 38 characters in body
Source Link
Roman
  • 49.8k
  • 2
  • 57
  • 131

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}                                    *)

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

L = 2;

V[x_] = 0;

{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}                                    *)

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}                                    *)
Source Link
Roman
  • 49.8k
  • 2
  • 57
  • 131

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

L = 2;

V[x_] = 0;

{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}                                    *)