commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Calle Ekdahl...@ekdhl.net>
Subject [math] Problem with ODE discrete event
Date Mon, 24 Mar 2014 16:28:00 GMT
When using the event handler in the ODE solver I’m getting the error message/exception

"Exception in thread "main" org.apache.commons.math3.exception.NoBracketingException: function
values at endpoints do not have different signs, endpoints: [692,555, 692,556], values: [-0,
-0]”

What could be the cause of this? My g switching function:

    public double g(double t, double[] y) {

        for(int i=0; i < y.length/6; i++) {
            double norm = Math.sqrt(y[6*i]*y[6*i]+y[6*i+1]*y[6*i+1]+y[6*i+2]*y[6*i+2]);
            if(norm-distanceThreshold < minDistance) minDistance = norm-distanceThreshold;
        }

        System.out.println(minDistance);

        return minDistance;
    }

The result of System.out.println(minDistance) does include a sign switch:

4.682173046832716E-5
2.510576831160627E-5
3.389511416873603E-6
-1.8327040230747826E-5
-1.8327040230747826E-5
-1.8327040230747826E-5

However instead of triggering eventOccurred it throws the exception.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message