private double FindPayoff(int[] p, double k) { double result = 0; if (Derivative == Derivative.Caplet) { result = _economy.CapletPayoff(p[0], k); } if (Derivative == Derivative.Swaption) { result = _economy.SwaptionPayoff(p[0], p[1], k); } if (Derivative == Derivative.Custom) { result = Payoff.Evaluate(); } return(result); }