A random simulation is faster than an analytical solution, which also takes too much memory. Every blue point is defined by the equations

and

, where

are the contributions of asset

,

,

to a portfolio,

is the covariance of assets

and

,

is the expected return of asset

. The second control, "CML & efficient frontier", finds the efficient frontier, which consists of all the points that give the best return at the same level of volatility and the curve is nondecreasing. The more points we use for the simulation, the smoother the efficient frontier. The efficient frontier is necessary for finding the CML. A CML is defined by equation

. Here

is the expected return,

is the risk-free return,

is the slope of the line, and

is the volatility. The only unknown element is

, but we know that CML is tangent to the efficient frontier; the highest possible slope of the line is defined by two points: a risk-free return and a point on the efficient frontier. The third control "two companies combined" shows a trajectory of a portfolio that is composed of two companies. Every point of the trajectory is defined by equations

and

, where

is the contribution of asset 1 to a portfolio,

is the contribution of asset 2 to a portfolio,

is the expected return of asset 1,

is the expected return of asset 2,

is the volatility of the portfolio,

is the variation of asset 1,

is a variation of asset 2, and

is the covariance of assets 1 and 2. Here

,

, with the restriction

.