Random Simulation of a Financial Portfolio

This Demonstration uses random number generation to create a portfolio with up to 30 elements (represented by red points) taken from the Dow Jones Industrial Average using data from 2003 to 2010. The yellow point shows a portfolio with weight 1/30 for each asset. The program finds the efficient frontier according to modern portfolio theory and shows the capital market line (CML) from the 1500 generated points. The CML consists of the risk-free asset's return and market portfolio lying on the efficient frontier. The combination of the two companies shows possible trajectories of the portfolio according to the correlation.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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 .
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+