\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{center}
  \section*{Project 2}
  Math 400, Spring 2025 \\
  Due Wed 05/07 \\
  Uzair Hamed Mohammed
\end{center}

\begin{enumerate}
  \item[1.] This is a problem on Gaussian quadrature and related things.
    \begin{enumerate}
      \item[a.] Explain the principle of the Gaussian quadrature.

        \underline{Sol}:\\
        The Gaussian quadrature principle selects \( n \) nodes \(
        x_i \) and weights \( c_i \) such that the formula
        \(\int_{-1}^{1} f(x) \, dx \approx \sum_{i=0}^{n-1} c_i
        f(x_i)\) is exact for polynomials of the highest possible
        degree. For \( n \) nodes, it achieves exactness for
        polynomials up to degree \( 2n-1 \). The nodes are roots of
        orthogonal polynomials such as the Legendre polynomials, and
        the weights ensure exact integration for lower-degree polynomials.

      \item[b.] Show that the Gaussian quadrature \(\int_{-1}^{1}
        f(x) dx = c_0 f(x_0) + c_1 f(x_1)\) can be exact for all
        polynomials of degree 3 with 2 points \(x_0 = -
        \frac{1}{\sqrt{3}}\) and \(x_1 = \frac{1}{\sqrt{3}}\). Find
        \(c_0\) and \(c_1\) as well.

        \underline{Sol}:
        \begin{itemize}
          \item For \( f(x) = 1 \):
            \[
              \int_{-1}^{1} 1 \, dx = 2 \implies c_0 + c_1 = 2
            \]
          \item For \( f(x) = x \):
            \[
              \int_{-1}^{1} x \, dx = 0 \implies c_0
              \left(-\frac{1}{\sqrt{3}}\right) + c_1
              \left(\frac{1}{\sqrt{3}}\right) = 0 \implies c_0 = c_1
            \]
        \end{itemize}
        Solving \( c_0 + c_1 = 2 \) and \( c_0 = c_1 \), we get \(
        c_0 = c_1 = 1 \).
        \begin{itemize}
          \item Verification for \( f(x) = x^2 \):
            \[
              \int_{-1}^{1} x^2 \, dx = \frac{2}{3} \quad \text{and}
              \quad 1 \cdot \left(\frac{1}{\sqrt{3}}\right)^2 + 1
              \cdot \left(-\frac{1}{\sqrt{3}}\right)^2 = \frac{2}{3}
            \]
          \item Verification for \( f(x) = x^3 \):
            \[
              \int_{-1}^{1} x^3 \, dx = 0 \quad \text{and} \quad 1
              \cdot \left(\frac{1}{\sqrt{3}}\right)^3 + 1 \cdot
              \left(-\frac{1}{\sqrt{3}}\right)^3 = 0
            \]
        \end{itemize}
        From this, we get:
        \[
          \boxed{c_0 = 1}, \quad \boxed{c_1 = 1}
        \]

      \item[c.] Determine the values of \(c_i\) and \(x_i, i = 0, 1\)
        so that the quadrature formula \(\int_{-1}^{1} x^2 f(x) dx =
        c_0 f(x_0) + c_1 f(x_1)\) will be exact for all polynomials of degree 3.

        \begin{itemize}
          \item For \( f(x) = 1 \):
            \[
              \int_{-1}^{1} x^2 \, dx = \frac{2}{3} = c_0 + c_1
              \implies c_0 + c_1 = \frac{2}{3}
            \]
          \item For \( f(x) = x \):
            \[
              \int_{-1}^{1} x^3 \, dx = 0 = c_0 x_0 + c_1 x_1
            \]
          \item For \( f(x) = x^2 \):
            \[
              \int_{-1}^{1} x^4 \, dx = \frac{2}{5} = c_0 x_0^2 + c_1 x_1^2
            \]
          \item For \( f(x) = x^3 \):
            \[
              \int_{-1}^{1} x^5 \, dx = 0 = c_0 x_0^3 + c_1 x_1^3
            \]
        \end{itemize}
        Assume symmetry \( x_1 = -x_0 \). Then \( c_0 = c_1 \), and
        \( c_0 = c_1 = \frac{1}{3} \). Substituting into \( c_0 x_0^2
        + c_1 x_1^2 = \frac{2}{5} \):
        \[
          \frac{2}{3} x_0^2 = \frac{2}{5} \implies x_0 = \sqrt{\frac{3}{5}}
        \]
        \[
          \boxed{c_0 = \frac{1}{3}}, \quad \boxed{c_1 = \frac{1}{3}},
          \quad \boxed{x_0 = \sqrt{\frac{3}{5}}}, \quad \boxed{x_1 =
          -\sqrt{\frac{3}{5}}}
        \]
    \end{enumerate}

  \item[2.] Mass spectrometry analysis gives a series of peak height
    readings for various ion masses. For each peak,
    the height \(h_i\) is contributed to by various constituents
    (measured by the index \(j\)). The \(j^{th}\) component
    with per unit concentration \(p_j\) makes the contribution
    \(c_{ij}\) to the \(i^{th}\) peak, so that the relation
    \(h_i = \sum_{j=1}^{n} c_{ij} p_j\) holds. \(n\) is the number of
    components present. Carnahan (1964) gives the \(c_{ij}\) values
    shown in the table below:

    \[
      \begin{array}{|c|c|c|c|c|c|c|}
        \hline
        \textrm{Peak number} & \textrm{Unknown} & CH_4 & C_2 H_4 &
        C_2 H_6 & C_3 H_6 & C_3 H_8 \\
        \hline
        1 & & 0.165 & 0.202 & 0.317 & 0.234 & 0.182 \\
        2 & & 27.7 & 0.862 & 0.062 & 0.073 & 0.131 \\
        3 & & & 22.35 & 13.05 & 4.42 & 6.001 \\
        4 & & & & 11.28 & 0 & 1.11 \\
        5 & & & & & 9.85 & 1.684 \\
        \hline
      \end{array}
    \]

    If a sample had measured peak heights \(h_i = 5.20, h_2 = 61.7,
    h_3 = 149.2, h_4 = 79.4\), and \(h_5 = 89.3\). Calculate the
    values of \(p_j\) for each component. The total of all the
    \(p_j\) values was 51.53. Use Jacobi's and Gauss-Seidel iteration
    approaches, till adjacent iterations is within \(10^{-6}\).

    \textbf{Requirements}: Rearrange the measurements to take
    advantages of the principle and strength of each iteration method.

    \underline{Sol}:\\

    \boxed{
      \begin{aligned}
        \text{Unknown} & : \boxed{30.0696} \\
        \text{CH}_4 & : \boxed{2.1701} \\
        \text{C}_2\text{H}_4 & : \boxed{0.0000} \\
        \text{C}_2\text{H}_6 & : \boxed{6.6100} \\
        \text{C}_3\text{H}_6 & : \boxed{8.3206} \\
        \text{C}_3\text{H}_8 & : \boxed{4.3597} \\
        \text{Total} & : \boxed{51.53}
      \end{aligned}
    }
\end{enumerate}

\end{document}
