Interesting Implementations

Abstract
These are code snippets of various mathematical problems and numerical methods in Python and R that I found interesting while browsing through the internet and going through various books which don’t exactly fall into a specific category per se.

Mersenne Twister

import numpy as np

a = np.random.randn(3,4)
b = np.random.randn(1,4)
c = a+b
print (c)
[[ 0.32295651 -0.85615547  1.05162089  0.39146209]
 [-2.97129035 -1.50722391 -0.04004183  0.13532617]
 [ 1.57507404 -3.54460121 -0.21055781  0.47160234]]