Calculating the relative error of an interpolation polynomial

Click For Summary
The discussion focuses on calculating the absolute and relative errors of two interpolation polynomials, p1 and p2, at x=2. The absolute error is calculated as the difference between the values of p1 and p2 at that point. For the relative error, there is uncertainty about whether to use p2(2) as the true value in the denominator. It is clarified that both polynomials are based on the same set of data points, with p2 being a second-degree polynomial and p1 a first-degree polynomial. Concerns are raised about handling cases where p2(a) equals zero, as this would lead to division by zero in the relative error calculation.
bremenfallturm
Messages
81
Reaction score
13
Homework Statement
You have created two interpolation polynomials, ##p_1## of degree ##1## and ##p_2## of degree ##2##. At the point ##x=2##, you get the following values
$$
\begin{cases}
p_1(2)=16.52848966 \\
p_2(2)=14.1764705
\end{cases}
$$
Approximate the absolute and relative errors in y at ##x=2##.
Relevant Equations
Interpolation absolute error can be approximated as
##|p_{n}(a)-p_{n+1}(a)|## where ##p_{n}## represents a polynomial of degree n and ##a## the point where the absolute error is to be calculated.
Hi!

It's been a while since I've done this and I am unsure about the relative error. Should I use ##p_2(2)## as the "true value" for the relative error, that is, be in the denominator?

Or in other words, is this correct?

Absolute error : ##|p_1(2)-p_2(2)|=|16.52848966−14.01764705|##
Relative error: ##\frac{|16.52848966−14.01764705|}{|14.01764705|}##
 
Physics news on Phys.org
Hi,

bremenfallturm said:
Homework Statement: You have created two interpolation polynomials, ##p_1## of degree ##1## and ##p_2## of degree ##2##. At the point ##x=2##, you get the following values
$$
\begin{cases}
p_1(2)=16.52848966 \\
p_2(2)=14.1764705
\end{cases}
$$
Approximate the absolute and relative errors in y at ##x=2##.
Relevant Equations: Interpolation absolute error can be approximated as
##|p_{n}(a)-p_{n+1}(a)|## where ##p_{n}## represents a polynomial of degree n and ##a## the point where the absolute error is to be calculated.

It's been a while since I've done this and I am unsure about the relative error. Should I use ##p_2(2)## as the "true value" for the relative error, that is, be in the denominator?

Or in other words, is this correct?

Absolute error : ##|p_1(2)-p_2(2)|=|16.52848966−14.01764705|##
Relative error: ##\frac{|16.52848966−14.01764705|}{|14.01764705|}##

The question confuses me, since it says 'errors'
bremenfallturm said:
Approximate the absolute and relative errors in y at ##x=2##.
You only give an estimate of the error in ##p_1##, which may well be what the exercise composer intended. But he/she could just as well be asking for expressions in terms of derivatives...

And: what are ##p_1## and ##p_2## based on ? The same set of data points ? Or does ##p_2## have twice as many ?

Finally: what if ##p_2(a) = 0## ?

##\ ##
 
Last edited:
BvU said:
Hi,



The question confuses me, since it says 'errors'

You only give an estimate of the error in ##p_1##, which may well be what the exercise composer intended. But he/she could just as well be asking for expressions in terms of derivatives...

And: what are ##p_1## and ##p_2## based on ? The same set of data points ? Or does ##p_2## have twice as many ?

Finally: what if ##p_2(a) = 0## ?

##\ ##
Sorry, the question is not in English so I translated it. It is supposed to say "error". It is also given that ##p_1## and ##p_2## are based on the same data points. Though I assume this means that ##p_2## are based on 3 datapoints since it is a 2nd degree polynomial and ##p_1## are based on 2 of those datapoints.

If ##p_2(a)=0##, then we do have a problem indeed as division by zero makes the quotient go to infinity. Actually I am not sure how that would be handled? I have been confused by taht in the past and never sorted it out.
 
bremenfallturm said:
It is also given that p1 and p2 are based on the same data points. Though I assume this means that p2 are based on 3 datapoints since it is a 2nd degree polynomial and p1 are based on 2 of those datapoints.
Possible: yes. Fair ? Hmmm... piecewise linear would be fairer

Suppose you have three points (I took ##e^x\ ##, x = 1, 2, 3) then a first attempt would be something like

1735856405399.png


with deviations from ##e^x## as follows:

1735857900280.png


So red is the absolute error for the linear interpolation.
| red minus green | would be the error estimate for the absolute error.
And yellowish is that divided by ##p_2## (The estimate for the relative error. No worry about 1/0)

The purple line is the actual relative error (i.e. |(red - ##e^x##)| / ##e^x##)

Draw your own conclusions ...

(but clearly there is no reason for 10 digit reporting :wink: )

##\ ##
 
BvU said:
(but clearly there is no reason for 10 digit reporting :wink: )
Oh yeah, definitely not. Thanks for the pointers in the right direction? Now I'm just left with a curious bonus question (feel free to fill in if you have time ;))
bremenfallturm said:
If , then we do have a problem indeed as division by zero makes the quotient go to infinity. Actually I am not sure how that would be handled? I have been confused by taht in the past and never sorted it out.
 
First, I tried to show that ##f_n## converges uniformly on ##[0,2\pi]##, which is true since ##f_n \rightarrow 0## for ##n \rightarrow \infty## and ##\sigma_n=\mathrm{sup}\left| \frac{\sin\left(\frac{n^2}{n+\frac 15}x\right)}{n^{x^2-3x+3}} \right| \leq \frac{1}{|n^{x^2-3x+3}|} \leq \frac{1}{n^{\frac 34}}\rightarrow 0##. I can't use neither Leibnitz's test nor Abel's test. For Dirichlet's test I would need to show, that ##\sin\left(\frac{n^2}{n+\frac 15}x \right)## has partialy bounded sums...

Similar threads

Replies
4
Views
3K
Replies
5
Views
2K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
4
Views
3K
Replies
1
Views
6K
Replies
2
Views
3K