commons-user mailing list archives

Site index · List index
Message view
Top
From Matthew Rowles <rowle...@gmail.com>
Subject Re: [MATH] Why does PolynomialSplineFunction calculate value at (v - knots[i])
Date Fri, 08 Oct 2010 03:10:54 GMT
```On 24 September 2010 23:48, Greg J. McKnight
<gjmcknight@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-unsubscribe@commons.apache.org