hw4: preparing for submission

This commit is contained in:
Claudio Maggioni 2020-05-17 12:27:11 +02:00
parent 631cd8d993
commit 2d2ad2a07d
2 changed files with 35 additions and 25 deletions

Binary file not shown.

View file

@ -89,7 +89,7 @@ $$y = y (x - x_0) + a_0 = -\frac{23}{6} \cdot 0.5 + 0 = -\frac{23}{12}$$
\section*{Question 4} \section*{Question 4}
\subsection*{Point a)} \subsection*{Point a)}
The node coordinates to which fix the quadratic spline are $(1/2, y_0), (1, y_1),(3/2, y_2),(2, y_3)$. The node coordinates to which fix the quadratic spline are $(1/2, y_0), (3/2, y_1),(5/2, y_2),(7/2, y_3)$.
Then, we can start formulating the equations for the linear system: Then, we can start formulating the equations for the linear system:
@ -100,40 +100,38 @@ $$y_0 = s\left(\frac{1}{2}\right) = a_{-1}B_2\left(\frac{1}{2} + 1\right) + a_{0
+ a_{1}B_2\left(\frac{1}{2} - 5\right)=$$$$ + a_{1}B_2\left(\frac{1}{2} - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot \frac{1}{2} + a_{1} \cdot \frac{1}{2} + a_{2} \cdot 0 + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 = \frac{a_0 + a_1}{2}$$ a_{-1} \cdot 0 + a_{0} \cdot \frac{1}{2} + a_{1} \cdot \frac{1}{2} + a_{2} \cdot 0 + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 = \frac{a_0 + a_1}{2}$$
$$y_1 = s\left(1\right) = a_{-1}B_2\left(1 + 1\right) + a_{0}B_2\left(1\right) + a_{1}B_2\left(1 - 1\right) + $$$$ $$y_1 = s\left(\frac{3}{2}\right) = a_{-1}B_2\left(\frac{3}{2} + 1\right) + a_{0}B_2\left(\frac{3}{2}\right) + a_{1}B_2\left(\frac{3}{2} - 1\right) + $$$$
+ a_{2}B_2\left(1 - 2\right)
+ a_{-1}B_2\left(1 - 3\right)
+ a_{0}B_2\left(1 - 4\right)
+ a_{1}B_2\left(1 - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot \left(\frac{1}{8}\right) + a_{1} \cdot \frac{3}{4} + a_{2} \cdot \left(\frac{1}{8}\right) + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 =
\frac{1}{8} a_{0} + \frac{3}{4} a_{1} + \frac{1}{8} a_{2}$$
$$y_2 = s\left(\frac{3}{2}\right) = a_{-1}B_2\left(\frac{3}{2} + 1\right) + a_{0}B_2\left(\frac{3}{2}\right) + a_{1}B_2\left(\frac{3}{2} - 1\right) + $$$$
+ a_{2}B_2\left(\frac{3}{2} - 2\right) + a_{2}B_2\left(\frac{3}{2} - 2\right)
+ a_{-1}B_2\left(\frac{3}{2} - 3\right) + a_{-1}B_2\left(\frac{3}{2} - 3\right)
+ a_{0}B_2\left(\frac{3}{2} - 4\right) + a_{0}B_2\left(\frac{3}{2} - 4\right)
+ a_{1}B_2\left(\frac{3}{2} - 5\right)=$$$$ + a_{1}B_2\left(\frac{3}{2} - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot \frac{1}{2} + a_{2} \cdot \frac{1}{2} + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 = \frac{a_1 + a_2}{2}$$ a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot \frac{1}{2} + a_{2} \cdot \frac{1}{2} + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 = \frac{a_1 + a_2}{2}$$
$$y_3 = s\left(2\right) = a_{-1}B_2\left(2 + 1\right) + a_{0}B_2\left(2\right) + a_{1}B_2\left(2 - 1\right) + $$$$ $$y_2 = s\left(\frac{5}{2}\right) = a_{-1}B_2\left(\frac{5}{2} + 1\right) + a_{0}B_2\left(\frac{5}{2}\right) + a_{1}B_2\left(\frac{5}{2} - 1\right) + $$$$
+ a_{2}B_2\left(2 - 2\right) + a_{2}B_2\left(\frac{5}{2} - 2\right)
+ a_{-1}B_2\left(2 - 3\right) + a_{-1}B_2\left(\frac{5}{2} - 3\right)
+ a_{0}B_2\left(2 - 4\right) + a_{0}B_2\left(\frac{5}{2} - 4\right)
+ a_{1}B_2\left(2 - 5\right)=$$$$ + a_{1}B_2\left(\frac{5}{2} - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot \left(\frac{1}{8}\right) + a_{2} \cdot \frac{3}{4} + a_{-1} \cdot \left(\frac{1}{8}\right) + a_{0} \cdot 0 + a_{1} \cdot 0 = a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 + a_{2} \cdot \frac{1}{2} + a_{-1} \cdot \frac{1}{2} + a_{0} \cdot 0 + a_{1} \cdot 0 = \frac{a_2 + a_{-1}}{2}$$
\frac{1}{8} a_{1} + \frac{3}{4} a_{2} + \frac{1}{8} a_{-1}$$
$$y_1 = s\left(\frac{7}{2}\right) = a_{-1}B_2\left(\frac{7}{2} + 1\right) + a_{0}B_2\left(\frac{7}{2}\right) + a_{1}B_2\left(\frac{7}{2} - 1\right) + $$$$
+ a_{2}B_2\left(\frac{7}{2} - 2\right)
+ a_{-1}B_2\left(\frac{7}{2} - 3\right)
+ a_{0}B_2\left(\frac{7}{2} - 4\right)
+ a_{1}B_2\left(\frac{7}{2} - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 + a_{2} \cdot 0 + a_{-1} \cdot \frac{1}{2} + a_{0} \cdot \frac{1}{2} + a_{1} \cdot 0 = \frac{a_{-1} + a_0}{2}$$
The linear system in matrix form is: The linear system in matrix form is:
\[\frac{1}{8} \cdot \[\frac{1}{2} \cdot
\begin{bmatrix} \begin{bmatrix}
4&4&0&0\\ 0&1&1&0\\
1&6&1&0\\ 0&0&1&1\\
0&4&4&0\\ 1&0&0&1\\
0&1&6&1\\ 1&1&0&0\\
\end{bmatrix} \end{bmatrix}
\begin{bmatrix} \begin{bmatrix}
a_0\\a_1\\a_2\\a_{-1}\\ a_{-1}\\a_0\\a_1\\a_2\\
\end{bmatrix} \end{bmatrix}
= =
\begin{bmatrix} \begin{bmatrix}
@ -155,9 +153,21 @@ $$y_0 = s(0) = a_{-1}B_2\left(1\right) + a_{0}B_2\left(0\right) + a_{1}B_2\left(
a_{-1} \cdot \frac{1}{8} + a_{0} \cdot \frac{3}{4} + a_{1} \cdot \frac{1}{8} + a_{2} \cdot 0 + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 = a_{-1} \cdot \frac{1}{8} + a_{0} \cdot \frac{3}{4} + a_{1} \cdot \frac{1}{8} + a_{2} \cdot 0 + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 =
\frac{1}{8} a_{-1} + \frac{3}{4} a_{0} + \frac{1}{8} a_{1}$$ \frac{1}{8} a_{-1} + \frac{3}{4} a_{0} + \frac{1}{8} a_{1}$$
$$y_1 = s\left(1\right) = \frac{1}{8} a_{0} + \frac{3}{4} a_{1} + \frac{1}{8} a_{2}$$ $$y_1 = s\left(1\right) = a_{-1}B_2\left(1 + 1\right) + a_{0}B_2\left(1\right) + a_{1}B_2\left(1 - 1\right) + $$$$
+ a_{2}B_2\left(1 - 2\right)
+ a_{-1}B_2\left(1 - 3\right)
+ a_{0}B_2\left(1 - 4\right)
+ a_{1}B_2\left(1 - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot \left(\frac{1}{8}\right) + a_{1} \cdot \frac{3}{4} + a_{2} \cdot \left(\frac{1}{8}\right) + a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot 0 =
\frac{1}{8} a_{0} + \frac{3}{4} a_{1} + \frac{1}{8} a_{2}$$
$$y_2 = s\left(2\right) = \frac{1}{8} a_{1} + \frac{3}{4} a_{2} + \frac{1}{8} a_{-1}$$ $$y_2 = s\left(2\right) = a_{-1}B_2\left(2 + 1\right) + a_{0}B_2\left(2\right) + a_{1}B_2\left(2 - 1\right) + $$$$
+ a_{2}B_2\left(2 - 2\right)
+ a_{-1}B_2\left(2 - 3\right)
+ a_{0}B_2\left(2 - 4\right)
+ a_{1}B_2\left(2 - 5\right)=$$$$
a_{-1} \cdot 0 + a_{0} \cdot 0 + a_{1} \cdot \left(\frac{1}{8}\right) + a_{2} \cdot \frac{3}{4} + a_{-1} \cdot \left(\frac{1}{8}\right) + a_{0} \cdot 0 + a_{1} \cdot 0 =
\frac{1}{8} a_{1} + \frac{3}{4} a_{2} + \frac{1}{8} a_{-1}$$
$$y_3 = s\left(3\right) = a_{-1}B_2\left(3 + 1\right) + a_{0}B_2\left(3\right) + a_{1}B_2\left(3 - 1\right) + $$$$ $$y_3 = s\left(3\right) = a_{-1}B_2\left(3 + 1\right) + a_{0}B_2\left(3\right) + a_{1}B_2\left(3 - 1\right) + $$$$
+ a_{2}B_2\left(3 - 2\right) + a_{2}B_2\left(3 - 2\right)