# Computational Investing Wiki

http://wiki.quantsoftware.org/index.php?title=Computational_Investing_I#Week_1

Passing by reference : This means that if we do in python

fred = squareArray

and then fred[1,1] = 0

Python does not make a copy of squareArray, rather its just passed as a reference, hence by changing fred[1,1], squareArray also gets changed.

Whereas if we want to pass by value something like

fred = squareArray.copy() should be done.

the general formula for the variance of returns for a portfolio is:

σ²(port) = ΣΣw(i)w(j)σ(i)σ(j)ρ(i,j)

where the first sum is taken over all is, and the second over all js.  Thus, for a 5-asset portfolio, the formula would be:

σ²(port) = w1²σ1² + w2²σ2² + w3²σ3² + w3²σ3² + w5²σ5²

+ 2w1w2σ1σ2ρ(1,2) + 2w1w3σ1σ3ρ(1,3) + 2w1w4σ1σ4ρ(1,4) + 2w1w5σ1σ5ρ(1,5)

+ 2w2w3σ2σ3ρ(2,3) + 2w2w4σ2σ4ρ(2,4) + 2w2w5σ2σ5ρ(2,5)

+ 2w3w4σ3σ4ρ(3,4) + 2w3w5σ3σ5ρ(3,5)

+ 2w4w5σ4σ5ρ(4,5)

ρ is covariance

https://meitham.com/2012/11/17/highest-sharpe-ratio/

http://www.investopedia.com/terms/c/capm.asp#ixzz3YFEJisis