% Octave commands % NOTE: after cutting-and-pasting into Octave, use RET to execute. % Percent sign "%" is the Octave comment-line prefix. % Inspired by Chapter 2 of Hugh L. Montgomery's "Early Fourier Analysis" % M.V.Wickerhauser % Math 410 lecture notes % 2017-09-08 %%%% Roots of unity n=10; % Semicolon implies no printout. k=0:(n-1); % Integers 0,1,...,n-1 exp(2* pi * i * k/n) % kth root of z^n-1=0, ordered by argument. rou=@(n,k) exp(2* pi * i * k/n); % "Anonymous" function rou(n,k) % Another specification of the 10 10th roots of unity sum(rou(50,1:50)) % Sum of the 50 50th roots of unity % NOTE: the answers should be zero up to double precision truncation error 2e-16. % I.M.Vinogradov's e-function eIMV = @(x) exp(2*pi*i*x) % "anonymous" function % Theorem 2.1, p.34 example: q=3; k=9; % ...so q| ("q divides k") n=1:q; % ...so we sum from n=1 to n=q sum(eIMV(k*n/q)) % This should be q. q=5; k=9; % ...so q does not divide k n=1:q; % ...so we sum from n=1 to n=q sum(eIMV(k*n/q)) % This should be zero. %%%% Fourier matrix % Order 5 example, explicitly from roots of unity n=5; k=0:(n-1); fourier5 = [ rou(5,-0*k); % 0th row = -0th powers of 5th roots of unity rou(5,-1*k); % 1st row = -1st powers of 5th roots of unity rou(5,-2*k); % ... rou(5,-3*k); rou(5,-4*k) ] % last row = -(n-1)th powers of fourier5' * fourier5 % Should be 5*Identity %%%% Function to produce a Fourier matrix of arbitrary order. % Write this into a file "fouriermatrix.m" function F=fouriermatrix(n) F=zeros(n,n); % Initialize an n*n matrix for(m=1:n) % row index for(k=1:n) % column index F(m,k)=exp(-2*pi*i*m*k/n); % can also use Vinogradov's function here endfor endfor end %%%%%%%%%% end of "fouriermatrix.m"