I’m brand new to mathematica and have some 2D eigenfunctions, $psi(n,varphi)$, returned from NDEigensystem. The continuous variable $varphi$ can be represented as $varphi=2pi(varphi)+bar varphi$ where $(varphi)inmathbb{Z}$ and $bar varphiin(-pi,pi )$.

I need to plot $$ psi(varphi)=int_{-1/2}^{1/2}dn e^{-in(varphi)} psi(n,bar varphi). $$ I have managed to get some plots, but as they are not what I expected and as most of my code is adapted from varying answers on stackexchange, I do not think I have done it correctly.

First I solved for the eigenfunctions and stored them as “funs”:

```
A = 0.05; Subscript(V, 0) = 1 ; d = 2; schröd = -A*d^2 (Pi)*D((Psi)(n, (CurlyPhi)), {(CurlyPhi), 2}) + A/(4 (Pi)) ((CurlyPhi)*(CurlyPhi)*(Psi)(n, (CurlyPhi)) +
2 I*D((Psi)(n, (CurlyPhi)), {n, 1}) -
D((Psi)(n, (CurlyPhi)), {n, 2})) - Subscript(V,
0) ((Cos(2 (Pi)*d*n)) + Cos((CurlyPhi))) (Psi)(n, (CurlyPhi)); Subscript(n, min) = -1/2; Subscript(n, max) = 1/2; Subscript( (CurlyPhi), min) = -(Pi); Subscript((CurlyPhi), max) = (Pi);
{vals, funs} = NDEigensystem({schröd,
PeriodicBoundaryCondition((Psi)(n, (CurlyPhi)),
Subscript((CurlyPhi), min) <= (CurlyPhi) <=
Subscript((CurlyPhi), max) && n == Subscript(n, max) ,
FindGeometricTransform({{Subscript(n, min),
Subscript((CurlyPhi), min)}, {Subscript(n, min),
Subscript((CurlyPhi), max)}}, {{Subscript(n, max),
Subscript((CurlyPhi), min)}, {Subscript(n, max),
Subscript((CurlyPhi), max)}})((2))),
PeriodicBoundaryCondition(Exp(I 2 (Pi) n)*(Psi)(n, (CurlyPhi)),
Subscript(n, min) <= n <= Subscript(n, max) && (CurlyPhi) ==
Subscript((CurlyPhi), max),
FindGeometricTransform({{Subscript(n, min),
Subscript((CurlyPhi), min)}, {Subscript(n, max),
Subscript((CurlyPhi), min)}}, {{Subscript(n, min),
Subscript((CurlyPhi), max)}, {Subscript(n, max),
Subscript((CurlyPhi), max)}})((2)))}, (Psi)(
n, (CurlyPhi)) , {n, (CurlyPhi)} (Element)
Rectangle({Subscript(n, min), Subscript((CurlyPhi),
min)}, {Subscript(n, max), Subscript((CurlyPhi), max)}), 8);
```

Then I created “MyRound” to be able to evaluate $(varphi)$ (labelled K in my code) given any $varphi$:

```
SetAttributes(RoundPos, Listable)
RoundPos(n_) :=
If(FractionalPart(n) >= 1/2, Ceiling(n), Floor(n));
SetAttributes(RoundNeg, Listable)
RoundNeg(n_) := If(FractionalPart(n) < -1/2, Floor(n), Ceiling(n));
SetAttributes(MyRound, Listable)
MyRound(n_) := If(n >= 0, RoundPos(n), RoundNeg(n));
K((CurlyPhi)_) := MyRound((CurlyPhi)/(2 (Pi)))
```

And finally I tried to calculate the required integral and plot the results:

```
Subscript((CurlyPhi), subdivisions) = 0.1 ;
Needs("FunctionApproximations`")
Table(f = Exp(I*n*K((CurlyPhi)))*funs((i));
t = Abs(
Table(NIntegrateInterpolatingFunction(
f, {n, -0.5, 0.5}), {(CurlyPhi), -(Pi), (Pi),
Subscript((CurlyPhi), subdivisions)})^2);
u = Range(-(Pi), (Pi), Subscript((CurlyPhi), subdivisions));
data = Transpose@{u, t};
ListPlot(data, ImageSize -> 250), {i, 2})
```

I would also like to plot these $psi(varphi)$ for a domain larger than $varphiin(-pi,pi )$ but I do not know how to make the eigenfunction calculate $barvarphi$ given $varphi$ in the NIntegrateInterpolatingFunction command, or in general. Ideally I would make my function $psi(n,varphi)$ accept values of $varphi$ but evaluate $barvarphi$.

Another method I tried to implement the integral with used this stackexchange answer (using the questioner’s interpolating function):

```
da = Flatten(
Table({t, tau, N@Sin(2 (t + 3 tau)) Exp(-2 t - tau)}, {t, 0, 2,
2/100}, {tau, 0, 5, 5/100}), 1);
f = Interpolation@da;
{{x1, x2}, {y1, y2}} = f("Domain");
intx = Integrate(f(x, y), x) /. x -> x2;
nintx(y_?NumericQ) := Module({x}, NIntegrate(f(x, y), {x, x1, x2}));
Plot(nintx(y), {y, y1, y2}, PlotRange -> All)
```

However, trying to implement this myself gives an error after the third line because it reads n2 as 0.5:

```
f = funs((1));
{{n1, n2}, {(CurlyPhi)1, (CurlyPhi)2}} = f("Domain");
intn = Integrate(f(n, (CurlyPhi)), n) /. n -> n2;
```

General::ivar: 0.5 is not a valid variable.

Integrate::ilim: Invalid integration variable or limit(s) in 0.5.

Thank you so much in advance for your help!