commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <p...@steitz.com>
Subject [math] Exceptions thrown my solvers
Date Thu, 15 Jul 2004 01:31:58 GMT
Currently, UnivariateRealSolver.solve advertises a generic MathException, which is thrown by
implementations in one of two cases:

1) the solver fails to converge
2) the UnivariateRealFunction throws a MathException when evaluating one of the iterates

It would be better to distinguish these failures. Logically, condition 1) should result in
a ConvergenceException.  Also, UnivariateRealFunction.value should either advertise a more
specific exception (e.g. FunctionEvaluationException) or throw runtime exceptions (many could
be ArithmeticExceptions) instead of checked exceptions.  So...I would like to do one of the
following:

a) Add a (checked) FunctionEvalutationException (including an argument property, holding the
value of the "bad" argument), change UnivariateRealFunction.value to advertise this and change
UnivariateRealSolver.solve to throw FunctionEvaluationException, ConvergenceException

b) Remove the throws from UnivariateRealFunction (assume runtime exceptions will be thrown
/ passed up) and change UnivariateRealSolver.solve to just advertise ConvergenceException.

I am OK with either of these, though I think a) may be a little better since it could provide
more information.  I guess we could also consider c)--same as a) but FunctionEvaluationException
extends RuntimeException.

If there are no objections, I will proceed with option a).

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message