Because opposite signs insures the endpoints bracket a root.  If the
endpoints capture a root, then the Brent algorithm is guaranteed to
work.

Your example does point out a problem, though,  Since one of the
endpoints evaluates to zero, the algorithm should stop and return that
as the root instead of throwing an exception.

Can you open a Jira issue with this example and/or a patch that fixes
the problem, and we can get it added to the code base.

Thanks,

Brent Worden

On Tue, May 6, 2008 at 2:58 PM, Al Lelopath <[EMAIL PROTECTED]> wrote:
> I'm getting this exception:
> STDERR: java.lang.IllegalArgumentException: Function values at
> endpoints do not have different signs.  Endpoints:
> [-100000.0,1.7976931348623157E308]  Values: [0.0,-101945.04630982173]
> May 6, 2008 1:53:04 PM
> STDERR:         at 
> org.apache.commons.math.analysis.BrentSolver.solve(BrentSolver.java:99)
> May 6, 2008 1:53:04 PM
> STDERR:         at 
> org.apache.commons.math.analysis.BrentSolver.solve(BrentSolver.java:62)
>
> Why is having function values that don't have different signs a bad thing?
>
> (Though it does appear that they do have different signs
> [0.0,-101945.04630982173] if 0.0 is considered positive)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to