An archived instance of discourse for discussion in undergraduate Real and Numerical Analysis.

Some problems from chapter 6

mark

Problems 5, 6, and 7 from chapter 6 make some reasonable exam type problems on quadratic splines.

5) Is the following function a quadratic spline on $[0,4]$? Why or why not?
\[Q(x) = \begin{cases}
x^2 + 3 &: 0 \le x < 3\\
5x - 6 &: 3 \le x \le 4\end{cases}\]


6) Is the following function a quadratic spline on [0,2]? Why or why not?
\[Q(x) = \begin{cases}
x^2 + 3x + 2 &: 0 \le x < 1\\
2x^2 + x + 3 &: 1 \le x \le 2\end{cases}\]


7) Find constants, $\alpha,\beta,\gamma$ such that the following is a
quadratic spline on [0,5].
\[Q(x) = \begin{cases}
\frac{1}{2}x^2 + 2x + \frac{3}{2} &: 0 \le x < 1\\
\alpha x^2 + \beta x + \gamma &: 1 \le x < 3\\
3x^2 - 7x + 12 &: 3 \le x \le 5\end{cases}\]




Cheryl

For $#5$, $$\lim_{x\to3^-} Q(x)=\lim_{x\to3^-} x^2+3=12$$
$$\lim_{x\to3^+} Q(x)=\lim_{x\to3^+} 5x-6=9$$

$Q$ is not a quadratic spline because $Q$ and $Q'$ are not continuous.

Cheryl

For $#6$,
$$\lim{x\to1^-} Q(x)=\lim{x\to1^-} x^2 +3x +2=6$$
$$\lim{x\to1^+} Q(x)=\lim{x\to1^+} 2x^2+x+3=6$$
$$\lim{x\to1^-} Q'(x)=\lim{x\to1^-} 2x+3=5$$
$$\lim{x\to1^+} Q'(x)=\lim{x\to1^+} 4x+1=5$$



Since the domain of $Q$ is $[0,2]$ and $Q$ and $Q'$ are continuous, this is a quadratic spline on $[0,2]$.

mark

Well, @Cheryl is just knocking these right out!!!!

hjoseph

Since number $7$ requires a solution to a system of equations I thought some elimination would be appropriate. We know that $Q'(x)$ must be continuous at all of the endpoints for this to be a spline, so let's start there:

First I found the slope at the right endpoint of $\frac{1}{2}x^2+2x+\frac{3}{2}$ which was $lim_{x\rightarrow1^-}Q'(x)$ or $1+2$ or $3$. That means that $2\alpha+\beta = 3$. Then I found the slope at the left endpoint of $3x^2-7x+12$ which was $\lim_{x\rightarrow3^+}Q'(x)$ or $18-7$ or $11$. This gives me $6\alpha+\beta = 11$. Organizing this in a $2$x$3$ matrix I start with:

\[\left [\begin{array}{c} \alpha \\ \beta \end{array} \right] \left[ \begin{array}{cc} 2 & 1 \\ 6 & 1 \end{array} \right] = \left [\begin{array}{c} 3 \\ 11 \end{array} \right]\]

Which I organize into a $2$x$3$ augmented matrix and solve using elimination:

\[ \left [\begin{array}{cc|c}2 & 1 & 3 \\ 6 & 1 & 11\end{array} \right] \rightarrow \left[ \begin{array}{cc|c}2 & 1 & 3 \\ 4 & 0 & 8\end{array} \right] \rightarrow \left[ \begin{array}{cc|c}2 & 1 & 3 \\ 1 & 0 & 2\end{array} \right] \rightarrow \left[ \begin{array}{cc|c}0 & 1 & -1 \\ 1 & 0 & 2\end{array} \right]
\]
As you can see, I got $\alpha = 2$ and $\beta = -1$. From here it's just a matter of plugging $\alpha$ and $\beta$ into $Q(x)$ and solving for $\gamma$ to make sure $Q(x)$ is continuous. Plugging in at the bound where $x = 1$ gives me $2-1+\gamma = 4$ which I easily solved for $\gamma = 3$. Just to be sure, I plugged this into the bound at $x = 3$ to make sure it would match up and got $18-3+3 = 18$, which I believe to be true.

So I found $\alpha = 2$, $\beta = -1$ and $\gamma = 3$ ensure $Q(x)$ is a spline, amidoinitrite?

hjoseph

Notice that I haven't yet figured out how to add the separation line in these augmented matricies.

Cheryl

Here is a good link for the code to create augmented matrices:
stackexchange

hjoseph

Thanks, I ended up using a formatted array:

\left[ begin{array}{cc|c} end{array} \right]

I purposely left the "\" out of the begin and end commands so you could see the code.

mark

@hjoseph I think that looks good. One comment concerning the description of your work, though. You're looking for the slopes of the graphs of the functions at the endpoints of the intervals - right? You've written endpoints of the functions, and I'm not sure you've got them in the correct order.

hjoseph

I think I see what you mean, I mistakenly said left where I meant right and right where I meant left. Also, I realize I kind of gloss over some steps and plug directly into $Q'(x)$ without warning when I say "$1+2$, this is simply $Q'(1)$.