// Calculate the Black Scholes European call option Gamma double BS_Call_Option_Gamma(double S, double K, double r, double v, double T) // Parameters: (S = Current Stock Price, K = Strike Price, r = Risk-Free Rate, v = Volatility of Stock Price, T = Time to Maturity) { return Normal_PDF(d_j(1, S, K, r, v, T))/(S * v * sqrt(T)); }

const double Pi = 3.14159265359; // Standard Normal probability density function double Normal_PDF(const double & x) // Normal PDF(x) = exp(-x*x/2)/{sigma * sqrt(2 * Pi) } { return (1.0/(double)pow(2 * Pi, 0.5)) * exp(-0.5 * x * x); }