I'm looking for a java library or some help to write my own interpolation function. That is I have two arrays of doubles which are potentially different sizes, but are ordered. I need to be able to make an estimate of intermediate values, and insert so that both arrays become the same size. In fact the total number of points appearing in the interpolation is the sum of the 2 array sizes minus 1. The range of each array must stay the same however, so there is no extrapolation needed.
eg. a1 = [1, 4, 9, 16, 25, 36] and a2 = [6, 9, 14, 30]
the results could be eg.
a1 = [1, 2.25, 4, 6.25, 9, 12.25, 16, 25, 36]
and
a2 = [6, 6.5625, 7.25, 9, 10.0625, 11.25, 14, 25.25, 30]
these examples are f(x) = x^2 and g(x) = x^2 + 5
, however could easily have been any polynomial - the point is to be able to estimate/approximate the function from the dataset well enough to provide decent enough interpolation. Here the x value is just the index of the input array. In the output only the y values are important.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…