Author: luc Date: Wed Jan 15 16:48:25 2014 New Revision: 1558462 URL: http://svn.apache.org/r1558462 Log: Fixed an issue with noisy functions for ODE events detection.
The issue was not detected in Apache Commons Math but in similar code in Orekit (see https://www.orekit.org/forge/projects/orekit/issues/160). Modified: commons/proper/math/trunk/src/changes/changes.xml commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/events/EventState.java Modified: commons/proper/math/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1558462&r1=1558461&r2=1558462&view=diff ============================================================================== --- commons/proper/math/trunk/src/changes/changes.xml (original) +++ commons/proper/math/trunk/src/changes/changes.xml Wed Jan 15 16:48:25 2014 @@ -51,6 +51,9 @@ If the output is not quite correct, chec </properties> <body> <release version="3.3" date="TBD" description="TBD"> + <action dev="luc" type="fix" > + Fixed an issue with noisy functions for ODE events detection. + </action> <action dev="erans" type="add" issue="MATH-923"> Utilities for creating artificial neural networks (package "o.a.c.m.ml.neuralnet"). Implementation of Kohonen's Self-Organizing Feature Map (SOFM). Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/events/EventState.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/events/EventState.java?rev=1558462&r1=1558461&r2=1558462&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/events/EventState.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/events/EventState.java Wed Jan 15 16:48:25 2014 @@ -290,9 +290,13 @@ public class EventState { (FastMath.abs(root - ta) <= convergence) && (FastMath.abs(root - previousEventTime) <= convergence)) { // we have either found nothing or found (again ?) a past event, - // retry the substep excluding this value - ta = forward ? ta + convergence : ta - convergence; - ga = f.value(ta); + // retry the substep excluding this value, and taking care to have the + // required sign in case the g function is noisy around its zero and + // crosses the axis several times + do { + ta = forward ? ta + convergence : ta - convergence; + ga = f.value(ta); + } while ((g0Positive ^ (ga >= 0)) && (forward ^ (ta >= tb))); --i; } else if (Double.isNaN(previousEventTime) || (FastMath.abs(previousEventTime - root) > convergence)) {
