3
$\begingroup$

enter image description here

\[Lambda] = 2;

g = 1/50;

m = 1;

h = 1;

V[x_] =(*g*(x^2-\[Lambda]^2/(8*g))^2=*)-1/4*\[Lambda]^2*x^2 + g*x^4 + \[Lambda]^4/(64*g);

\[ScriptCapitalL] = -h^2/(2 m)*Laplacian[u[x], {x}] + V[x]*u[x];

{vals, funs} = NDEigensystem[\[ScriptCapitalL], u[x], {x, -10, 10}, 50, Method -> {"SpatialDiscretization" -> {"FiniteElement", \
{"MeshOptions" -> {MaxCellMeasure -> 0.05}}},"Eigensystem" -> {"Arnoldi", MaxIterations -> 80000}}];

trunc = 4;

Table[xt[n, m] = Integrate[funs[[n]]*funs[[m]]*x, {x, -10, 10}, Assumptions -> {n \[Element] Integers, m \[Element] Integers}], {m, 0, trunc}, {n, 0, trunc}];    `

I have used NDEigensytem to solve the Schrodinger equation of the above-mentioned potential. The eigenvalues and eigenfunctions are correct. However, it's not working when I try to measure the expectation value. Why is it not working?

$\endgroup$
2
  • 4
    $\begingroup$ In your other very similar question you posted a screenshot too. (261506). You must post code, not screenshots of code as nobody will bother typing your code out manually to help you. $\endgroup$
    – flinty
    Commented Jan 4, 2022 at 11:21
  • 1
    $\begingroup$ Yeah, you are right. I just edited it. Thank you $\endgroup$
    – user444
    Commented Jan 4, 2022 at 11:38

2 Answers 2

5
$\begingroup$

Try:

Clear[m]
mesh = funs[[1, 0]]["ElementMesh"];
trunc = 4;
Table[xt[n, m] = 
  NIntegrate[funs[[n]]*funs[[m]]*x, Element[{x}, mesh]], {m, 1, 
  trunc}, {n, 1, trunc}]

You have defined m previously, you'd need to start your loop from 1 and not 0 and use NIntegrate as the input is numeric in nature. Also using a mesh is better then the range.

$\endgroup$
6
$\begingroup$

Change n,m in your table command! The eigenfunctions are interpolation-objects, though you can use NIntegrate:

xt = Table[
NIntegrate[funs[[n]]*funs[[m]]*x, {x, -10, 10} ,Method -> "LocalAdaptive"],    
{m, 1, trunc}, {n,1, trunc}]

(*{{0.481925, 4.89903, 0.024628, -0.504564}, 
{4.89903, -0.481925,0.504564, 0.024628}, 
{0.024628,0.504564, -0.00243929, -4.75793}, 
{-0.504564, 0.024628, -4.75793,0.00243929}}*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.