Compare commits
7 Commits
11-set-up-
...
3-solve-pr
| Author | SHA1 | Date | |
|---|---|---|---|
| 327af48e73 | |||
| 450e1859b1 | |||
| 0430b0fcf0 | |||
| 2f9a39021b | |||
| c86c1dc73b | |||
| cadee04b9f | |||
| ab06e99c0d |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -30,3 +30,9 @@
|
|||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
|
|
||||||
|
# Latex
|
||||||
|
*.aux
|
||||||
|
*.log
|
||||||
|
*.out
|
||||||
|
*.bib
|
||||||
|
|||||||
BIN
latex/assignment_1.pdf
Normal file
BIN
latex/assignment_1.pdf
Normal file
Binary file not shown.
@@ -74,8 +74,8 @@
|
|||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\title{Title of the document} % self-explanatory
|
\title{Project 1} % self-explanatory
|
||||||
\author{Cory Balaton \& Janita} % self-explanatory
|
\author{Cory Balaton \& Janita Willumsen} % self-explanatory
|
||||||
\date{\today} % self-explanatory
|
\date{\today} % self-explanatory
|
||||||
\noaffiliation % ignore this, but keep it.
|
\noaffiliation % ignore this, but keep it.
|
||||||
|
|
||||||
@@ -86,7 +86,38 @@
|
|||||||
|
|
||||||
\section*{Problem 1}
|
\section*{Problem 1}
|
||||||
|
|
||||||
% Do the double integral
|
\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}
|
\section*{Problem 2}
|
||||||
|
|
||||||
@@ -94,7 +125,40 @@
|
|||||||
|
|
||||||
\section*{Problem 3}
|
\section*{Problem 3}
|
||||||
|
|
||||||
% Show how it's derived and where we found the derivation.
|
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}
|
\section*{Problem 4}
|
||||||
|
|
||||||
@@ -106,9 +170,9 @@
|
|||||||
|
|
||||||
\subsection*{b)}
|
\subsection*{b)}
|
||||||
|
|
||||||
\section{Problem 6}
|
\section*{Problem 6}
|
||||||
|
|
||||||
\subsection{a)}
|
\subsection*{a)}
|
||||||
|
|
||||||
% Use Gaussian elimination, and then use backwards substitution to solve the equation
|
% Use Gaussian elimination, and then use backwards substitution to solve the equation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user