[ 
https://issues.apache.org/jira/browse/MATH-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17441455#comment-17441455
 ] 

Gilles Sadowski commented on MATH-1635:
---------------------------------------

bq. Interpolated value is: -3.9681889999323374. Expected: 2.0 

I confirm that this behaviour is also present in the development version.

bq. AkimaSplineInterpolator is not supposed to overshoot [...]

>From the [link|https://nl.mathworks.com/help/matlab/ref/makima.html] referred 
>to in the Javadoc:
{noformat}
In particular, whenever there are three or more consecutive collinear points, 
the algorithm connects them with a straight line and thus avoids an overshoot.
{noformat}

In your example, there is a single discrepant point.
On the one hand, it would be nice if the code were more robust but, on the 
other, it might not be desirable to complicate the algorithm because of a case 
which it was explicitly not meant to handle.

bq. I am also quite confused about where to find the latest version of this 
library. I know that 3.6.1 is very out of date but I am reluctant to depend on 
SNAPSHOT dependencies, especially if they sit outside of Maven Central. What do 
you recommend?

This is a question for the mailing list.

> AkimaSplineInterpolator overshoots graph
> ----------------------------------------
>
>                 Key: MATH-1635
>                 URL: https://issues.apache.org/jira/browse/MATH-1635
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Gili
>            Priority: Major
>
> AkimaSplineInterpolator is not supposed to overshoot points on the graph, but 
> the following testcase seems to show it doing exactly that:
>  
> {code:java}
> double[] x = {1616326459, 1616326545, 1616326555, 1616326588, 1616326663, 
> 1616326760,
>  1616326770, 1616326792, 1616326856, 1616326964, 1616327028, 1616327233, 
> 1616327426,
>  1616327469, 1616327619, 1616327910, 1616328038, 1616328178, 1616328414, 
> 1616328747,
>  1616328983, 1616329316, 1616329864, 1616329875};
> double[] y = {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 
> 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
>  2.0, 2.0, 2.0, 2.0, 2.0, 3.0};
> AkimaSplineInterpolator interpolator = new AkimaSplineInterpolator();
> PolynomialSplineFunction interpolate = interpolator.interpolate(x, y);
> double value = interpolate.value(1616329584);
> System.out.println("Interpolated value is: " + value + ". Expected: 2.0"); 
> {code}
>  
> When I run the testcase I get 
> {code:java}
> Interpolated value is: -3.9681889999323374. Expected: 2.0 {code}
>  
> I am also quite confused about where to find the latest version of this 
> library. I know that 3.6.1 is very out of date but I am reluctant to depend 
> on SNAPSHOT dependencies, especially if they sit outside of Maven Central. 
> What do you recommend?
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to