[jira] Created: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)
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.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)

     [ https://issues.apache.org/jira/browse/MATH-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe resolved MATH-343.
--------------------------------

    Resolution: Fixed

Fixed in subversion repository as of r915517
Thanks for reporting the issue

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

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

Volkan Aktas commented on MATH-343:
-----------------------------------

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.

Reply | Threaded
Open this post in threaded view
|

[jira] Issue Comment Edited: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

    [ 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

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

Luc Maisonobe commented on MATH-343:
------------------------------------

You are right.
I have removed the unreachable code and committed it in the subversion repository
Thanks again

> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

     [ https://issues.apache.org/jira/browse/MATH-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated MATH-343:
-----------------------------

    Fix Version/s: 2.1

> 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
>             Fix For: 2.1
>
>
> 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.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (MATH-343) Brent solver doesn't throw IllegalArgumentException when initial guess has the wrong sign

Gilles Sadowski (Jira)
In reply to this post by Gilles Sadowski (Jira)

     [ https://issues.apache.org/jira/browse/MATH-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz closed MATH-343.
----------------------------


> 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
>             Fix For: 2.1
>
>
> 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.