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);

I have compiled a test that I think should pass, but the second assertion 
fails, because of the above mentioned behaviour:

The test simulates what I would do to create a (trivial) spline from 3 knot 
points, each function is linear.

The knot points are (0, 0), (1, 1), (2, 2).

PolynomialFunction f1 = new PolynomialFunction(new double[] { 0d, 1d });
PolynomialFunction f2 = new PolynomialFunction(new double[] { 0d, 1d });
double[] knots = new double[] { 0d, 1d, 2d };
PolynomialFunction[] functions = { f1, f2 };
PolynomialSplineFunction spline = new PolynomialSplineFunction(knots, 
functions);
double a = spline.value(0d);
assertTrue(a == 0d);
double b = spline.value(1d);
FAILS--> assertTrue(b == 1d);


I think I am missing something about how I should be using the 
PolynomialSplineFunction.

Any ideas?

Greg

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to