/src/main/java/net/finmath/integration/SimpsonRealIntegrator.java
double sum = intervals.mapToDouble ( i -> integrand.applyAsDouble ( lowerBound + i * doubleInterval ) + 2 * integrand.applyAsDouble ( lowerBound + i * doubleInterval + singleInterval ) ) .sum ( ) ;
final double doubleInterval = range / numberOfDoubleSizeIntervals; final double singleInterval = 0.5 * doubleInterval; IntStream intervals = IntStream.range(1, numberOfDoubleSizeIntervals); if(useParallelEvaluation) { intervals = intervals.parallel(); } <extra_id_0> sum += 2.0 * integrand.applyAsDouble(lowerBound + singleInterval); return (integrand.applyAsDouble(lowerBound) + 2.0 * sum + integrand.applyAsDouble(upperBound)) / 3.0 * singleInterval; } }