I find it difficult to deal with the methods of the mat. analysis through reference books. Did I understand correctly in the most general sense what interpolation and extrapolation are:

interpolator = (array[i] + array[i+1]) / 2; потом мы его суём между array[i] и array[i+1]; extrapolator = (array[i-2] + array[i-1] / 2); и мы его суём на место уже array[i]. 

I sketched the code myself, as I could .. As the most primitive method of approximating the value of points, I chose an arithmetic average between them ..

Closed due to the fact that the question is too general for the participants Harry , D-side , Xander , αλεχολυτ , HamSter Apr 13 '17 at 18:39 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • But where do these formulas come from? - Grundy
  • 6
    In the most general sense, interpolation is a way of finding intermediate values ​​of a quantity over an existing discrete set of known values, and extrapolation is an attempt to find values ​​of a function outside a given interval, and not between specified values. Frankly, I don’t understand how to combine dislike of mathematics with programming ... - Harry
  • four
    The tutorial will help. - Harry
  • 6
    It is still possible to interpolate the average of the extreme values, but to do this for extrapolation this is an obvious mistake. - Xander
  • 2
    @ Alexander did not have time to write :) yes, in general, you can do this, because everything depends on the type of starting points, and the extrapolation method should be suitable. So that the average value can be appropriate. - teran

1 answer 1

Interpolation is the finding of an intermediate value between the two known ones, using any algorithm. Your example is generally correct:

 // Например среднее арифметическое: interpolator = (array[i] + array[i+1]) / 2; // Располагаем между array[i] и array[i+1] 

Extrapolation is the finding of the next value by the known previous ones, by some algorithm. The most common example would be this:

 // Например линейное продолжение по 2 последним точкам: extrapolator = (array[i-1] + (array[i-1] - array[i-2])); // Располагаем на место array[i] 

Algorithms can be very diverse, from the repetition of values ​​to the approximation by curves, etc. In general, the algorithms may be similar, but, usually, extrapolation is a more algorithmically complex process.


PS enter image description here

  • By the way, yes, if I had written a repetition of the point: array [i + 1] = array [i], they would have burned me here at all) Thanks to people like you to make math a joy!) - Konstantin Volobuev