- #1

- 16

- 1

Code:

```
\[HBar] = 1;
m = 1;
Do[Energy[z] = 0.5 + 5 z, {z, 0, 14}]
Table[Energy[z], {z, 0, 14}];
Do[Entot[n, o] = Energy[o] - \[HBar]*\[Omega]*n, {n, -10, 10}, {o, 0,
14}]
Do[k[n, o] = 2*m*(Entot[n, o])^(1/2), {n, -10, 10}, {o, 0, 14}]
\[Omega] = 1;
s = 10;
k0 = 10;
\[Alpha] = 10;
t0 = 1;
t[-11] = 0.01;
t[11] = 0.01;
r[-11] = 0.01;
r[11] = 0.01;
ClearAll[plot1]
Do[eqn[n, o] = -t[n] +
KroneckerDelta[n,
1] + (s*m/(2*\[HBar]^2*I*k[n, o]))*(t[n - 1] +
t[n + 1]), {n, -10, 10}, {o, 0, 14}];
tab1 = Table[eqn[n, o], {o, 0, 14}, {n, -10, 10}];
tab2 = Table[t[n], {n, -10, 10}];
Do[plot1[p] = NSolve[tab1[[p]] == 0, tab2], {p, 1, 15}]
Do[f[n, o] = t[n] /. plot1[o], {n, -10, 10}, {o, 1, 15}]
ListPlot[Abs[
Table[Flatten[Table[f[n, o], {n, -10, 10}]], {o, 1, 15}]],
PlotRange -> {0, 1.5}, PlotLegends -> Automatic]
```

Any help would be much appreciated, and apologies if my code's a mess, I'm very much a rookie.

Thanks!