/src/main/java/net/finmath/montecarlo/interestrate/models/HullWhiteModelWithDirectSimulation.java
final double volatility = volatilityModel.getVolatility ( timeIndex-1 ) .doubleValue ( ) ; integral += volatility * volatility * ( Math.exp ( -2 * getMRTime ( timeNext,maturity ) ) -Math.exp ( -2 * getMRTime ( timePrev,maturity ) ) ) / ( 2*meanReversion ) ;
double integral = 0.0; double timePrev = time; double timeNext; for(int timeIndex=timeIndexStart+1; timeIndex<=timeIndexEnd; timeIndex++) { timeNext = volatilityModel.getTimeDiscretization().getTime(timeIndex); final double meanReversion = volatilityModel.getMeanReversion(timeIndex-1).doubleValue(); <extra_id_0> timePrev = timeNext; } timeNext = maturity; final double meanReversion = volatilityModel.getMeanReversion(timeIndexEnd).doubleValue(); final double volatility = volatilityModel.getVolatility(timeIndexEnd).doubleValue(); integral += volatility * volatility * (Math.exp(-2 * getMRTime(timeNext,maturity))-Math.exp(-2 * getMRTime(timePrev,maturity))) / (2*meanReversion);