-2

I used lagrangian interpolation and for some equations the average value of the function is astronomical despite the polynomial and the points it interpolates.

For example

Polynomial A:

$$(X_0, Y_0) = (62,181)\\ (X_1, Y_1) = (40,210)\\ (X_2, Y_2) = (67,185)\\ (X_3, Y_3) = (19, 201)\\ (X_4, Y_4) = (41, 199) $$

Lagrangian Polynomial:

$$f(x)=-3893/4980690 x^4+5847/39130x^3-353200229/34864830x^2+121372073/430430x-8446030382/3486483$$

The average value of the function within $19\le x\le 67: 5248520$

Polynomial B:

$$(X_0, Y_0) = (1,200)\\ (X_1, Y_1) = (81,250)\\ (X_2, Y_2) = (32,212)\\ (X_3, Y_3) = (77, 248)\\ (X_4, Y_4) = (93, 245) $$

$$f(x)=-1173601/155489214720 x^4+28814081/22212744960 x^3-1451597501/22212744960 x^2+3639509257/2549003520 x+1482612997/7463960$$

$$dx=32773432105907/145771138800≈224.8$$

Am I doing something wrong in polynomial A. What is mathematically the cause for this? Thanks!

  • The average value of the function within 19<=x<=67: 5248520: this is not what I see – Dmitry Aug 01 '20 at 23:26
  • Well, you've never mentioned an integral in your question. – Dmitry Aug 01 '20 at 23:29
  • The plot from Alpha looks like it is always negative over the range of interest. That cannot be the Lagrange polynomial for the given points, which are all positive. I don't know where the error is. There appears to be an $x$ missing from the first polynomial in the linear term. – Ross Millikan Aug 01 '20 at 23:31
  • @PhysicsGeek, no, it's because you've lost $x$ in $f(x)$. Now the plot looks like this and matches on the points. – Dmitry Aug 01 '20 at 23:34
  • 1
    I don't see a reason to trust this site. Here is what wolfram says. Moreover, for average you should compute not $\int_{19}^{67} \ldots$, but $\frac {\int_{19}^{67} \ldots} {67 - 19}$, and now you get a result – Dmitry Aug 01 '20 at 23:41
  • Also, you are mistaken by thinking that 5248520 is a large number. It won't lead to any numerical problems unless you need something like the $7$-th digit after decimal point, e.g. depending on your calculator $((5248520 + 10^{-10}) - 5248520) \cdot 10^{10}$ may be something like 0 instead of 1. of course, you may use it to get even bigger numbers. They may lead to problems. – Dmitry Aug 01 '20 at 23:46
  • @PhysicsGeek, can you elaborate when it happens? Integral is always positive when the function is positive. Otherwise, you need to look closely. Increasing/decreasing doesn’t matter – Dmitry Aug 02 '20 at 12:22
  • Recent edits to this question entirely changed it and made the accepted answer nonsensical. I have rolled back to the latest sensible version of the question. – Lee Mosher Aug 02 '20 at 16:28
  • @PhysicsGeek even if it is too specific there is not reason to edit the post in unusual ways. Leave it alone and move on. – quid Aug 02 '20 at 19:47

1 Answers1

2

According to Wolfy,

$\dfrac1{67-19}\int_{19}^{67}(-3893/4980690 x^4+5847/39130x^3-353200229/34864830x^2+121372073/430430x-8446030382/3486483)dx \approx 218.45 $

To get the average value, you have to divide by the length of the interval.

marty cohen
  • 107,799