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