portfolio risk of an n-stcok portfolio 
//////////////////////////////////////
  Var  = Sum    sum  [ wi*wj*cov(i,j) ]           (1)
         i=1    j=1
         ->n    -> n
  where Sum is the summation for the first summation, 
        i starts from 1, end at n

        For the second summation, j starts from 1,
        end as n
                            
        wi is the weight of the ith stock
        cov(i,j) is the covariance between stocks i and j        

 Variance of a 2-stock portfolio is a special case of 
     the above formula for an n-stock portfolio 

# R code
--------
portfolio_vol<-function(ret_matrix,weight){
    m<-ncol(ret_matrix)
    m2<-length(weight)
    if(m!=m2) stop(' dimensions are not matched!!!')
    COV<-cov(ret_matrix)
    sum<-0
    for(i in 1:m)
       for(j in 1:m)
        sum<-sum + weight[i]*weight[j]*COV[i,j]
   return(sqrt(sum))
}
//////////////////////////////////////

Videos
////////////////////////////////
Brown, Jonathan,2016, Interpreting R Output For Simple Linear Regression Part 1 (EPSY 5262)
    (v452,s428k,t13:00)
    https://www.youtube.com/watch?v=u7TxjUI4PRI

Chan, Phil,2012, Statistics with R: How to redirect textual output to a file in R using sink()
    (v9k,s28k,t2:57)
    https://www.youtube.com/watch?v=4GzCtx5XMNE

Gotwals, Bob,2015, Exporting R Results
    (v40k,s428k,t3:56)
    https://www.youtube.com/watch?v=iZLCWJg0A44
////////////////////////////////

Python download module
///////////////////////////////////////////////////////

 step 1: pip install download

 Step 2: from download import download

 Step 3: help(donwload)

 Step 4: test to download a remote file
        download(infile,outfile)

///////////////////////////////////////////////////////

wordcloud Python 
///////////////////////////////////////////////////////
# pip install worldcloud                
# conda install -c https://conda.anaconda.org/conda-forge wordcloud

import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud
text = "square"
x, y = np.ogrid[:300, :300]
mask = (x - 150) ** 2 + (y - 150) ** 2 > 130 ** 2
mask = 255 * mask.astype(int)
wc = WordCloud(background_color="white", repeat=True, mask=mask)
wc.generate(text)
plt.axis("off")
plt.imshow(wc, interpolation="bilinear")
plt.show()

# https://stackoverflow.com/questions/41409570/cant-install-wordcloud-in-python-anaconda
///////////////////////////////////////////////////////