Wolfram Computation Meets Knowledge

Mathematica Manages Financial Risk

Finance professionals have been using Mathematica for years to optimize portfolios, develop and refine analytic risk models, rapidly prototype products and trading strategies, deploy analysis tools over the web, and much more.

Not surprisingly, we’ve seen increased interest in Mathematica‘s financial applications stemming from the current economic struggles. Accurate models and analyses are in demand to determine the best way to get the world’s economy back on track and prevent future crises.

That’s a great match for Mathematica‘s powerful capabilities.

To showcase how effective Mathematica is, we designed a portal to demonstrate its capabilities for financial applications. The new Mathematica Solution for Financial Risk Management web page, which I researched and created, is a comprehensive overview of what Mathematica can do in finance.

On the page, you’ll find tutorials, articles, documentation, and other resources to get you started. You can also view telling case-study videos and written descriptions of how finance professionals use Mathematica to get their jobs done.

For example, in one user story Fannie Mae economist Bernard Gress details how he created new mortgage-forecasting models utilizing Mathematica. In another, Alan Savoy of nGenera discusses combining Mathematica and webMathematica to build an online financial analysis tool.

One of the things I enjoyed personally about the project was going through the financial category of the Wolfram Demonstrations Project. There are currently nearly 200 financial Demonstrations—some of them tools created by finance professionals to use in their work, some of them created by educators to teach certain concepts (I admit I found those really useful), and some written by developers to show off various things Mathematica can do in the world of finance. And all the code used to create them is freely available, making them a great starting point for your own explorations.

I’d like to share some Demonstrations I think you’ll enjoy.

The Constant Risk Aversion Utility Functions Demonstration by Seth Chandler is interesting because it requires Mathematica to solve a second-order differential equation symbolically in real time whenever the parameters are changed, to plot utility functions that exhibit constant risk aversion under the Arrow-Pratt measure.

Constant Risk Aversion Utility Functions

You can choose whether to show the constant absolute risk aversion curve or the constant relative risk aversion curve, vary the risk aversion coefficient, and set the coefficient’s value at two points along the curve.

Jason Cawley’s Credit Risk Demonstration looks at 30 years of actual data on corporate bond performance, then creates a Markov chain model of credit risk. Using Mathematica‘s ability to manipulate lists of data and create visualizations, the Demonstration shows how the ratings of 100 simulated bonds change over time.

Credit Risk

When using the tool, you can adjust the maturity, the length of call protection, the starting rating, and the subordination, or choose a new random seed for the simulation.

Robustness of the Longstaff-Schwartz LSM Method of Pricing American Derivatives by Andrzej Kozlowski uses the Longstaff-Schwartz least squares Monte Carlo method of computing the value of an American put option, approximated by a Bermudan option with 50 exercise times. It’s an intriguing Demonstration because it shows how Mathematica Demonstrations can be used to study problems in current financial research; the author references two journal articles.

Robustness of the Longstaff-Schwartz LSM Method of Pricing American Derivatives

In it you can select three kinds of bases and can vary several parameters including degree and number of paths of the Monte Carlo sample. The Demonstration produces a plot of the expected cash flow vs. stock price.

These are just a few of the Demonstrations that show how financial professionals use Mathematica to model, compute, and analyze.

When you get a moment, check out the Mathematica Solution for Financial Risk Management website. Let us know what you think, and also let us know how you’re using Mathematica in your financial work—leave your comments below.


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.


  1. Hello,

    One aspect that interests me very much, but where I don’t find sufficient information on, is an overview of the different add-on packages for Mathematica in the field of finance. There are quite a few packages (examples: Finance Essentials, UnRisk and Derivatives Expert), but it’s difficult to find information on what these packages do exactly. It would also be interesting to know how many functions are common to some of these packages. Does a package like Derivatives Expert include some/all the functions of Finance Essentials?

    So far the only information I found was information on each single one of these packages, but no comparative information.

    Any ideas?

  2. I have been reading at more mechanical ways of trading recently after the Market Wizzards book. I will check it out.