Aufgabe2.tex 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. \section*{Aufgabe 2}
  2. \subsection*{Teilaufgabe a}
  3. \textbf{Aufgabe}
  4. Formulieren Sie einen Algorithmus in Pseudocode zum Lösen des Gleichungssystems
  5. \[Ly = b,\]
  6. wobei $L$ eine invertierbare, untere Dreiecksmatrix ist.
  7. Geben Sie die Formel zur Berechnung von $y_i$ an.
  8. \textbf{Lösung:}
  9. \[y_i = \frac{b_i - \sum_{k=1}^{i-1} l_{ik} \cdot y_k}{l_{ii}}\]
  10. \begin{algorithm}[H]
  11. \begin{algorithmic}
  12. \Require Lower, invertable, triangular Matrix $L \in \mathbb{R}^{n \times n}$, Vektor $b$
  13. \Procedure{solve}{$L$, $b$}
  14. \For{$i \in \Set{1, \dots n}$}
  15. \State $y_i \gets b_i$
  16. \For{$k \in \Set{1, \dots, i-1}$}
  17. \State $y_i \gets y_i - l_{ik} \cdot y_k$
  18. \EndFor
  19. \State $y_i \gets \frac{y_i}{l_{ii}}$
  20. \EndFor
  21. \EndProcedure
  22. \end{algorithmic}
  23. \caption{Calculate $y$ in $Ly = b$}
  24. \end{algorithm}
  25. \subsection*{Teilaufgabe b}
  26. \[Ax = b \Leftrightarrow PAx = Pb \Leftrightarrow LRx = Pb \]
  27. \begin{algorithm}[H]
  28. \begin{algorithmic}
  29. \Require Matrix $A$, Vektor $b$
  30. \Procedure{LoeseLGS}{$A$, $b$}
  31. \State $P, L, R \gets \Call{LRZer}{A}$
  32. \State $b^* \gets P \cdot b$
  33. \State $c \gets \Call{VorSub}{L, b^*}$
  34. \State $x \gets \Call{RueckSub}{R, c}$
  35. \State \Return $x$
  36. \EndProcedure
  37. \end{algorithmic}
  38. \caption{Löse ein LGS $Ax = b$}
  39. \end{algorithm}
  40. \subsection*{Teilaufgabe c}
  41. Der Gesamtaufwand ist:
  42. \begin{itemize}
  43. \item LR-Zerlegung, $\frac{1}{3}n^3 - \frac{1}{3} n^2$
  44. \item Vektormultiplikation, $2n$
  45. \item Vorwärtssubstitution, $\frac{1}{2} n^2$
  46. \item Rückwärtssubstitution, $\frac{1}{2} n^2$
  47. \end{itemize}