Skip to main content

differential equations - NDSolve eigenvalue problem of bound state


I am trying to solve this eigenvalue problem:
μΨ(r)=−12(Ψ′′(r)+2rΨ′(r))−4πΨ(r)∫∞0dr′r′2Ψ(r′)2r>,

where μ is the eigenvalue, Ψ(r) the eigenfunction I'm trying to solve, and r> is the greater one of r and r′. The requirement of the system is
Ψ′(0)=0,Ψ(∞)=0.


Since it involves an integral, the way I deal with it is to decouple it to two equations.


μΨ(r)=−12(Ψ′′(r)+2rΨ′(r))+Ψ(r)Φ(r),∇2Φ(r)=4πΨ(r)2,


with boundary


Ψ′(0)=0,Ψ(∞)=0,Φ′(0)=0,Φ(∞)=0.



Any idea how to solve it?


Attempt 1:


I manually tweak the boundary condition Ψ(0) at zero trying to find a solution of Ψ(r) that doesn't blow up at infinity. μΨ(r)=−12(Ψ′′(r)+2rΨ′(r))+Ψ(r)Φ(r),∇2Φ(r)=4πΨ(r)2,


with boundary


Ψ′(0)=0,Ψ(0)=A,Φ′(0)=0,Φ(∞)=0.


My current method is to guess a pair of input data (μ,A), use NDSolve to solve for Ψ,Φ, and check whether the solution gives me a Ψ whose absolute value decreases monotonically i.e. vanishes at infinity, as suggested here. However, even with this method I haven't had much success. So, a) is there a good way to implement this algorithm; b) is there a better/alternative way to attack this whole problem? --AFAIK, (N)DEigensystem cannot handle this problem.


Edited:


Attemp 2:


So I just tried it out, naively if I use NDEigensystem directly as follows, it won't solve at all, which is not surprising.


rStart1=10^-3;

rEnd1=5;
epsilon=0;
sollst1=NDEigensystem[{(-1/2*(D[ψ[r],r,r]+2/r*D[ψ[r],r])-4Pi*ψ[r]*Integrate[rp^2*ψ[rp]^2/If[rp>r,rp,r],{rp,0,Infinity}])+NeumannValue[0,r==rStart1]},ψ[r],{r,rStart1,rEnd1},8];//AbsoluteTiming

Attemp 3: So this time I have fixed μ, kept the boundary condition as Ψ′(0)=0,Ψ(∞)=0,Φ′(0)=0,Φ(∞)=0.

and used the shooting method to select normalization for Ψ(0). The following code works but only for very specific choice of rEnd1 and μ=−0.4. Changing any of them gives me a trivial solution again. It seems the code is a bit fine-tuned in this sense.


