Linear approximation to xln(x)

663 Views Asked by At

Suppose we need to approximate $f(8.4)$ where $f(x) = \mathbb{xln(x)}$ by using a linear polynomial . We have the following points as nodes : $x_0=8.1 , x_1 = 8.3 , x_2 = 8.6 , x_3 = 8.7$ .

I realize that we can use Lagrange Interpolation to fit a linear polynomial by choosing any two nodal points . But , as I have been given $4$ nodal points , how should I choose the best two points for the approximation (without evaluating $f$ directly at $x = 8.4$ ) ?

2

There are 2 best solutions below

4
On BEST ANSWER

I would use a piecewise linear function, making a linear function between each pair of points. As $8.4$ is between $8.3$ and $8.6$, use those two points.

4
On

What I would do is to consider $$\Phi=\int_{8.1}^{8.7} (x \log(x)-a-bx)^2 \,dx$$ which is equivalent to a linear regression with an infinite number of data points.

Use the fact that, expanding and using integrations by parts $$I=\int (x \log(x)-a-bx)^2 \,dx$$ $$I=\frac{1}{54} x \left(54 a^2+27 a (2 b x+x)-6 x \log (x) (9 a+6 b x+2 x)+2 \left(9 b^2+6 b+2\right) x^2+18 x^2 \log ^2(x)\right)$$ Use the bounds to get $$\Phi=0.6 a^2+a (10.08 b-21.4547)+42.354 b^2-180.332 b+191.97$$ Compute the partial derivatives and set them equal to $0$; this gives two equations for two unknowns $(a,b)$ and the solution would be $\{a= -8.39714,b= 3.12810\}$.

Then, for $x=8.4$, you will get $17.8789$ while the exact value is $17.8771$.

Edit

Using exact arithmetic, it is possible to compute the exact values of parameters $a$ and $b$ using the classical least square method for the four data points as well as for the integration. The formulae will not be reported here (too messy); for sure, they are not very different $(0.008\text{%})$. However $$\frac{\Phi_{ols}}{\Phi_{int}}=2.0414$$