@Test
public void testMixedLogNormalVolSurface() {
final AffineDividends dividends = AffineDividends.noDividends();
final ForwardCurve fwdCurve = new ForwardCurve(SPOT, DRIFT);
final double sigma1 = 0.2;
final double sigma2 = 1.0;
final double w = 0.9;
final Function<Double, Double> surf = new Function<Double, Double>() {
@Override
public Double evaluate(final Double... x) {
final double t = x[0];
final double k = x[1];
@SuppressWarnings("synthetic-access")
final double fwd = fwdCurve.getForward(t);
final boolean isCall = k > fwd;
final double price = w * BlackFormulaRepository.price(fwd, k, t, sigma1, isCall) + (1 - w) * BlackFormulaRepository.price(fwd, k, t, sigma2, isCall);
return BlackFormulaRepository.impliedVolatility(price, fwd, k, t, isCall);
}
};