rEnd1 = 3.7;
rStart1 = 10^-3;
stableHunter3[μ_] := Module[{}, epsilon = 0;
eqn2 = {-μ*ψ[r] -
1/2*(D[ψ[r], r, r] + 2/r*D[ψ[r], r]) + ϕ[

r]*ψ[r](*-1/8*ψ[r]^3*)== 0,
D[ϕ[r], r, r] + 2/r*D[ϕ[r], r] == 4 Pi*ψ[r]^2};
bc2 = {ψ[rEnd1] ==
epsilon, (D[ψ[r], r] /. r -> rStart1) ==
epsilon, (D[Ï•[r], r] /. r -> rStart1) ==
epsilon, (Ï•[rEnd1]) == epsilon};
sollst1 =
Map[NDSolveValue[
Flatten@{eqn2, bc2}, {ψ[r], ϕ[r]}, {r, rStart1,
rEnd1}, Method ->

"BoundaryValues" -> {"Shooting",
"StartingInitialConditions" -> {ψ[0] == #}},
Method -> "StiffnessSwitching"] &, Range[-3, 3, 0.1]]
]
funclst = stableHunter3[-0.4];
Plot[Evaluate[funclst /. r -> r00], {r00, rStart1, rEnd1}]

Attemp 4: So based on the suggestion from @bbgodfrey, an analysis on the asymptotic behavior suggests the following. When r→∞, μΨ(r)=−12(Ψ′′(r)+2rΨ′(r))−4πΨ(r)∫∞0dr′r′2Ψ(r′)2r>,≈−12(Ψ′′(r)+2rΨ′(r))−NrΨ(r),

where N≡∫∞0Ψ(r)24πr2dr. Here Φ(r) is not necessary, but if it is defined then Φ(r)≈−Nr at large r. Then, I could use the following code to solve the eigenvalue μ.


rStart1 = 10^-3;
rEnd1 = 5;

epsilon = 0;
Nphy1 = 1;

sollst1 =
NDEigensystem[{(-1/2*(D[ψ[r], r, r] + 2/r*D[ψ[r], r]) -
Nphy1/r*ψ[r]) + NeumannValue[0, r == rStart1](*,
DirichletCondition[ψ[r]\[Equal]epsilon,
x\[Equal]rStart1]*)}, ψ[r], {r, rStart1, rEnd1},
8]; // AbsoluteTiming
sollst1

sollst1[[2]] /. r -> rEnd1
Plot[Evaluate[%[[2]]], {r, rStart1, rEnd1},
PlotRange -> All(*,PlotLabels\[Rule]{1,2,3}*)]


{{-0.176753, 0.497306, -0.507498, 1.62112, 3.15356, 5.08955, 7.42803,
10.1706}, {InterpolatingFunction[{{0.001, 5.}}, <>][r],
InterpolatingFunction[{{0.001, 5.}}, <>][r],
InterpolatingFunction[{{0.001, 5.}}, <>][r],
InterpolatingFunction[{{0.001, 5.}}, <>][r],

InterpolatingFunction[{{0.001, 5.}}, <>][r],
InterpolatingFunction[{{0.001, 5.}}, <>][r],
InterpolatingFunction[{{0.001, 5.}}, <>][r],
InterpolatingFunction[{{0.001, 5.}}, <>][r]}}
{0.205938, -0.112739, 0.0259637, -0.094238, -0.0840003, -0.0769606}

enter image description here


I believe the μ=−0.507498 is the ground state eigenvalue. However, when I use the boundary conditions at rEnd1 to trade for the ones at infinity, I ended up with trivial solution only.


stableHunter3[μ_] := Module[{},
eqn2 = {-μ*ψ[r] -

1/2*(D[ψ[r], r, r] + 2/r*D[ψ[r], r]) + ϕ[
r]*ψ[r] == 0,
D[ϕ[r], r, r] + 2/r*D[ϕ[r], r] == 4 Pi*ψ[r]^2};
bc2 = {ψ[rEnd1] ==
0.025963699315910634`, (D[ψ[r], r] /. r -> rStart1) ==
epsilon, (D[Ï•[r], r] /. r -> rStart1) ==
epsilon, (Ï•[rEnd1]) == Nphy1/rEnd1};
sollst1 =
NDSolveValue[
Flatten@{eqn2, bc2}, {ψ[r], ϕ[r]}, {r, rStart1,

rEnd1}](*Map[NDSolveValue[Flatten@{eqn2,bc2},{ψ[r],ϕ[
r]},{r,rStart1,rEnd1},
Method\[Rule]"BoundaryValues"\[Rule]{"Shooting",
"StartingInitialConditions"\[Rule]{ψ[0]\[Equal]#}}]&,Range[-3,
3,0.05]]*)
]
sollst1 = stableHunter3[-0.5074977775084505`]
Plot[Evaluate[sollst1 /. r -> r00], {r00, rStart1, rEnd1}]

enter image description here



Any thoughts how to proceed from there to solve Ψ(r) at region where r is small?


Attempt 5: Something weird happened. I start believing there is something related to the precision of NDSolve. Here is the code in which only the second element of the list gives me a nontrivial solution.


stableHunter3[μ_] := Module[{},
eqn2 = {-μ*ψ[r] -
1/2*(D[ψ[r], r, r] + 2/r*D[ψ[r], r]) + ϕ[
r]*ψ[r] == 0,
D[ϕ[r], r, r] + 2/r*D[ϕ[r], r] == 4 Pi*ψ[r]^2};
bc2 = {ψ[rEnd1] ==
0.025963699315910634`, (D[ψ[r], r] /. r -> rStart1) ==
epsilon, (D[Ï•[r], r] /. r -> rStart1) ==

epsilon, (Ï•[rEnd1]) == -Nphy1/rEnd1};
sollst1 =
NDSolveValue[
Flatten@{eqn2, bc2}, {ψ[r], ϕ[r]}, {r, rStart1,
rEnd1}](*Map[NDSolveValue[Flatten@{eqn2,bc2},{ψ[r],ϕ[
r]},{r,rStart1,rEnd1},
Method\[Rule]"BoundaryValues"\[Rule]{"Shooting",
"StartingInitialConditions"\[Rule]{ψ[0]\[Equal]#}}]&,Range[-3,
3,0.05]]*)
]

sollst1 =
Map[stableHunter3[#] \
&,(*Range[-0.5074977775084505-0.02,-0.5074977775084505+0.02,
0.005]*){-0.5074977775084505`, -0.5074977775084505`-0, \
-0.5074977775084505`+0.01}]
Plot[Evaluate[Flatten@sollst1 /. r -> r00], {r00, rStart1, rEnd1},
PlotRange -> All]

enter image description here



Answer




It turns out that the `trial-and-error' method is the simplest, as suggested by a few people that I talked to. Below is a piece of sample code.


epsilon = 0;
rEnd1 = 12;
rStart1 = 10^-5;
stableHunter3[μ_, A_, B_] :=
Module[{},
eqn2 = {-μ*ψ[r] -
1/2*(D[ψ[r], r, r] + 2/r*D[ψ[r], r]) + ϕ[
r]*ψ[r] == 0,
D[ϕ[r], r, r] + 2/r*D[ϕ[r], r] == 4 Pi*ψ[r]^2};

bc2 = {ψ[rStart1] == A, (D[ψ[r], r] /. r -> rStart1) ==
epsilon, (D[Ï•[r], r] /. r -> rStart1) ==
epsilon, (Ï•[rStart1]) == B};
sollst1 =
NDSolveValue[
Flatten@{eqn2, bc2}, {ψ, ϕ}, {r, rStart1, rEnd1},
Method -> "StiffnessSwitching"]]

sollst = Table[
sol = stableHunter3[muloop, psiloop, -4][[1]];

solder[rr_] := D[sol[r], r] /. r -> rr;
pt = rStart1;
While[solder[pt] <= 0 && sol[pt] >= 0 && pt < rEnd1,
pt += (rEnd1 - rStart1)/10;
];
If[pt == rEnd1, {muloop, psiloop, sol}]
, {muloop, -4, -3, 0.002}, {psiloop, 0.1, 0.4,
0.002}]; // AbsoluteTiming

Out[5]= {69.0395, Null}


(*I used twelve remote kernels to run it.
Running locally it'll take about 15 min.
You can try a coarse-grained lattice for
the muloop and psiloop, and decrease rEnd1
at the same time.*)

In[6]:= Flatten[DeleteCases[sollst /. Null -> Sequence[], {}], 1]

(-3.77 0.1 InterpolatingFunction[Domain: (0.00001 12.)

Output: scalar]
-3.756 0.106 InterpolatingFunction[Domain: (0.00001 12.)
Output: scalar]
-3.742 0.112 InterpolatingFunction[Domain: (0.00001 12.)
Output: scalar]
-3.65 0.152 InterpolatingFunction[Domain: (0.00001 12.)
Output: scalar])

sol = stableHunter3[-3.65, 0.152, -4][[1]];


solder[rr_] := D[sol[r], r] /. r -> rr;
Plot[Evaluate[{sol[r], solder[r]} /. r -> rrr], {rrr, rStart1, rEnd1},
PlotRange -> All]

enter image description here


Helpful communications with @bbgodfrey, M. Hertzberg, E. Schiappacasse, S. Schwarz, L. Titus, @xzczd are appreciated.


Comments

Popular posts from this blog

functions - Get leading series expansion term?

Given a function f[x] , I would like to have a function leadingSeries that returns just the leading term in the series around x=0 . For example: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x)] x and leadingSeries[(1/x + 2 + (1 - 1/x^3)/4)/(4 + x)] -(1/(16 x^3)) Is there such a function in Mathematica? Or maybe one can implement it efficiently? EDIT I finally went with the following implementation, based on Carl Woll 's answer: lds[ex_,x_]:=( (ex/.x->(x+O[x]^2))/.SeriesData[U_,Z_,L_List,Mi_,Ma_,De_]:>SeriesData[U,Z,{L[[1]]},Mi,Mi+1,De]//Quiet//Normal) The advantage is, that this one also properly works with functions whose leading term is a constant: lds[Exp[x],x] 1 Answer Update 1 Updated to eliminate SeriesData and to not return additional terms Perhaps you could use: leadingSeries[expr_, x_] := Normal[expr /. x->(x+O[x]^2) /. a_List :> Take[a, 1]] Then for your examples: leadingSeries[(1/x + 2)/(4 + 1/x^2 + x), x] leadingSeries[Exp[x], x] leadingSeries[(1/x + 2 + (1 - 1/x...

mathematical optimization - Minimizing using indices, error: Part::pkspec1: The expression cannot be used as a part specification

I want to use Minimize where the variables to minimize are indices pointing into an array. Here a MWE that hopefully shows what my problem is. vars = u@# & /@ Range[3]; cons = Flatten@ { Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; Minimize[{Total@((vec1[[#]] - vec2[[u[#]]])^2 & /@ Range[1, 3]), cons}, vars, Integers] The error I get: Part::pkspec1: The expression u[1] cannot be used as a part specification. >> Answer Ok, it seems that one can get around Mathematica trying to evaluate vec2[[u[1]]] too early by using the function Indexed[vec2,u[1]] . The working MWE would then look like the following: vars = u@# & /@ Range[3]; cons = Flatten@{ Table[(u[j] != #) & /@ vars[[j + 1 ;; -1]], {j, 1, 3 - 1}], 1 vec1 = {1, 2, 3}; vec2 = {1, 2, 3}; NMinimize[ {Total@((vec1[[#]] - Indexed[vec2, u[#]])^2 & /@ R...

plotting - Plot 4D data with color as 4th dimension

I have a list of 4D data (x position, y position, amplitude, wavelength). I want to plot x, y, and amplitude on a 3D plot and have the color of the points correspond to the wavelength. I have seen many examples using functions to define color but my wavelength cannot be expressed by an analytic function. Is there a simple way to do this? Answer Here a another possible way to visualize 4D data: data = Flatten[Table[{x, y, x^2 + y^2, Sin[x - y]}, {x, -Pi, Pi,Pi/10}, {y,-Pi,Pi, Pi/10}], 1]; You can use the function Point along with VertexColors . Now the points are places using the first three elements and the color is determined by the fourth. In this case I used Hue, but you can use whatever you prefer. Graphics3D[ Point[data[[All, 1 ;; 3]], VertexColors -> Hue /@ data[[All, 4]]], Axes -> True, BoxRatios -> {1, 1, 1/GoldenRatio}]