You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Anthony Maidment (JIRA)" <ji...@apache.org> on 2012/09/27 16:20:07 UTC
[jira] [Created] (MATH-871) math3 SecantSolver can return
Double.INFINITE
Anthony Maidment created MATH-871:
-------------------------------------
Summary: math3 SecantSolver can return Double.INFINITE
Key: MATH-871
URL: https://issues.apache.org/jira/browse/MATH-871
Project: Commons Math
Issue Type: Bug
Affects Versions: 3.0
Reporter: Anthony Maidment
Priority: Minor
In doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
Then when it calculates the next appromixation at line 101:
final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
The denominator is then zero, and the next approximation is Double.INFINITE.
I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MATH-871) math3 SecantSolver can return
Double.INFINITE
Posted by "Anthony Maidment (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Anthony Maidment updated MATH-871:
----------------------------------
Description:
In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
Then when it calculates the next appromixation at line 101:
final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
The denominator is then zero, and the next approximation is Double.INFINITE.
I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
was:
In doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
Then when it calculates the next appromixation at line 101:
final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
The denominator is then zero, and the next approximation is Double.INFINITE.
I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
> math3 SecantSolver can return Double.INFINITE
> ---------------------------------------------
>
> Key: MATH-871
> URL: https://issues.apache.org/jira/browse/MATH-871
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Anthony Maidment
> Priority: Minor
>
> In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
> Then when it calculates the next appromixation at line 101:
> final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
> The denominator is then zero, and the next approximation is Double.INFINITE.
> I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-871) math3 SecantSolver can return
Double.INFINITE
Posted by "Gilles (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13466711#comment-13466711 ]
Gilles commented on MATH-871:
-----------------------------
bq. In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
My first comment was a bit hasty.
"f0" and f1" cannot have the same value, as that would mean that there is no bracketing, a condition that is checked and, if not satisfied, raises an exception.
The line numbers you refer to seems to indicate that I do not look at the same code: Did you test with a recent snapshot of the library?
Alternately, please provide the use case.
> math3 SecantSolver can return Double.INFINITE
> ---------------------------------------------
>
> Key: MATH-871
> URL: https://issues.apache.org/jira/browse/MATH-871
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Anthony Maidment
> Priority: Minor
>
> In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
> Then when it calculates the next appromixation at line 101:
> final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
> The denominator is then zero, and the next approximation is Double.INFINITE.
> I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-871) math3 SecantSolver can return
Double.INFINITE
Posted by "Dennis Hendriks (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13466661#comment-13466661 ]
Dennis Hendriks commented on MATH-871:
--------------------------------------
bq. final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
BaseSecantSolver (used for IllinoisSolver, PegasusSolver, and RegulaFalsiSolver), has the same line of code, at line 162 (CM 3.0 release).
> math3 SecantSolver can return Double.INFINITE
> ---------------------------------------------
>
> Key: MATH-871
> URL: https://issues.apache.org/jira/browse/MATH-871
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Anthony Maidment
> Priority: Minor
>
> In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
> Then when it calculates the next appromixation at line 101:
> final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
> The denominator is then zero, and the next approximation is Double.INFINITE.
> I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-871) math3 SecantSolver can return
Double.INFINITE
Posted by "Gilles (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13465523#comment-13465523 ]
Gilles commented on MATH-871:
-----------------------------
Thanks for the report. Could you provide a unit test showing the failure?
At first sight, this seems the result of a inherent weakness of the algorithm, not a bug in the implementation.
With your particular use-case (i.e. a code excerpt), it will be useful to raise the issue on the "dev" in order to discuss whether to introduce a check to detect this problem.
> math3 SecantSolver can return Double.INFINITE
> ---------------------------------------------
>
> Key: MATH-871
> URL: https://issues.apache.org/jira/browse/MATH-871
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Anthony Maidment
> Priority: Minor
>
> In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
> Then when it calculates the next appromixation at line 101:
> final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
> The denominator is then zero, and the next approximation is Double.INFINITE.
> I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (MATH-871) math3 SecantSolver can return
Double.INFINITE
Posted by "Gilles (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles resolved MATH-871.
-------------------------
Resolution: Cannot Reproduce
Please reopen with more precise information.
> math3 SecantSolver can return Double.INFINITE
> ---------------------------------------------
>
> Key: MATH-871
> URL: https://issues.apache.org/jira/browse/MATH-871
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Reporter: Anthony Maidment
> Priority: Minor
>
> In SecantSolver.doSolve(), I had a situation in which f0 and f1, from computeObjectiveValue() on lines 77 & 78, were the same value.
> Then when it calculates the next appromixation at line 101:
> final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
> The denominator is then zero, and the next approximation is Double.INFINITE.
> I was able to work around this in this particular instance by relaxing the accuracy requirements of the solver, although I haven't yet fully tested the downstream implications of this change.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira