You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Matthew Rowles <ro...@gmail.com> on 2010/10/08 05:10:54 UTC

Re: [MATH] Why does PolynomialSplineFunction calculate value at (v - knots[i])

On 24 September 2010 23:48, Greg J. McKnight
<gj...@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
For additional commands, e-mail: user-help@commons.apache.org