Fitting a quadratic interpolant to $y = cos x$ at three nodes

46 Views Asked by At

Lets say we want quadratic interpolation of $y = cos x$ at the nodes $\{0, \pi/2, \pi\}$. And we would like to match the derivative of $y(x)$ at the center node.

We will get two interpolants, lets start with the first one ($[0, \pi/2]$) on the form of:

$q_1(x) = a_1x^2+b_1x+c_1$

So we have three unknowns, so there must be three equations. The first two are:

$q_1(0) = a_10^2+b_10 + c_1 = 1 => c_1 = 1$

$q_1(\pi/2) = a_1(\pi/2)^2 + b_1(\pi/2) + c_1 = 0$

In the same way, the first two equations are constructed for the second interpolant on $[\pi/2,\pi]$.

However now I am lost on how to set up the third equation, and I assume this has to do with the derivative, but how do I proceed?

1

There are 1 best solutions below

3
On BEST ANSWER

The derivative of $\cos x$ at $x=\pi/2$ is $-1$, and this should match $q_1'(\pi/2)$. Thus, since $q_1'(x)=2a_1x+b_1$, we have $$2a_1(\pi/2)+b_1=-1.$$

This is the third equation for the first interpolant; the second interpolant will be similar.