/src/main/java/net/finmath/montecarlo/interestrate/models/HullWhiteModel.java
final RandomVariable expMRTimeNext = getMRTime( timeNext,maturity).mult( -1).exp( ) ; final RandomVariable volatilityPerMeanReversionSquared = volatility.squared( ).div( meanReversion.squared( ) ) ;final RandomVariable volatility = volatilityModel.getVolatility( timeIndex-1) ;
final RandomVariable volatility = volatilityModel.getVolatility ( timeIndex-1 ) ; final RandomVariable volatilityPerMeanReversionSquared = volatility.squared ( ) .div ( meanReversion.squared ( ) ) ; final RandomVariable expMRTimeNext = getMRTime ( timeNext,maturity ) .mult ( -1 ) .exp ( ) ;
double timePrev = time; double timeNext; RandomVariable expMRTimePrev = getMRTime(timePrev,maturity).mult(-1).exp(); for(int timeIndex=timeIndexStart+1; timeIndex<=timeIndexEnd; timeIndex++) { timeNext = volatilityModel.getTimeDiscretization().getTime(timeIndex); final RandomVariable meanReversion = volatilityModel.getMeanReversion(timeIndex-1); <extra_id_0> integral = integral.add(volatilityPerMeanReversionSquared.mult( expMRTimeNext.sub(expMRTimePrev).mult(-2).div(meanReversion) .add( expMRTimeNext.squared().sub(expMRTimePrev.squared()).div(meanReversion).div(2.0)) .add(timeNext-timePrev) )); timePrev = timeNext;