/src/main/java/net/finmath/functions/AnalyticFormulas.java
final double error = valueAnalytic - payoffUnit;
final double error = valueAnalytic - optionValue;
while(solver.getAccuracy() > maxAccuracy && !solver.isDone() && solver.getNumberOfIterations() < maxIterations) { final double volatility = solver.getNextPoint(); final double dPlus = (Math.log(forward / optionStrike) + 0.5 * volatility * volatility * optionMaturity) / (volatility * Math.sqrt(optionMaturity)); final double dMinus = dPlus - volatility * Math.sqrt(optionMaturity); final double valueAnalytic = (forward * NormalDistribution.cumulativeDistribution(dPlus) - optionStrike * NormalDistribution.cumulativeDistribution(dMinus)) * payoffUnit; final double derivativeAnalytic = forward * Math.sqrt(optionMaturity) * Math.exp(-0.5*dPlus*dPlus) / Math.sqrt(2.0*Math.PI) * payoffUnit; <extra_id_0> solver.setValueAndDerivative(error,derivativeAnalytic); } return solver.getBestPoint(); } } public static double blackScholesDigitalOptionValue(