Calculating the relative error of an interpolation polynomial

  • #1
bremenfallturm
67
11
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
  • #2
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:
  • #3
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.
 
  • #4
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: )

##\ ##
 
  • #5
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.
 

Similar threads

Replies
4
Views
878
Replies
4
Views
2K
Replies
5
Views
1K
Replies
1
Views
1K
Replies
1
Views
2K
Replies
1
Views
1K
Replies
4
Views
2K
Replies
1
Views
6K
Back
Top