public void test(int eventType) throws MathIllegalArgumentException, MathIllegalStateException {
  double e=1e-15;
  ODEIntegrator integrator=new DormandPrince853Integrator(e,100.0,1e-7,1e-7);
  BaseSecantSolver rootSolver=new PegasusSolver(e,e);
  ODEEventHandler evt1=new Event(0,eventType);
  ODEEventHandler evt2=new Event(1,eventType);
  integrator.addEventHandler(evt1,0.1,e,999,rootSolver);
  integrator.addEventHandler(evt2,0.1,e,999,rootSolver);
  double t=0.0;
  double tEnd=9.75;
  double[] y={0.0,0.0};
  List<Double> events1=new ArrayList<Double>();
  List<Double> events2=new ArrayList<Double>();
  while (t < tEnd) {
    final ODEStateAndDerivative finalState=integrator.integrate(this,new ODEState(t,y),tEnd);
    t=finalState.getTime();
    y=finalState.getPrimaryState();
    if (y[0] >= 1.0) {
      y[0]=0.0;
      events1.add(t);
    }
    if (y[1] >= 1.0) {
      y[1]=0.0;
      events2.add(t);
    }
  }
  Assert.assertEquals(EVENT_TIMES1.length,events1.size());
  Assert.assertEquals(EVENT_TIMES2.length,events2.size());
  for (int i=0; i < EVENT_TIMES1.length; i++) {
    Assert.assertEquals(EVENT_TIMES1[i],events1.get(i),1e-7);
  }
  for (int i=0; i < EVENT_TIMES2.length; i++) {
    Assert.assertEquals(EVENT_TIMES2[i],events2.get(i),1e-7);
  }
}

public void test ( int eventType ) throws MathIllegalArgumentException , MathIllegalStateException { double e = 1e-15 ; ODEIntegrator integrator = new DormandPrince853Integrator ( e , 100.0 , 1e-7 , 1e-7 ) ; BaseSecantSolver rootSolver = new PegasusSolver ( e , e ) ; ODEEventHandler evt1 = new Event ( 0 , eventType ) ; ODEEventHandler evt2 = new Event ( 1 , eventType ) ; integrator . addEventHandler ( evt1 , 0.1 , e , 999 , rootSolver ) ; integrator . addEventHandler ( evt2 , 0.1 , e , 999 , rootSolver ) ; double t = 0.0 ; double tEnd = 9.75 ; double [ ] y = { 0.0 , 0.0 } ; List < Double > events1 = new ArrayList < Double > ( ) ; List < Double > events2 = new ArrayList < Double > ( ) ; while ( t < tEnd ) { final ODEStateAndDerivative finalState = integrator . integrate ( this , new ODEState ( t , y ) , tEnd ) ; t = finalState . getTime ( ) ; y = finalState . getPrimaryState ( ) ; if ( y [ 0 ] >= 1.0 ) { y [ 0 ] = 0.0 ; events1 . add ( t ) ; } if ( y [ 1 ] >= 1.0 ) { y [ 1 ] = 0.0 ; events2 . add ( t ) ; } } Assert . assertEquals ( EVENT_TIMES1 . length , events1 . size ( ) ) ; Assert . assertEquals ( EVENT_TIMES2 . length , events2 . size ( ) ) ; for ( int i = 0 ; i < EVENT_TIMES1 . length ; i ++ ) { Assert . assertEquals ( EVENT_TIMES1 [ i ] , events1 . get ( i ) , 1e-7 ) ; } for ( int i = 0 ; i < EVENT_TIMES2 . length ; i ++ ) { Assert . assertEquals ( EVENT_TIMES2 [ i ] , events2 . get ( i ) , 1e-7 ) ; } }
test for events that occur at the exact same time , but due to numerical calculations occur very close together instead .
