/src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/EuropeanOptionDeltaLikelihood.java
final RandomVariable logPhi2 = x2.squared( ) .div( sigma) .exp( )
final RandomVariable logPhi2 = x2.squared ( ) .div ( -2.0 ) .exp ( ) .div ( Math.sqrt ( 2 * Math.PI ) ) .div ( underlyingAtMaturity ) .div ( sigma ) .div ( Math.sqrt ( T ) ) .log ( ) ;
RandomVariable likelihoodRatio; if(isLikelihoodByFiniteDifference) { final double h = 1E-6; final RandomVariable x1 = underlyingAtMaturity.div(underlyingAtToday).log().sub(r.mult(T).sub(sigma.squared().mult(0.5*T))).div(sigma).div(Math.sqrt(T)); final RandomVariable logPhi1 = x1.squared().div(-2.0).exp().div(Math.sqrt(2 * Math.PI)).div(underlyingAtMaturity).div(sigma).div(Math.sqrt(T)).log(); final RandomVariable x2 = underlyingAtMaturity.div(underlyingAtToday.add(h)).log().sub(r.mult(T).sub(sigma.squared().mult(0.5*T))).div(sigma).div(Math.sqrt(T)); <extra_id_0> likelihoodRatio = logPhi2.sub(logPhi1).div(h); } else { final RandomVariable x = underlyingAtMaturity.div(underlyingAtToday).log().sub(r.mult(T).sub(sigma.squared().mult(0.5*T))).div(sigma).div(Math.sqrt(T)); likelihoodRatio = x.div(underlyingAtToday).div(sigma).div(Math.sqrt(T)); }