code: public static RandomVariableInterface blackScholesGeneralizedOptionValue(
  			RandomVariableInterface forward,
  			RandomVariableInterface volatility,
  			double optionMaturity,
  			double optionStrike,
  			RandomVariableInterface payoffUnit)
  	{
  		if(optionMaturity < 0) {
  			return forward.mult(0.0);
  		}
  		else
  		{
  			RandomVariableInterface dPlus	= forward.div(optionStrike).log().add(volatility.squared().mult(0.5 * optionMaturity)).div(volatility).div(Math.sqrt(optionMaturity));
  			RandomVariableInterface dMinus	= dPlus.sub(volatility.mult(Math.sqrt(optionMaturity)));
  
  			UnivariateFunction cumulativeNormal = new UnivariateFunction() {
  				public double value(double x) { return NormalDistribution.cumulativeDistribution(x); }
  			};
  
  			RandomVariableInterface valueAnalytic = dPlus.apply(cumulativeNormal).mult(forward).sub(dMinus.apply(cumulativeNormal).mult(optionStrike)).mult(payoffUnit);
  
  			return valueAnalytic;
  		}
  	}
docs: Calculates the Black-Scholes option value of a call, i.e., the payoff max(S(T)-K,0) P, where S follows a log-normal process with constant log-volatility.
  
  The model specific quantities are considered to be random variable, i.e.,
  the function may calculate an per-path valuation in a single call.
  
  @param forward The forward of the underlying.
  @param volatility The Black-Scholes volatility.
  @param optionMaturity The option maturity T.
  @param optionStrike The option strike. If the option strike is &le; 0.0 the method returns the value of the forward contract paying S(T)-K in T.
  @param payoffUnit The payoff unit (e.g., the discount factor)
  @return Returns the value of a European call option under the Black-Scholes model.