Problems with the eigenvalues calculated using NDEigenvalue - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-21T20:26:45Z https://mathematica.stackexchange.com/feeds/question/197548 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/197548 1 Problems with the eigenvalues calculated using NDEigenvalue Mike https://mathematica.stackexchange.com/users/12329 2019-05-02T19:05:16Z 2019-05-05T00:11:17Z <p>I'm trying to solve a Sturm-Liouville problem like </p> <p><span class="math-container">$\qquad -\psi''(z)+(\frac{1}{z}+2\,z)\psi'(z)=\lambda\,\psi(z)$</span> </p> <p>using <code>NDEigensystem</code> in order to learn how to use this tool. The spectrum should be <code>{4, 8, 12, 16, 20, ...}</code>.</p> <p>I tried this code for the equation above:</p> <pre><code>{mass,states} = NDEigensystem[ {-psi''[z]+(1/z + 2 z)psi[z], DirichletCondition[psi[z] == 0, True]}, psi[z], {z, 0, 20}, 8, Method -&gt; {"SpatialDiscretization"-&gt;{"FiniteElement", "MeshOptions"-&gt;{"MaxCellMeasure"-&gt;0.0001}}}] </code></pre> <p>where <code>Eqn</code> is just the differential (Liouville) operator that I defined above. I also impose Dirichlet conditions for <span class="math-container">$\psi(z)$</span> at <span class="math-container">$z\to 0$</span>.</p> <p>But I getting some problems with this code. </p> <p>First, the eigenvalues change (a lot) when I change the interval. For example, with [0, 10] I get <code>{4, 8, 12, 16, 20.001, 27.3062-2.30156 I}</code>. When I change the interval to <code>[0, 20]</code>, I get <code>{4., 8., 12., 15.8473, 17.0221-1.78342I, 17.0221+1.78342I, 17.6018-4.75387I, 17.6018+4.75387I}</code>.</p> <p>Second, (as you can see above), the eigenvalues appear with non-zero imaginary part. This problem has real eigenvalues, so I don't understand what it is happening.</p> <p>I have read the information about <code>NDEigenvalues</code>, but I still do not understand why I'm getting these problems. So if anyone could give me some advice I would be thankful. </p>