On 24 September 2010 23:48, Greg J. McKnight <gjmckni...@schlagundrahm.ch> wrote: > My question is regarding the class PolynomialSplineFunction in commons-math. > > Can someone please explain to me the logic behind the following code: > > public double value(double v) throws ArgumentOutsideDomainException { > ... > return polynomials[i].value(v - knots[i]); > > Why does the function not just evaluate at the given value e.g: > > return polynomials[i].value(v); >
Hi Greg I ran into this a little while ago when I was writing some customisations... (From memory) It has to do with how the actual polynomials are calculated. They are calculated as "offsets" from each knot, so to interpolate a value, you need to find with set of knots the interpolated value belongs to (in order to get the correct set of polynomial functions), and then find it's offset from the first knot, and then use _that_ value to find the interpolated value. HTH Matthew --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org