Considering the vector of assets i weight in the portfolio (with constrain ) and  the vector of expect returns on the corresponding assets.

Considering the volatility of the given asset, corresponding to the standard deviation of the normal distribution of returns (and thus the risk), and the correlation between assets.

The Total Return is given by:

And the Total Risk is

with

the covariance matrix with elements