diff --git a/PS2/doc.aux b/PS2/doc.aux index 731303a..67e19b0 100644 --- a/PS2/doc.aux +++ b/PS2/doc.aux @@ -7,7 +7,8 @@ \newlabel{eq:analytical}{{1}{3}} \newlabel{eq:normalise}{{2}{3}} \newlabel{eq:integral_ident}{{3}{3}} -\newlabel{eq:numerical_E}{{4}{4}} -\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Analytic solution to numeric system, plotted.\relax }}{4}{}\protected@file@percent } -\newlabel{fig:q1b_electrons}{{2}{4}} +\newlabel{eq:numerical_norm}{{5}{4}} +\newlabel{eq:Riemann_sum}{{6}{4}} +\newlabel{eq:numerical_E}{{7}{4}} +\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Analytic solution to numeric system, plotted.\relax }}{5}{}\protected@file@percent } \gdef \@abspage@last{9} diff --git a/PS2/doc.fdb_latexmk b/PS2/doc.fdb_latexmk index 1f0c9a1..a230dda 100644 --- a/PS2/doc.fdb_latexmk +++ b/PS2/doc.fdb_latexmk @@ -1,5 +1,5 @@ # Fdb version 3 -["pdflatex"] 1614640686 "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.tex" "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.pdf" "doc" 1614640702 +["pdflatex"] 1614642209 "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.tex" "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.pdf" "doc" 1614642211 "C:/Users/speed/AppData/Local/MiKTeX/fonts/pk/ljfour/jknappen/ec/dpi600/tcrm1000.pk" 1614620319 11548 693fc704971bedc6e913b37b081cf40e "" "C:/Users/speed/AppData/Local/MiKTeX/miktex/data/le/pdftex/pdflatex.fmt" 1612675286 9293900 83195ab665706b6f706823352908aa95 "" "C:/Users/speed/AppData/Local/MiKTeX/pdftex/config/pdftex.map" 1614638559 80909 eab91d9745dd2edfd62a31d53cd5fe15 "" @@ -95,15 +95,18 @@ "C:/Users/speed/AppData/Local/Programs/MiKTeX/tex/latex/parskip/parskip.sty" 1592833306 4414 25631f9679adf750bac898538ededd61 "" "C:/Users/speed/AppData/Local/Programs/MiKTeX/tex/latex/setspace/setspace.sty" 1324294077 22913 a27d7908fc6f0385466454a966a316eb "" "C:/Users/speed/AppData/Local/Programs/MiKTeX/tex/latex/titlesec/titlesec.sty" 1571240058 48596 2b6a95da931c07a430b1a61904aaa42d "" - "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.aux" 1614640688 560 a7f45c1ba582090fea381768d02972d1 "" - "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.tex" 1614640701 13478 c506f224fad814ac5407ed9564ca556b "" - "doc.aux" 1614640688 560 a7f45c1ba582090fea381768d02972d1 "pdflatex" - "doc.tex" 1614640701 13478 c506f224fad814ac5407ed9564ca556b "" + "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.aux" 1614642211 594 16258d68357a6aa33c90988b15b0fec2 "" + "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.tex" 1614642208 15328 6099e64f934d062967e02a10084db0a5 "" + "doc.aux" 1614642211 594 16258d68357a6aa33c90988b15b0fec2 "pdflatex" + "doc.tex" 1614642208 15328 6099e64f934d062967e02a10084db0a5 "" "q1a_1and50.png" 1614636283 34155 72f34c6abf061325ae1f162db0ffd06b "" "q1a_eigenvals.png" 1614637266 23078 9c99a5505761d0b964e665e35fd9c02a "" + "q1cii.png" 1614640691 20581 6a6b3aa285fd3f5be369532a6d2a033d "" + "q1civ_fig1.png" 1614640691 20825 3bcd72f9b5aa0ff86ec535618927b345 "" + "q1civ_fig2.png" 1614640691 18950 09e638d39de7c71e3285b2507fc9bb06 "" (generated) + "doc.pdf" + "doc.aux" + "doc.log" "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.log" "d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.pdf" - "doc.pdf" - "doc.log" - "doc.aux" diff --git a/PS2/doc.fls b/PS2/doc.fls index cbb5f36..40ffa6c 100644 --- a/PS2/doc.fls +++ b/PS2/doc.fls @@ -515,6 +515,27 @@ INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1a_eigenvals.png INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1a_eigenvals.png INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1a_eigenvals.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1cii.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig1.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png +INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\q1civ_fig2.png INPUT d:\Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\doc.aux INPUT C:\Users\speed\AppData\Local\MiKTeX\fonts\pk\ljfour\jknappen\ec\dpi600\tcrm1000.pk INPUT C:\Users\speed\AppData\Local\MiKTeX\fonts\pk\ljfour\jknappen\ec\dpi600\tcrm1000.pk diff --git a/PS2/doc.log b/PS2/doc.log index def3426..7dcf3e2 100644 --- a/PS2/doc.log +++ b/PS2/doc.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 21.1) (preloaded format=pdflatex 2021.2.6) 1 MAR 2021 16:18 +This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 21.1) (preloaded format=pdflatex 2021.2.6) 1 MAR 2021 16:43 entering extended mode **d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.tex (d:/Users/Speedee/Documents/University/Year5/Winter/ECE456/ProblemSets/Git/ECE_456/PS2/doc.tex @@ -332,19 +332,36 @@ File: q1a_eigenvals.png Graphic file (type png) Package pdftex.def Info: q1a_eigenvals.png used on input line 163. (pdftex.def) Requested size: 202.3529pt x 151.76526pt. - [3 ] [4] [5] [6] [7] [8] [9] (d:/Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\doc.aux) ) + [3 ] + +File: q1cii.png Graphic file (type png) + +Package pdftex.def Info: q1cii.png used on input line 276. +(pdftex.def) Requested size: 505.89pt x 379.42523pt. + [4] + +File: q1civ_fig1.png Graphic file (type png) + +Package pdftex.def Info: q1civ_fig1.png used on input line 304. +(pdftex.def) Requested size: 252.94499pt x 189.7102pt. + +File: q1civ_fig2.png Graphic file (type png) + +Package pdftex.def Info: q1civ_fig2.png used on input line 309. +(pdftex.def) Requested size: 252.94499pt x 189.7102pt. + [5 ] [6 ] [7] [8] [9] (d:/Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\doc.aux) ) Here is how much of TeX's memory you used: - 8336 strings out of 479618 - 125259 string characters out of 2865027 + 8355 strings out of 479618 + 125554 string characters out of 2865027 981750 words of memory out of 3000000 - 25401 multiletter control sequences out of 15000+200000 + 25417 multiletter control sequences out of 15000+200000 412866 words of font info for 64 fonts, out of 3000000 for 9000 1141 hyphenation exceptions out of 8191 68i,12n,75p,1278b,2408s stack positions out of 5000i,500n,10000p,200000b,50000s -Output written on d:/Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\doc.pdf (9 pages, 244757 bytes). +Output written on d:/Users\Speedee\Documents\University\Year5\Winter\ECE456\ProblemSets\Git\ECE_456\PS2\doc.pdf (9 pages, 307787 bytes). PDF statistics: - 104 PDF objects out of 1000 (max. 8388607) + 107 PDF objects out of 1000 (max. 8388607) 0 named destinations out of 1000 (max. 500000) - 11 words of extra memory for PDF output out of 10000 (max. 10000000) + 26 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/PS2/doc.pdf b/PS2/doc.pdf index b4853a9..67fa4ca 100644 Binary files a/PS2/doc.pdf and b/PS2/doc.pdf differ diff --git a/PS2/doc.synctex.gz b/PS2/doc.synctex.gz index b316ccf..87adc58 100644 Binary files a/PS2/doc.synctex.gz and b/PS2/doc.synctex.gz differ diff --git a/PS2/doc.tex b/PS2/doc.tex index 1e3993b..60ae7f5 100644 --- a/PS2/doc.tex +++ b/PS2/doc.tex @@ -155,7 +155,7 @@ legend({'Numerical','Analytical'},'Location','northwest'); \begin{subfigure}{0.4\linewidth} \centering \includegraphics[width=\textwidth]{q1a_1and50.png} - \caption{probability densities for \(n=1\)\\and \(n=50\).} + \caption{Probability densities for \(n=1\)\\and \(n=50\).} \label{fig:q3_ne} \end{subfigure}% \begin{subfigure}{0.4\linewidth} @@ -206,29 +206,38 @@ legend({'Numerical','Analytical'},'Location','northwest'); \item %1bii Starting with the normalization condition for the numerical case: - \begin{align*} - a\sum_{l=1}^N|\phi_l|^2 = a \\ - a\sum_{l=1}^N|B\sin{(\frac{n\pi}{L}x_l)}|^2 = a, - \end{align*} + \begin{align} + a\sum_{l=1}^N\left|\phi_l\right|^2 = a \\ + a\sum_{l=1}^N\left|B\sin{\left(\frac{n\pi}{L}x_l\right)}\right|^2 = a, + \label{eq:numerical_norm} + \end{align} recalling that \(x = al\), and allowing \(a \to 0\) while holding \(L\) constant implies that \(N \to \infty\), since \(a=\frac{L}{N}\). An integral is defined as the limit of a Riemann sum as follows: + \begin{equation} + \int_c^df(x)\:dx \equiv \lim_{n \to \infty}\sum_{i=1}^n\Delta x\cdot f(x_i). + \label{eq:Riemann_sum} + \end{equation} + where \(\Delta x = \frac{d-c}{n}\) and \(x_i = c + \Delta x \cdot i\). In our case, + \(n = N\), \(i = l\), \(c = 0\), \(d = L\), and \(\Delta x = a\), \(x_i = x_l\), + \(f(x) = \left|B\sin{\left(\frac{n\pi}{L}x\right)}\right|^2\). Therefore we can write \begin{equation*} - \int_a^bf(x)\:dx = \lim_{n \to \infty}\sum_{i=1}^n\Delta x\cdot f(x_i). + \int_0^L \left|B\sin{\left(\frac{n\pi}{L}x\right)}\right|^2\:dx + = \lim_{N \to \infty}\sum_{l=1}^N a \cdot \left|B\sin{\left(\frac{n\pi}{L}x_l\right)}\right|^2 + = a. \end{equation*} - - The output of the numerical sum will change, as the value of $\alpha$ changes, by a factor of $\alpha$. - To correct for this, we need to factor the result of the summation by $\alpha$, which corresponds to - - % Idk how to explain this at all, I need to chew on it internally and come back later. + Using (\ref{eq:integral_ident}), we have \begin{equation*} - foo + \int_0^L \left|B\sin{\left(\frac{n\pi}{L}x\right)}\right|^2\:dx + = \frac{1}{2}L - \cancel{\frac{L}{4n\pi}\sin{\left(\frac{2n\pi}{L}L\right)}} + - 0 + 0 + = \frac{a}{B^2}. \end{equation*} This means that B must be \begin{equation*} - B = \sqrt{\frac{2 \alpha}{L}} + B = \sqrt{\frac{2 a}{L}} = \sqrt{a} \times A. \end{equation*} \end{enumerate} @@ -266,7 +275,6 @@ legend({'Numerical','Analytical'},'Location','northwest'); \centering \includegraphics[width=\textwidth]{q1cii.png} \caption{Analytic solution to numeric system, plotted.} - \label{fig:q1b_electrons} \end{figure} We can see here that the "predicted" numerical response matches nearly exactly the actual @@ -288,18 +296,46 @@ legend({'Numerical','Analytical'},'Location','northwest'); \end{equation*} \item %1civ - \lipsum[1] + + \begin{figure}[H] + \centering + \begin{subfigure}{0.5\textwidth} + \centering + \includegraphics[width=\textwidth]{q1civ_fig1.png} + \caption{Probability densities for \(n=1\)\\and \(n=50\).} + \end{subfigure}% + \begin{subfigure}{0.5\textwidth} + \centering + \includegraphics[width=\textwidth]{q1civ_fig2.png} + \caption{Comparison of first 101 numerical and analytic eigenvalues.} + \end{subfigure} + \end{figure} + + % TODO idk if this is enough + With the decreased lattice spacing, and increased number of points, we can see the numerical solution + of eigenvalues matches the analytical solution much closer. As well, we can see that the probability + density function appears to be "squeezed" in the centre, for the $n = 50$ case. + \end{enumerate} \item %1d \begin{enumerate}[align=left,leftmargin=*,labelsep=0em,label=(\roman*)] \item %1di - \lipsum[1] + + In order to modify the computations to those for a particle in a "ring" + we simply had to add $-t_0$ elements as the "corner" elements of the + hamiltonian operator array. + + % TODO do we need a listing here + \item %1dii - \lipsum[1] + + \item %1diii - \lipsum[1] + + \item %1div - \lipsum[1] + + \end{enumerate} \end{enumerate} diff --git a/PS2/q1d.m b/PS2/q1d.m new file mode 100644 index 0000000..a3412ea --- /dev/null +++ b/PS2/q1d.m @@ -0,0 +1,60 @@ +clear all; +%physical constants in MKS units + +hbar = 1.054e-34; +q = 1.602e-19; +m = 9.110e-31; + +%generate lattice + +N = 100; %number of lattice points +n = [1:N]; %lattice points +a = 1e-10; %lattice constant +x = a * n; %x-coordinates +t0 = (hbar^2)/(2*m*a^2)/q; %encapsulating factor +L = a * (N+1); %total length of consideration + +%set up Hamiltonian matrix + +U = 0*x; %0 potential at all x +main_diag = diag(2*t0*ones(1,N)+U,0); %create main diagonal matrix +lower_diag = diag(-t0*ones(1,N-1),-1); %create lower diagonal matrix +upper_diag = diag(-t0*ones(1,N-1),+1); %create upper diagonal matrix + +H = main_diag + lower_diag + upper_diag; %sum to get Hamiltonian matrix + +% Modify hamiltonian for circular boundary conditions +H(1, N) = -t0; +H(N, 1) = -t0; + +[eigenvectors,E_diag] = eig(H); %"eigenvectors" is a matrix wherein each column is an eigenvector + %"E_diag" is a diagonal matrix where the + %corresponding eigenvalues are on the + %diagonal. + +E_col = diag(E_diag); %folds E_diag into a column vector of eigenvalues + +% return eigenvectors for the 1st and 50th eigenvalues + +phi_4 = eigenvectors(:,4); +phi_5 = eigenvectors(:,5); + +% find the probability densities of position for 1st and 50th eigenvectors + +P_4 = phi_4 .* conj(phi_4); +P_5 = phi_5 .* conj(phi_5); + +% Find first N analytic eigenvalues +E_col_analytic = (1/q) * (hbar^2 * pi^2 * n.*n) / (2*m*L^2); + +% Plot the probability densities for 1st and 50th eigenvectors + +figure(1); clf; h = plot(x,P_4,'kx',x,P_5,'k-'); +grid on; set(h,'linewidth',[2.0]); set(gca,'Fontsize',[18]); +xlabel('POSITION [m]'); ylabel('PROBABILITY DENSITY [1/m]'); +legend('n=4','n=5'); + +% Plot numerical eigenvalues +figure(2); clf; h = plot(n,E_col,'kx'); grid on; +set(h,'linewidth',[2.0]); set(gca,'Fontsize',[18]); +xlabel('EIGENVALUE NUMBER'); ylabel('ENERGY [eV]');