0

I have these data points.

$f_i(x)= \{10, 11, 14\}$
$x_i= \{0, 1, 3\}$

then the basis functions are.

$\pi_0 = 1 \\\pi_1=(x-x_0)=x \\\pi_2=(x-x_0)(x-x_1) =x(x-1)$

So the matrix will become.

$\begin{bmatrix} 1 & & & 10\\ 1& 1 & & 11\\ 1& 3 & 6 & 14 \end{bmatrix}$

When solved I get $10+x+\frac{1}{6}x^2$. Which does not give me the any of the answers in a multiple choice question for $x=2$.

P..
  • 14,929

1 Answers1

2

I don't know the matrix method you are using, but from first principles, we can proceed as follows.

  • What is the simplest polynomial $f_0(x)$ that has value $10$ at $x = 0$? Clearly, $f_0(x) = 10$ works.

  • $f_0(1) = 10$ whereas we need a polynomial that has value $11$ instead. So, add $g_1(x) = (11-10)(x-0)/(1-0)$ to $f_0(x)$ to get $$f_1(x) = f_0(x) + g_1(x) = 10 + (11-10)\frac{x-0}{1-0} = 10 +x.$$ Note that $g_1(x)$ was carefully chosen to ensure that it evaluates to $0$ at $x=0$ so as not to mess up the fact that $f_0(x)$ is correctly computing the desired value at $x=0$, while at $x=1$, $g_1(x)$ provides just the missing amount $11-10 = 1$.

  • $f_1(3) = 13$ and so we are again short by $1$. So we add to $f_1(x)$ a polynomial $g_2(x)$ that we choose so that $g_2(0) = g_2(1) = 0$ while $g_2(3) = 1$. Clearly $x(x-1)$ satisfies the first two constraints, but it has value $3\times 2 = 6$ at $x=3$. So, $$f_2(x) = f_1(x) + (14-13)\frac{x(x-1)}{6} = 10+x + \frac{x(x-1)}{6} = 10 + \frac{5}{6}x + \frac{1}{6}x^2$$ is the polynomial we need to find.

Quick check: $f_2(0) = 10, f_2(1) = 10+\frac{5}{6}+\frac{1}{6} =11$, and $f_2(3)(x) = 10 + \frac{5}{2} + \frac{9}{6} = 14$ as it should be.


If you will look at your work, you will see that you used $x^2$ instead of your basis function $x(x-1)$ which is why your polynomial $10+x+\frac{1}{6}x^2$ is incorrect.

Dilip Sarwate
  • 25,197
  • Thanks. My error was indeed that I forgot to write the $x(x-1)$ basis function in the end. But the matrix method is really easy if you want to learn it. In each column you calculate the value using the same basis function and fill in a different $x$ value in each row. This will form a triangular matrix since the ones above the diagonal will all be zero. Then add the $y$ values to form a augmented matrix. Solve it. And you should have the constants that correspond to each basis function. – Aaron de Windt Mar 09 '13 at 16:56