/src/main/java/net/finmath/singleswaprate/annuitymapping/BasicPiterbargAnnuityMapping.java
innerSecond *=periodLengths[numberOfPeriods-1] *periodLengths[numberOfPeriods-1] /( periodLengths[numberOfPeriods-1] *initialSwapRates[numberOfEvaluationPoints -1] +1.0) /( periodLengths[numberOfPeriods-1] *initialSwapRates[numberOfPeriods -1] +1.0) /exponentialDriverMeans[numberOfPeriods -1] /exponentialDriverMeans[numberOfPeriods -1];
innerSecond *=periodLengths[numberOfPeriods-1] *periodLengths[numberOfPeriods-1] / ( periodLengths[numberOfPeriods-1] *initialSwapRates[numberOfPeriods -1] +1.0 ) / ( periodLengths[numberOfPeriods-1] *initialSwapRates[numberOfPeriods -1] +1.0 ) /exponentialDriverMeans[numberOfPeriods -1] /exponentialDriverMeans[numberOfPeriods -1];
value += (Math.pow(term, -exponents[0])) *periodLengths[index] /denominators[index]; innerFirst +=(Math.pow(term, -exponents[index] -1)) *periodLengths[index] innerSecond += (Math.pow(term, -exponents[index] -2)) *periodLengths[index] } innerFirst *= periodLengths[numberOfPeriods-1] /(periodLengths[numberOfPeriods-1] *initialSwapRates[numberOfPeriods -1] +1.0) /exponentialDriverMeans[numberOfPeriods -1]; <extra_id_0> return ((2.0 *innerFirst *innerFirst /value /value /value) - (innerSecond /value /value)) *initialAnnuities[numberOfPeriods-1] - expectationCorrection * normalizer.getSecondDerivative(swapRate); } private double[] findExponentialDriverMeans(final double[] timePoints, final double maturity, final double strike, final VolatilityCube volvolCube, final VolatilityCubeModel model){ final double[] exponentialMeans = new double[numberOfPeriods];