# Lists{vals,funs} and NDEigensystem are not the same shape?

Hi I'm trying to create a Manipulate[Plot[]] so that I can vary lambda in the below equation from 0 to 2 and see how it affects my plot. I'm getting stuck a couple steps before that though where I use NDEigensystem to solve a potential. It keeps giving the error,

Set::shape: Lists {vals,funs} and NDEigensystem[29.1667 (E^(-0.261861x) - 2E^(-0.130931x) + E^(-0.0872872x) * [Lambda]) * u[x]-u''[x]/2,u[x],{x,-29.1667 (25.9352 exp+6177.79 * [Lambda]),100},1,Method->{SpatialDiscretization->{FiniteElement,{MeshOptions->{<<1>>}}}}] are not the same shape.


Here is the code I'm using that's giving me the error:

V[x_] := 7/(48(.005)) (E^(-2[x]/7.637626158259733) -
2 E^(x/7.637626158259733) + [Lambda]*E^(-2/3 x/7.637626158259733))
[L] = -h^2*u''[x] + V[x]*u[x]; {vals,
funs} = NDEigensystem[[L],
u[x], {x, -29.166666666666668 (2.357747434867739*
exp(11) + 6177.788320394612 * [Lambda]), 100}, 1,
Method -> {"SpatialDiscretization" -> {"FiniteElement", \
{"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}];


And here is the follow-up code that I'm trying to use to plot it all:

In[42]:= vals

Out[42]= vals

Manipulate[Show[Plot[Evaluate[h*funs + vals], {[x], -10, 10},
BaseStyle -> {FontWeight -> "Bold", FontSize -> 12},
AxesLabel ->{"x","V(x)"}, PlotPoints->1000, PlotStyle->{Thickness[0.009]}],Plot[V[x],{x,0.5,60},BaseStyle->{FontWeight->"Bold",FontSize->12},AxesLabel->{"x","V_(x)"},PlotPoints->1000,PlotStyle->{Thickness[0.009]}],PlotRange->{{0.5,60},{0.4}},AxesOrigin->{-5,0},ImageSize->Medium],{Lambda,0,2}]



I also provided a screenshot of the code I am basing this off of which worked fine for me, I think it's just because of the constant lambda I now have? I am also assuming that this is the reason there's nothing showing up for my Manipulate[Plot[]] so ideally if we can fix this shape issue then everything else should be good...I hope.

Side note: I already defined h above the error-producing code (in the nice error-free code; see image) which is why it's not shown in the bad error code.

Thanks for any help!! Note: the top code is the code I'm basing this off of and the bottom code is my current code that's failing me.

• There seem to be lots of erroneous square brackets in your code. Also exp(11) should be Exp[11] Commented Nov 18, 2020 at 3:34
• This [L] = -h^2*u''[x] + V[x]*u[x] is not valid syntax. Try L=... and use L and not [L] in NDEigenststem Commented Nov 18, 2020 at 8:05
• Oh thank you for the Exp help, I always forget that! But it didn't fix the problem. I should mention, I think a lot of the weird formatting in my code above is due to the copy/paste mess ups. For example, the L is supposed to be a capital script L and when I copy/pasted it, it came out as [ScriptCapitalL] but I wanted to make it look nicer so I got rid of the ScriptCapital part and forgot about the square brackets. My real code looks like the new image I've inserted into the OP. I apologize for not noticing the mess-ups. Commented Nov 18, 2020 at 18:53

This produces some plots, but it's not exactly what you're asking for. (I changed the interval for NDEigensystem to {x, -30, 30} to avoid crashing)

Clear[L, V]
h = 1/Sqrt[2];

V[x_, lambda_] :=
7/(48 (.005)) (E^(-2 x/7.637626158259733) -
2 E^(x/7.637626158259733) + lambda*E^(-2/3 x/7.637626158259733))

L[lambda_] := -h^2*u''[x] + V[x, lambda]*u[x]

f[lambda_] :=
NDEigensystem[L[lambda], u[x], {x, -30, 30}, 1,
Method -> {"SpatialDiscretization" -> {"FiniteElement", \
{"MeshOptions" -> {MaxCellMeasure -> 0.01}}}}]

Manipulate[
{funs, vals} = f[lambda];
Show[
Plot[h*funs + vals, {x, -10, 10}, AxesLabel -> {"x", "V(x)"},
PlotStyle -> Red, PlotPoints -> 1000],
Plot[V[x, lambda], {x, 0.5, 60}, PlotStyle -> Blue,
PlotPoints -> 1000],
PlotRange -> {{0, 10}, {-5, 10}}
],
{lambda, 0.1, 2}]