Capital market line (source code)

= Capital market line
{title2=$m=r+\theta\sigma$}
{wiki}

In <mean-variance optimization> with unrestricted borrowing/lending, the upper efficient ray through the risk-free point has slope $\theta=\sqrt{(\mu-r\mathbf1)^T\Sigma^{-1}(\mu-r\mathbf1)}$. If $\mathbf1^T\Sigma^{-1}(\mu-r\mathbf1)>0$, it touches the risky efficient frontier at the positive-premium normalized <market portfolio>. The <Sharpe ratio> there equals the slope. If this normalization is negative, the normalized tangency portfolio instead has negative excess return; the upper ray uses a short position in that portfolio and is not tangent to the upper risky branch.