200 lines
6.2 KiB
TeX
200 lines
6.2 KiB
TeX
\documentclass[english,notitlepage]{revtex4-1} % defines the basic parameters of the document
|
|
%For preview: skriv i terminal: latexmk -pdf -pvc filnavn
|
|
|
|
|
|
|
|
% if you want a single-column, remove reprint
|
|
|
|
% allows special characters (including æøå)
|
|
\usepackage[utf8]{inputenc}
|
|
%\usepackage[english]{babel}
|
|
|
|
%% note that you may need to download some of these packages manually, it depends on your setup.
|
|
%% I recommend downloading TeXMaker, because it includes a large library of the most common packages.
|
|
|
|
\usepackage{physics,amssymb} % mathematical symbols (physics imports amsmath)
|
|
\include{amsmath}
|
|
\usepackage{graphicx} % include graphics such as plots
|
|
\usepackage{xcolor} % set colors
|
|
\usepackage{hyperref} % automagic cross-referencing (this is GODLIKE)
|
|
\usepackage{listings} % display code
|
|
\usepackage{subfigure} % imports a lot of cool and useful figure commands
|
|
\usepackage{float}
|
|
%\usepackage[section]{placeins}
|
|
\usepackage{algorithm}
|
|
\usepackage[noend]{algpseudocode}
|
|
\usepackage{subfigure}
|
|
\usepackage{tikz}
|
|
\usetikzlibrary{quantikz}
|
|
% defines the color of hyperref objects
|
|
% Blending two colors: blue!80!black = 80% blue and 20% black
|
|
\hypersetup{ % this is just my personal choice, feel free to change things
|
|
colorlinks,
|
|
linkcolor={red!50!black},
|
|
citecolor={blue!50!black},
|
|
urlcolor={blue!80!black}}
|
|
|
|
%% Defines the style of the programming listing
|
|
%% This is actually my personal template, go ahead and change stuff if you want
|
|
|
|
|
|
|
|
%% USEFUL LINKS:
|
|
%%
|
|
%% UiO LaTeX guides: https://www.mn.uio.no/ifi/tjenester/it/hjelp/latex/
|
|
%% mathematics: https://en.wikibooks.org/wiki/LaTeX/Mathematics
|
|
|
|
%% PHYSICS ! https://mirror.hmc.edu/ctan/macros/latex/contrib/physics/physics.pdf
|
|
|
|
%% the basics of Tikz: https://en.wikibooks.org/wiki/LaTeX/PGF/Tikz
|
|
%% all the colors!: https://en.wikibooks.org/wiki/LaTeX/Colors
|
|
%% how to draw tables: https://en.wikibooks.org/wiki/LaTeX/Tables
|
|
%% code listing styles: https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings
|
|
%% \includegraphics https://en.wikibooks.org/wiki/LaTeX/Importing_Graphics
|
|
%% learn more about figures https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
|
|
%% automagic bibliography: https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management (this one is kinda difficult the first time)
|
|
%% REVTeX Guide: http://www.physics.csbsju.edu/370/papers/Journal_Style_Manuals/auguide4-1.pdf
|
|
%%
|
|
%% (this document is of class "revtex4-1", the REVTeX Guide explains how the class works)
|
|
|
|
|
|
%% CREATING THE .pdf FILE USING LINUX IN THE TERMINAL
|
|
%%
|
|
%% [terminal]$ pdflatex template.tex
|
|
%%
|
|
%% Run the command twice, always.
|
|
%% If you want to use \footnote, you need to run these commands (IN THIS SPECIFIC ORDER)
|
|
%%
|
|
%% [terminal]$ pdflatex template.tex
|
|
%% [terminal]$ bibtex template
|
|
%% [terminal]$ pdflatex template.tex
|
|
%% [terminal]$ pdflatex template.tex
|
|
%%
|
|
%% Don't ask me why, I don't know.
|
|
|
|
\begin{document}
|
|
|
|
\title{Project 1} % self-explanatory
|
|
\author{Cory Balaton \& Janita Willumsen} % self-explanatory
|
|
\date{\today} % self-explanatory
|
|
\noaffiliation % ignore this, but keep it.
|
|
|
|
|
|
\maketitle
|
|
|
|
\textit{https://github.uio.no/FYS3150-G2-2023/Project-1}
|
|
|
|
\section*{Problem 1}
|
|
|
|
\begin{align*}
|
|
u(x) &= \int \int \frac{d^2 u}{dx^2} dx^2\\
|
|
&= \int \int -100 e^{-10x} dx^2 \\
|
|
&= \int \frac{-100 e^{-10x}}{-10} + c_1 dx \\
|
|
&= \int 10 e^{-10x} + c_1 dx \\
|
|
&= \frac{10 e^{-10x}}{-10} + c_1 x + c_2 \\
|
|
&= -e^{-10x} + c_1 x + c_2
|
|
\end{align*}
|
|
|
|
Using the boundary conditions, we can find $c_1$ and $c_2$ as shown below:
|
|
|
|
\begin{align*}
|
|
u(0) &= 0 \\
|
|
-e^{-10 \cdot 0} + c_1 \cdot 0 + c_2 &= 0 \\
|
|
-1 + c_2 &= 0 \\
|
|
c_2 &= 1
|
|
\end{align*}
|
|
|
|
\begin{align*}
|
|
u(1) &= 0 \\
|
|
-e^{-10 \cdot 1} + c_1 \cdot 1 + c_2 &= 0 \\
|
|
-e^{-10} + c_1 + c_2 &= 0 \\
|
|
c_1 &= e^{-10} - c_2\\
|
|
c_1 &= e^{-10} - 1\\
|
|
\end{align*}
|
|
|
|
Using the values that we found for $c_1$ and $c_2$, we get
|
|
|
|
\begin{align*}
|
|
u(x) &= -e^{-10x} + (e^{-10} - 1) x + 1 \\
|
|
&= 1 - (1 - e^{-10}) - e^{-10x}
|
|
\end{align*}
|
|
|
|
\section*{Problem 2}
|
|
|
|
% Write which .cpp/.hpp/.py (using a link?) files are relevant for this and show the plot generated.
|
|
|
|
\section*{Problem 3}
|
|
|
|
To derive the discretized version of the Poisson equation, we first need
|
|
the taylor expansion for $u(x)$ around $x + h$ and $x - h$.
|
|
|
|
\begin{align*}
|
|
u(x+h) &= u(x) + u'(x) h + \frac{1}{2} u''(x) h^2 + \frac{1}{6} u'''(x) h^3 + \mathcal{O}(h^4)
|
|
\end{align*}
|
|
|
|
\begin{align*}
|
|
u(x-h) &= u(x) - u'(x) h + \frac{1}{2} u''(x) h^2 - \frac{1}{6} u'''(x) h^3 + \mathcal{O}(h^4)
|
|
\end{align*}
|
|
|
|
If we add the equations above, we get this new equation:
|
|
|
|
\begin{align*}
|
|
u(x+h) + u(x-h) &= 2 u(x) + u''(x) h^2 + \mathcal{O}(h^4) \\
|
|
u(x+h) - 2 u(x) + u(x-h) + \mathcal{O}(h^4) &= u''(x) h^2 \\
|
|
u''(x) &= \frac{u(x+h) - 2 u(x) + u(x-h)}{h^2} + \mathcal{O}(h^2) \\
|
|
u_i''(x) &= \frac{u_{i+1} - 2 u_i + u_{i-1}}{h^2} + \mathcal{O}(h^2) \\
|
|
\end{align*}
|
|
|
|
We can then replace $\frac{d^2u}{dx^2}$ with the RHS (right-hand side) of the equation:
|
|
|
|
\begin{align*}
|
|
- \frac{d^2u}{dx^2} &= 100 e^{-10x} \\
|
|
\frac{ - u_{i+1} + 2 u_i - u_{i-1}}{h^2} + \mathcal{O}(h^2) &= 100 e^{-10x} \\
|
|
\end{align*}
|
|
|
|
And lastly, we leave out $\mathcal{O}(h^2)$ and change $u_i$ to $v_i$ to
|
|
differentiate between the exact solution and the approximate solution,
|
|
and get the discretized version of the equation:
|
|
|
|
\begin{align*}
|
|
align* \frac{ - u_{i+1} + 2 u_i - u_{i-1}}{h^2} &= 100 e^{-10x} \\
|
|
\end{align*}
|
|
|
|
\section*{Problem 4}
|
|
|
|
% Show that each iteration of the discretized version naturally creates a matrix equation.
|
|
|
|
\section*{Problem 5}
|
|
|
|
\subsection*{a)}
|
|
|
|
\subsection*{b)}
|
|
|
|
\section*{Problem 6}
|
|
|
|
\subsection*{a)}
|
|
|
|
% Use Gaussian elimination, and then use backwards substitution to solve the equation
|
|
|
|
\subsection*{b)}
|
|
|
|
% Figure it out
|
|
|
|
\section*{Problem 7}
|
|
|
|
% Link to relevant files on gh and possibly add some comments
|
|
|
|
\section*{Problem 8}
|
|
|
|
%link to relvant files and show plots
|
|
|
|
\section*{Problem 9}
|
|
|
|
% Show the algorithm, then calculate FLOPs, then link to relevant files
|
|
|
|
\section*{Problem 10}
|
|
|
|
% Time and show result, and link to relevant files
|
|
|
|
\end{document}
|