NotebookEvaluate[NotebookDirectory[]<>"/split_step.nb"];

HarmonicTrap1D[];
sizes={1024};
timeStep=0.001;
k=-0.4;
contactInteractionFactor=4 Pi k;
initialize[];
gridReport

calcAllTable
p1=plotProjections

AbsoluteTiming[evolve["ite",10,10]]

calcAllTable
p2=plotProjections;
Show[p1,p2,PlotRange->All]

reportMoments

Turn off harmonic potential

newPotential[(0&)];
plot:=AppendTo[lplots,{time,plotProjections}];
reset[];
AbsoluteTiming[evolve["ite",5,20,20]]

ListPlot[lmoments[[All,{1,3}]],Joined->True,PlotRange->All]

Show[lplots[[All,2]],PlotRange->All]

f=psi;

γ=contactInteractionFactor;

Plot[{Abs[f[x]],Sqrt[Abs[γ]/4]Sech[x Abs[γ]/2]},{x,-3,3},PlotRange->All]

Plot[Abs[f[x]]-Sqrt[Abs[γ]/4]Sech[x Abs[γ]/2],{x,-3,3},PlotRange->All]

(* g=Abs[γ] *)
(* Enacba oblike -1/2 ψ''-g |ψ|^2 ψ==μ ψ *)

ψ=Sqrt[g/4]Sech[x g/2]

Integrate[ψ^2,{x,-∞,∞},Assumptions->g>0]

(-1/2)D[ψ,{x,2}]
x1=Simplify[%]

(* Note the sign! *)
-g ψ^2 ψ
x2=Simplify[%]

xx=FullSimplify[x1+x2,g>0 && x∈Reals]

mu=xx/ψ

Plot[{-xx/.g->1,-mu ψ/.g->1},{x,-20,20},PlotRange->All]

Simplify[x1+x2]
mu ψ

(* Prefactor to x in Sech[...x] *)
Simplify[Sqrt[2 (-mu)],g>0]