Solution (source code)

= Solution

For positive $S_0,K,T,\sigma$, the <Black-Scholes formula> uses
$$
\boxed{d_1=\frac{\log(S_0/K)+(r+\sigma^2/2)T}{\sigma\sqrt T},\qquad d_2=d_1-\sigma\sqrt T.}
$$
To hedge the sold <European call option>, buy $\Phi(d_1)$ shares and borrow $K e^{-rT}\Phi(d_2)$ in cash. This long <replicating strategy> has initial value $S_0\Phi(d_1)-Ke^{-rT}\Phi(d_2)$, financed by the option premium. The share holding must subsequently be rebalanced according to the option's <option delta> in a <self-financing strategy>.