commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volkan Aktas (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign
Date Tue, 23 Feb 2010 22:58:27 GMT

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

Volkan Aktas edited comment on MATH-343 at 2/23/10 10:57 PM:
-------------------------------------------------------------

Thanks for the quick turnaround. One comment: I'm not sure whether the check before throwing
the IllegalArgumentException is necessary. You can have only the following situations (given
that min <= initial <= max and assuming neither min nor max is a root):

    * yMin and yMax have the same sign:
        ** yInitial has a different sign: Handled on line 121 (function is not monotonous
between min and max)
        ** yInitial has the same sign: Falls through to line 136 and yMin * yMax > 0 by
definition
    * yMin and yMax do not have the same sign:
        ** yInitial has the same sign as yMax: Handled on line 121
        ** yInitial has the same sign as yMin: Handled on line 133

In this case I'd say code between lines 131 and 142 should be replaced by the throw statement
on line 137.

      was (Author: aktasv):
    Thanks for the quick turnaround. One comment: I'm not sure whether the check before throwing
the IllegalArgumentException is necessary. You can have only the following situations (given
that min <= initial <= max and assuming neither min nor max is a root):

    - yMin and yMax have the same sign:
        - yInitial has a different sign: Handled on line 121 (function is not monotonous between
min and max)
        - yInitial has the same sign: Falls through to line 136 and yMin * yMax > 0 by
definition
    - yMin and yMax do not have the same sign:
        - yInitial has the same sign as yMax: Handled on line 121
        - yInitial has the same sign as yMin: Handled on line 133

In this case I'd say code between lines 131 and 142 should be replaced by the throw statement
on line 137.
  
> Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong
sign
> -----------------------------------------------------------------------------------------
>
>                 Key: MATH-343
>                 URL: https://issues.apache.org/jira/browse/MATH-343
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Volkan Aktas
>            Priority: Critical
>
> Javadoc for "public double solve(final UnivariateRealFunction f, final double min, final
double max, final double initial)" claims that "if the values of the function at the three
points have the same sign" an IllegalArgumentException is thrown. This case isn't even checked.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message