code: protected double simpson() {
          double s = 0f;
          double st = 0f;
          double ost = 0f;
          double os = 0f;
  
          for( int i = 1; i < maxsteps; i++ ) {
              st = trapezoid(i);
  
              s = (4f * st - ost) / 3f;
  
              if (i > 5) {
                  if (Math.abs(s - os) < accuracy * Math.abs(os) || (s == 0f && os == 0f)) {
                      return s;
                  }
              }
              os = s;
              ost = st;
  
          }
          return 0d;
      }
docs: Calculate the integral with the simpson method of the equation implemented in the method
  equation
  
  @return
  @throws Exception