1
$\begingroup$

I used NDEigensystem for finding eigenvalues and eigenfunctions of specified dif. operator. If I set R=1 everything is good and I get right results, but when I set R=10 and more I get complex eigenvalues with tiny Im parts (which are errors as I suppose) and right Re parts(which seem to be the true eigenvalues), but I can't plot eigenfunctions. If they are complex how can I get some real result from them (real part)?

ClearAll["Global`*"]
R = 10; m = 1/2;
U1 = 1/R^2*z/(z + r)*
    Hypergeometric2F1[1/2, 1/2, 1, (4*z*r)/(z + r)^2] /. 
   z -> \[Xi] r // Simplify[#, r > 0] &
V1[r_?NumericQ] := -2 r NIntegrate[U1, {\[Xi], 0, R/r}, 
    Method -> "LocalAdaptive", 
    AccuracyGoal -> 10] + ((m - 1/2)*(m + 1/2))/r^2
H = -(1/2) P''[r] + V1[r]*P[r] + P[r]
{vals, funs} = 
 NDEigensystem[{H, DirichletCondition[P[r] == 0, True]}, 
  P[r], {r, 0, 200}, 5, 
  Method -> {"SpatialDiscretization" -> {"FiniteElement", \
{"MeshOptions" -> {"MaxCellMeasure" -> 0.1}}}} ]
vals - 1
Plot[Evaluate[funs], {r, 0, 120}]

Eigenvalues:

{-0.147842 + 5.56982*10^-11 I, -0.0735129 + 
  3.43556*10^-11 I, -0.0387015 + 1.35624*10^-11 I, -0.0236214 + 
  5.65771*10^-12 I, -0.0159122 + 2.85885*10^-12 I}

Also I got this message, maybe I should change some Method settings of NDEigensystems? What do you suggest to get real eigenfunctions?

Eigensystem::maxit2: Warning: the maximum number of iterations, 1000, has been reached by the Arnoldi algorithm without convergence to the specified tolerance, but the current best computed value has been returned. You can use method options with Method -> {Arnoldi, opts} to increase the size of basis vectors, the maximum number of iterations, reduce the tolerance or use an estimate as a shift, any of which may help.
Eigensystem::chnpdef: Warning: there is a possibility that the second matrix SparseArray[Specified elements: 19991
Dimensions: {4999,4999}

] in the first argument is not positive definite, which is necessary for the Arnoldi method to give accurate results.
```
$\endgroup$
4
  • 3
    $\begingroup$ ReImPlot[Evaluate[funs], {r, 0, 120}] $\endgroup$ Commented Sep 14 at 11:46
  • $\begingroup$ Chop[] can be used to remove the very small imaginary components. And Chop is listable. $\endgroup$ Commented Sep 14 at 17:39
  • $\begingroup$ If you delete "AccuracyGoal -> 10" you get a plot, although with some warnings. $\endgroup$ Commented Sep 15 at 8:07
  • $\begingroup$ @cvgmt ReImPlot gives me both real and imaginary parts at the same graph but I can't find how to display only real parts. $\endgroup$ Commented Sep 15 at 19:46

1 Answer 1

0
$\begingroup$
  • We could use Re to get the real parts of the plot.
  • The ReImPlot just display the Re parts and the Im parts in the same plot, we could compare with the four plots.
replot = Plot[funs // Re // Evaluate, {r, 0, 120}, PlotRange -> All]
implot = 
 Plot[funs // Im // Evaluate, {r, 0, 120}, PlotRange -> All, 
  PlotStyle -> Dashed]
reimplot1 = 
 Plot[funs // ReIm // Evaluate, {r, 0, 120}, PlotRange -> All, 
  PlotStyle -> {Automatic, Dashed}]
reimplot2 = ReImPlot[funs // Evaluate, {r, 0, 120}, PlotRange -> All]

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.