<commit_before>\documentclass[a4paper,11pt, english, twoside, twocolumn]{article}
% Engine-specific settings
% Detect pdftex/xetex/luatex, and load appropriate font packages.
% This is inspired by the approach in the iftex package.
% pdftex:
\ifx\pdfmatch\undefined
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
\fi
% xetex:
\ifx\XeTeXinterchartoks\undefined
\else
    \usepackage{fontspec}
    \defaultfontfeatures{Ligatures=TeX}
\fi
% luatex:
\ifx\directlua\undefined
\else
    \usepackage{fontspec}
\fi
% End engine-specific settings
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, sortcites]{biblatex}
\usepackage{url}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames,svgnames, table]{xcolor}
\usepackage[font={scriptsize}]{caption}
\usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage{tikz} \usepackage{float}
\usepackage[procnames]{listings}
\usepackage{pstool} \usepackage{pgfplots}
\usepackage{wrapfig} \usepackage{graphicx} \usepackage{epstopdf}
\usepackage{afterpage}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{algorithm}
\usepackage{microtype}
\usepackage[noend]{algpseudocode}
\usepackage{xcolor,colortbl}
\usepackage{microtype}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pdfpages}
\usepackage{lipsum}
\usepackage{pythontex}
\usepackage{authblk}
\floatstyle{plaintop}
\restylefloat{table}


\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}
\definecolor{Gray}{gray}{0.90}
\definecolor{LightCyan}{rgb}{0.88,1,1}

\newcolumntype{a}{>{\columncolor{Gray}}c}
\newcolumntype{b}{>{\columncolor{white}}c}
\definecolor{tablecolor}{gray}{0.95}
\definecolor{tabletext}{gray}{0.0}
\definecolor{tablerule}{gray}{0.7}
\definecolor{titlepagecolor}{cmyk}{1,.60,0,.40}
\definecolor{namecolor}{cmyk}{1,.50,0,.10} 

