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

Luc Maisonobe commented on MATH-844:
------------------------------------

In this case, the guesser fails because the function in really far from an 
harmonic function. It is a triangular periodic function with amplitude +/-3 and 
period 12, and all sample points are taken as integer abscissa, so values all 
belong to the integer subset {-3, -2, -1, 0, 1, 2, 3}.

This is an (interesting) ill-conditioned case. As small integers are 
represented exactly even as primitive doubles, all computations are exact and 
one of the intermediate parameters (c2 in the source code) is a perfect 0 
(there are no approximation here, the result is exact), and we divide by c2.

I would suggest to raise an exception here, and to store this as a junit test 
for failure mode.
                
> "HarmonicFitter.ParameterGuesser" sometimes fails to return sensible values
> ---------------------------------------------------------------------------
>
>                 Key: MATH-844
>                 URL: https://issues.apache.org/jira/browse/MATH-844
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Gilles
>            Priority: Minor
>             Fix For: 3.1
>
>         Attachments: MATH-844.test.patch
>
>
> The inner class "ParameterGuesser" in "HarmonicFitter" (package 
> "o.a.c.m.optimization.fitting") fails to compute a usable guess for the 
> "amplitude" parameter.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to