# Eigenproblems

#### Find an eigenfunction for the finite square well eigenproblem , , , where is a square well potential of height 5.

 In:= XW[x_] := If[Abs[x] < 1, 0, 5]; Plot[W[x], {x, -5, 5}, Filling -> {1 -> 0}, PlotLabel -> W, ImageSize -> Medium]
 Out= #### Start by plotting solutions of for .

 In:= Xpfun = ParametricNDSolveValue[{-y''[x] + W[x] y[x] == \[Lambda] y[x], y == 1, y' == 0}, y, {x, -50, 50}, {\[Lambda]}]; Plot[Evaluate@Table[pfun[\[Lambda]][x], {\[Lambda], 0, 5, 1}], {x, -2, 2}, ImageSize -> Medium]
 Out= #### The true eigenfunctions satisfy . These can be approximated by finding functions with . Because the equation is symmetric in , only solutions with need to be found. Plot for .

 In:= XPlot[pfun[\[Lambda]], {\[Lambda], 0, 13}, ImageSize -> Medium]
 Out= #### The root is the approximate eigenvalue.

 In:= Xval = Map[FindRoot[pfun[\[Lambda]], {\[Lambda], #}] &, {-2}]
 Out= #### Plot the approximate eigenfunction together with solutions for nearby .

 In:= XShow[Plot[ Evaluate@Table[pfun[\[Lambda]][x], {\[Lambda], 1, 3, .1}], {x, -6, 6}, PlotRange -> {-1, 1}, PlotStyle -> Lighter[Gray, .5]], Plot[Evaluate[pfun[\[Lambda]][x] /. val], {x, -6, 6}, PlotStyle -> Thick], ImageSize -> Medium]
 Out= 