In[]:=
Clear["Global`*"]
In[]:=
L=30;
In[]:=
k=2
Out[]=
2
In[]:=
ℒ=-Laplacian[u[x],{x}]+(x^2)+
2
Sin
2*k*π*x
L

*u[x]2
Out[]=
1
2
2
x
+
2
Sin
2πx
15

u[x]-
′′
u
[x]
ℬ={DirichletCondition[u[x]==0,x==-L],DirichletCondition[u[x]==0,x==L]}
In[]:=
exacteigsys=DEigensystem[{ℒ,ℬ},u[x],{x,-30,30},10,Method->"Normalize"];
In[]:=
exacteigsys[[1]]
Out[]=

1
2
2
x
+
2
Sin
2πx
15

u[x]-
′′
u
[x],DirichletCondition[u[x]0,True]
In[]:=
exacteigsys[[2]]
Out[]=
u[x]
In[]:=
Clear["Global`*"]
In[]:=
k=2
Out[]=
2
In[]:=
L=30;
In[]:=
ℒ=-Laplacian[u[x],{x}]+(x^2)+
2
Sin
2*k*π*x
L

*u[x]2
Out[]=
1
2
2
x
+
2
Sin
2πx
15

u[x]-
′′
u
[x]
In[]:=
ℬ={DirichletCondition[u[x]==0,x==-L],DirichletCondition[u[x]==0,x==L]}
Out[]=
{DirichletCondition[u[x]0,x-30],DirichletCondition[u[x]0,x30]}
In[]:=
neigsys=NDEigensystem[{ℒ,ℬ},u[x],{x,-5,5},5,Method->{"PDEDiscretization"->{"FiniteElement",{"MeshOptions"->{MaxCellMeasure->0.05}}}}];
NDEigensystem
:The number of PDEs (​3​) does not match the number of dependent variables (​1​).