Given the Lagrange Basis Functions:
And an ODE of the form:
The lagrange interpolation states that:
Moreover:
I read that the last expression allows to build a algebraic equation system of N equations by N variables and that in turn should allow computing the function evaluated at those $x(t_j)$ and then use those to determine the interpolation function.
Whenever I try to do this approach I always end up with a system whose solutions do not match with the analytical answer.
Consider this example:
$$\dot{x} = -x + t$$ $$x(0) = 5$$ $$t_0 = 0, t_1 = 1, t_2 = 2$$
The analytical solution is:
$$x(t) = t - 1 + 6\cdot e^{-t}$$
Which yield: $$x(t_0) = 5, x(t_1) \approx 2.20, x(t_2) \approx 4.04$$
Whereas when using the formula above I get: $$\hat{x}(t_0) = 5, \hat{x}(t_1) \approx 2.769, \hat{x}(t_2) \approx 3.076$$
The error is too big to be some machine error or truncation error.
Am I missing something? Is there any bibliography with a step by step example to check if I am using the correct procedure (I couldn't find anything googling)?