% Custom commands
\newcommand{\unit}[1]{\:\mathrm{#1}}
\newcommand{\noref}[1]{\hyperref[#1]{\ref*{#1}}}
\newcommand{\nonref}[1]{\hyperref[]{\ref*{#1}}}
\newcommand\blankpage{%
  \null
  \thispagestyle{empty}%
  \addtocounter{page}{-1}%
  \newpage}

% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{7} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{7}  % for normal

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

\title{Project 1}

% Biber for references
\addbibresource{references.bib}

\begin{document}
\author[1]{<NAME>}
\author[2]{<NAME>}
\author[3]{<NAME>}
\affil[1,2,3]{Oslo University}
\maketitle

\begin{abstract}

\end{abstract}

% Get all of the data from the script into a dictionary
\begin{pycode}
from subprocess import Popen, PIPE
from latextools import untag_all
p = Popen(['python', '../analysis/analyze.py', '../cpp'],
stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
data = output.decode('utf8')
latex_data = untag_all(data)
\end{pycode}

\begin{table}[ht]
  \centering
  \pyc{print(latex_data['error_table'])}
  \caption{Summary of the errors}
  \label{tab:error}
\end{table}

\begin{figure}[ht]
  \centering
  \includegraphics[scale=0.5]{figures/function.eps}
  \caption{\label{fig:general} Caption}
\end{figure}

\end{document}<commit_msg>Worked on report<commit_after>\documentclass[a4paper,11pt, english, twoside, twocolumn]{article}
% Engine-specific settings
% Detect pdftex/xetex/luatex, and load appropriate font packages.
% This is inspired by the approach in the iftex package.
% pdftex:
\ifx\pdfmatch\undefined
\else
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
\fi
% xetex:
\ifx\XeTeXinterchartoks\undefined
\else
    \usepackage{fontspec}
    \defaultfontfeatures{Ligatures=TeX}
\fi
% luatex:
\ifx\directlua\undefined
\else
    \usepackage{fontspec}
\fi
% End engine-specific settings
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, sortcites]{biblatex}
\usepackage{url}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames,svgnames, table]{xcolor}
\usepackage[font={scriptsize}]{caption}
\usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage{tikz} \usepackage{float}
\usepackage[procnames]{listings}
\usepackage{pstool} \usepackage{pgfplots}
\usepackage{wrapfig} \usepackage{graphicx} \usepackage{epstopdf}
\usepackage{afterpage}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{algorithm}
\usepackage{microtype}
\usepackage[noend]{algpseudocode}
\usepackage{xcolor,colortbl}
\usepackage{microtype}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pdfpages}
\usepackage{lipsum}
\usepackage{pythontex}
\usepackage{authblk}
\floatstyle{plaintop}
\restylefloat{table}


\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}
\definecolor{Gray}{gray}{0.90}
\definecolor{LightCyan}{rgb}{0.88,1,1}

\newcolumntype{a}{>{\columncolor{Gray}}c}
\newcolumntype{b}{>{\columncolor{white}}c}
\definecolor{tablecolor}{gray}{0.95}
\definecolor{tabletext}{gray}{0.0}
\definecolor{tablerule}{gray}{0.7}
\definecolor{titlepagecolor}{cmyk}{1,.60,0,.40}
\definecolor{namecolor}{cmyk}{1,.50,0,.10}

% Custom commands
\newcommand{\unit}[1]{\:\mathrm{#1}}
\newcommand{\noref}[1]{\hyperref[#1]{\ref*{#1}}}
\newcommand{\nonref}[1]{\hyperref[]{\ref*{#1}}}
\newcommand\blankpage{%
  \null
  \thispagestyle{empty}%
  \addtocounter{page}{-1}%
  \newpage}

% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{7} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{7}  % for normal

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

\title{Project 1}

% Biber for references
\addbibresource{references.bib}

\begin{document}
\author[1]{<NAME>}
\author[2]{<NAME>}
\author[3]{<NAME>}
\affil[1,2,3]{Oslo University}
\maketitle

\begin{abstract}
  In this project we investigate the speed and numerical precision of several methods
  of solving the one-dimensional Poisson equation with Dirchelet boundary conditions.
  The equation is discretized and written as a system of linear equations. This equates to
  a tridiagonal matrix equation, which is solved using the general Thomas algorithm,
  a specialized version of the Thomas algorithm and by LU-decomposing the matrix.

  The specialization of the algorithm for our specific problem resulted in
  a x percent reduction in computation time.
\end{abstract}

% Get all of the data from the script into a dictionary
\begin{pycode}
from subprocess import Popen, PIPE
from latextools import untag_all
p = Popen(['python', '../analysis/analyze.py', '../cpp'],
stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
data = output.decode('utf8')
latex_data = untag_all(data)
\end{pycode}

\begin{table}[ht]
  \centering
  \pyc{print(latex_data['error_table'])}
  \caption{Summary of the errors}
  \label{tab:error}
\end{table}

\begin{figure}[ht]
  \centering
  \includegraphics[scale=0.5]{figures/function.eps}
  \caption{\label{fig:general} Caption}
\end{figure}

\section{Theory}
\subsection{Discretizing the Poisson equation}
The one-dimensional Poisson equation with Dirchelet boundary conditions is
\begin{align*}
  \frac{d^2 u}{d x^2} = - f
\end{align*}
We can approximate the second derivative of $u(x)$ using a Taylor expansion
and solving for $\frac{d^2 u}{d x^2}$:
\begin{align*}
  \frac{d^2 u}{d x^2} \approx \frac{u(x+h) + u(x-h) - 2 u(x)}{h^2} + O(h^2)
\end{align*}
We now discretize the equation with grid points $x_1, x_2, \hdots, x_{n}$. Imposing
Dirchelet boundary conditions forces $x_1 = x_n = 0$, using the handy notation
$u(x_i + h) = u_{i+1}$ and inserting the approximated second derivative into the
Poisson equation yields
\begin{align*}
  \frac{u_{i+1} + u_{i-1} - 2 u_i}{h^2} = -f_i
\end{align*}
where $h = \frac{1}{n+1}$ is the step size, i.e. the distance between grid points, and
$f_i = f(x_i)$.
The above equation is a linear system of equations, and can therefore be written
as the matrix equation
\begin{align*}
  A \mathbf{u} = -h^2 \mathbf{f}
\end{align*}
where
\begin{align*}
  A =
  \begin{bmatrix}
    2 & -1 & 0  & \hdots & \hdots &   0    \\
    -1 & 2 & -1 & 0      & &\vdots \\
    0 & -1 & 2  & -1     & 0 &  \\
    \vdots & 0 & -1  & 2     & -1 & 0 \\
    & & \ddots & \ddots & \ddots & \vdots\\
    0 & \hdots  &\hdots & 0 &-1 & 2 \\
\end{bmatrix}
\end{align*}
is a $n \times n$ tridiagonal matrix, the only non-zero elements are on,
directly above or directly below the diagonal. Row reducing the matrix can therefore
be done in an efficient way using the Thomas algorithm, as we shall see in the next paragraph.
\subsection{Solving a general tridiagonal matrix problem}
A general tridiagonal matrix equation is on the form
\begin{align*}
  \begin{bmatrix}
    b_1 & c_1 & 0  & \hdots & \hdots &   0    \\
    a_2 & b_2 & c_2 & 0      & &\vdots \\
    0 & a_3 & b_3  & c_3     & 0 &  \\
    \vdots & 0 & a_4  & b_4     & c_4 & 0 \\
    & & \ddots & \ddots & \ddots & \vdots\\
    0 & \hdots  &\hdots & 0 &a_n & b_n \\
  \end{bmatrix}
  \begin{bmatrix}
    u_1 \\ u_2 \\ u_3 \\ \vdots \\ \\ u_n
  \end{bmatrix}
  =
  \begin{bmatrix}
    v_1 \\ v_2 \\ v_3 \\ \vdots \\ \\ v_n
  \end{bmatrix}
\end{align*}
where $v_i = h^2 f_i$ in the case examined in this project. To get the matrix
in row reduced echelon form and solve the problem, we first eliminate the $a_i$'s.
This is done by subtracting $\frac{a_2}{b_1}$ times the first row from the second.
We now have
\begin{align*}
  \begin{bmatrix}
    b_1 & c_1 & 0  & \hdots & \hdots &   0    \\
    0 & b'_2 & c_2 & 0      & &\vdots \\
    0 & a_3 & b_3  & c_3     & 0 &  \\
    \vdots & 0 & a_4  & b_4     & c_4 & 0 \\
    & & \ddots & \ddots & \ddots & \vdots\\
    0 & \hdots  &\hdots & 0 &a_n & b_n \\
  \end{bmatrix}
  \begin{bmatrix}
    u_1 \\ u_2 \\ u_3 \\ \vdots \\ \\ u_n
  \end{bmatrix}
  =
  \begin{bmatrix}
    v_1 \\ v'_2 \\ v_3 \\ \vdots \\ \\ v_n
  \end{bmatrix}
\end{align*}
where $b'_2 = b_2 - \frac{a_2}{b_1} c_1$ and $v'_2 = v_2 - \frac{a_2}{b_1}v_1$.
We now repeat this operation for every row (i.e. subtract $\frac{a_i}{b'_{i-1}}$ times row $i-1$ from row $i$), which eliminates the $a_i$'s.
A general expression for the diagonal elements is therefore
\begin{align*}
  b'_i = b_i - \frac{a_i}{b'_{i-1}}c_{i-1}
\end{align*}
where $b'_1 = b_1$ and $i = 2,3,...,n$. Similarly, elements in the rhs vector
$\mathbf{v}'$ are
\begin{align*}
  v'_{i} = v_i - \frac{a_i}{b'_{i-1}}v_{i-1}
\end{align*}
Now, dividing each row by its $b'_i$, A is in row reduced form. 
\end{document}
{'fraction_non_alphanumeric': 0.16485424472265375, 'fraction_numerical': 0.021931828566206707, 'mean_word_length': 4.580826109127996, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '632559', 'n_tokens_mistral': 4241, 'n_tokens_neox': 4005, 'n_words': 909}