The reason for the different discrete values is that you're using the same sample rate (Nmax) to sample two sine functions with different frequencies. The first sine function has frequency = n0/(2 Nmax) = .25
. The second sine function has a lower frequency = n0/(2(Nmax+1)) = 0.248062
.
Let's show the difference in the sine waves by plotting a few periods of each function - the first function in blue, and the second in red. Compute the frequencies and periods, then draw a graph of both functions on the same graph. It's difficult to see the difference in your graphs because the plots include many periods of the functions and their frequencies are nearly the same.
Nmax = 128;(*number of samples*)
n0 = Nmax/2;
N@{f1 = n0/(2 Nmax), p1 = 1/f1}
N@{f2 = n0/(2 (Nmax + 1)), p2 = 1/f2}
Show[
Plot[Sin[2 \[Pi] f1 t], {t, 0, 5 p1}, PlotStyle -> Blue],
Plot[Sin[2 \[Pi] f2 t], {t, 0, 5 p2}, PlotStyle -> Red]
]
When you sample the first sine function, the sample rate selects the crest and zero of each period. Let's plot the sine function and the discrete samples (red dots) on the same graph.
\[Psi]inin = Table[Sin[\[Pi] (n0 n)/Nmax], {n, 1, Nmax}];
Show[
ListLinePlot[\[Psi]inin, Joined -> False, PlotStyle -> Red],
Plot[Sin[\[Pi] n0 /Nmax n], {n, 1, Nmax}]]
When you sample the second sine function with the same sample rate, the samples happen between the crests and zeros. Again, let's plot the sine function and the samples on the same graph. See how the samples don't match the frequency? This demonstrates why the second discrete sine looks different from the first one.
\[Psi]ini = Table[Sin[\[Pi] (n0 n)/(Nmax + 1)], {n, 1, Nmax}];
Show[
ListLinePlot[\[Psi]ini, Joined -> False, PlotStyle -> Red],
Plot[Sin[\[Pi] (n0 n)/(Nmax + 1)], {n, 1, Nmax}]]
Nmax = 128; Manipulate[ ListLinePlot[Table[Sin[2 Pi f n ], {n, 1, Nmax}]] , {f, 0.1, 4}]
$\endgroup$