math - Lagrange polynomial: Unexpected interpolation results -


i trying interpolate series of data points using 2nd lagrange polinomial. having

point1:(5;100) point2: (9;17) point3: (12;17) 

and formula

y=(x-x2)*(x-x3)/(x1-x2)*(x1-x3)*y1+   (x-x1)*(x-x3)/(x2-x1)*(x2-x3)*y2+   (x-x1)*(x-x2)/(x3-x1)*(x3-x2)*y3 

it obvious quadratic function might not fit data.. example.

but wonder why value surprisingly high x=7. if not wrong y=1500.

is above formula correct?

answer:

in summary:

  1. for same x, can't have 2 different y values; violates definition of function.
  2. you missing brackets in formula! not (x-x2)*(x-x3)/(x1-x2)*(x1-x3), ((x-x2)*(x-x3)) / ((x1-x2)*(x1-x3)).
  3. back 1>, note interpolation formula has x3-x2 in denominator. if have tied values, dividing 0.
  4. how can make interpolation on such small data set? yet asking quadratic interpolation!

follow-up:

1) fixed it. accidentally switched x , y values. points in format (y,x).

ah, haha, no wonder.

2) thank you! brackets improved approximation. regarding missing brackets: got formula accepted answer here: best way find quadratic regression curve in java, don't understand rule.

this famous, yet fundamental interpolation: lagrange interpolation. can verify formula @ wolfram mathworld: lagrange interpolating polynomial. don't give wikipedia link because 1 looks more beautiful.

the link found must contain typo. since have suggest edit fix that, approved.

3) (significant larger (which answers 4th question) time series. impossible have tied values.

yes, time series won't have tied values.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -