How can you compute Itō Integrals with Mathematica? I tried searching through the documentations but I didn't find anything.

P.S. I was not at all sure how to tag this question. I had to put in at least one tag, and I do not have enough reputation to create a new one. Somebody with more rep can feel free to tag it appropriately.

  • 1
    $\begingroup$ I could explain how to solve a Stratonovich SDE (which is simply related to an Ito SDE). Would that be enough or do you need more? $\endgroup$
    – acl
    Commented Mar 18, 2012 at 11:21
  • 1
    $\begingroup$ What is an Itô Integral? (please include links to this kind of information in your questions) $\endgroup$
    – Mr.Wizard
    Commented Mar 18, 2012 at 12:31

5 Answers 5


While I cannot answer your question I would like to point at Computational Financial Mathematics using MATHEMATICA®: Optimal Trading in Stocks and Options, which should answer it.

From the index: Mathematica graphics

  • $\begingroup$ Welcome to Mathematica.SE Guido! I changed the link to the American Amazon store instead of the German one to make it somewhat more useful to the general public here, and added a part of the index that I hope will be relevant in judging whether or not this book is useful. I note that the book is from 2002, so that is multiple versions of MMA ago. $\endgroup$ Commented Mar 18, 2012 at 13:45
  • $\begingroup$ Thanks for helping out. I need to learn more about the 'rules of the road' on a forum like this one. $\endgroup$
    – gwr
    Commented Mar 18, 2012 at 14:32
  • $\begingroup$ The cited book by Stojanovic will of course be obsolescent is some regards, given that it was published in 2002, well before the whole bundle of financial functions were added. $\endgroup$
    – murray
    Commented Mar 18, 2012 at 15:30
  • $\begingroup$ Glad to be of service.If you need any help several useful links are on top of the page. There's the ubiquitous FAQ, but also for informal chatting our chat room and for formal questions about the function of the site itself our meta-site. On the meta site you'll also find a MMA tool to automatically upload MMA graphics here. $\endgroup$ Commented Mar 18, 2012 at 15:40
  • $\begingroup$ @SjoerdC.deVries That tool is a godsend. I used to avoid questions that required a graphics upload. $\endgroup$
    – tkott
    Commented Mar 19, 2012 at 18:34

Mathematica doesn't have built-in functions to compute things around Ito integrals.

I know two authors who have done packages around this, I've never used them though.

From Mark Fisher (see the stochastic calculus paragraph for ItosLemma and EulerSimulate packages) http://www.markfisher.net/~mefisher/mma/mathematica.html

From Wilfrid Kendall

Here's an example of how you could generate paths of a Black-Scholes process. You can generalize this example to more complex cases (if you look for optimizations you'll find that inverting the FoldList and Map leads to a better speed but the code is less readable.)

SimpleBSPaths[S0_,r_,sigma_,nPaths_,dt_,nTimeSteps_,seed_:1] :=
Module[ {randomNumbers},


    randomNumbers = RandomReal[NormalDistribution[],{nPaths,nTimeSteps-1}];

    Map[ (*equivalent to a loop for each path*)
        FoldList[ (*equivalent to a loop for each timestep*)
            (#1 Exp[(r-1./2 sigma^2) dt + sigma Sqrt[dt] #2])& (*#1= St-1, #2=n01 for this path and timestep*)
            # (*all random numbers for this path, has dimension {nTimeSteps-1}*)
        ]& (*produced path of dimension {nTimeSteps}*)
        randomNumbers (*all random numbers for all paths, has dimension {nPaths,nTimeSteps-1}*)
    ] (*produced paths of dimension {nPaths,nTimeSteps}*)



Similarly for correlated Black-Scholes paths

SimpleMultiBSPaths[S0_,r_,sigma_,correlMatrix_,nPaths_,dt_,nTimeSteps_,seed_:1] :=
    Module[ {randomNumbers,sigmaDiag,covar,A, numberOfUnderlyings},


        sigmaDiag = DiagonalMatrix@sigma;
        covar = sigmaDiag.correlMatrix.sigmaDiag;
        A = Transpose@CholeskyDecomposition@covar;

        randomNumbers = RandomReal[NormalDistribution[],{nPaths,nTimeSteps-1,numberOfUnderlyings}];

        Map[ (*equivalent to a loop for each path*)
            FoldList[ (*equivalent to a loop for each timestep*)
                (#1 Exp[(r-1./2 sigma^2) dt + Sqrt[dt] A.#2])& (*#1= St-1, #2=n01s for this path and timestep*)
                # (*all random numbers for this path, has dimension {nTimeSteps-1,numberOfUnderlyings}*)
            ]& (*produced path of dimension {nTimeSteps,numberOfUnderlyings}*)
            randomNumbers (*all random numbers for all paths, has dimension {nPaths,nTimeSteps-1,numberOfUnderlyings}*)
        ] (*produced paths of dimension {nPaths,nTimeSteps,numberOfUnderlyings}*)


S0 = {100, 105};
r = 0.03;
sigma = {0.2, 0.3};
correlMatrix = {{1., 0.8}, {0.8, 1.}};
nPaths = 5;
dt = 1/12.;
nTimeSteps = 24;
paths = SimpleMultiBSPaths[S0, r, sigma, correlMatrix, nPaths, dt, nTimeSteps];
(*Displays two correlated underlyings on one path*)
paths[[1]] // Transpose // ListLinePlot
  • $\begingroup$ Well done. Can you implement the Euler-Maruyama or SRK method for finding the weak solution of Black-Scholes SDE in Mathematica? $\endgroup$
    – Faz
    Commented Sep 1, 2013 at 16:23

One good way would be to attend my Warsaw University seminar ;-) Seriously, you should specify if you are interested in symbolic or numerical computation. It is a very different thing (just as in the stochastic case) Stojanovic's book has a nice implementation of the multi-dimensional Ito formula - which is essentially a (continuous) stochastic calculus analogue of the chain rule in ordinary calculus. Since it is a lot more complicated than the chain rule, it is useful to be able to use a computer algebra system for this purpose. Computing Ito integrals numerically is quite a different matter and is basically the same thing as "simulation". Stojanovic implementation is for Mathematica 3 so it is way too inefficient compared with what you can do in version 6 and later. Remember - the key thing is that it is much faster to generate random vectors and arrays than individual random numbers that are their elements.


Well, for numerical Ito integrals you could always take a look at my old demonstration on Wolfram's Demonstrations Project.

  • 1
    $\begingroup$ Both, actually. I am taking a course in Financial Mathematics, and we rely on hand calculation and Excel. I trust neither my hand calculations nor Excel, so I figured I ought try doing this in Mathematica, hence the question. $\endgroup$
    – Mr Alpha
    Commented Mar 20, 2012 at 17:42

There are a few entries in Wolfram's library concerning stochastic integrals:

Ito's Lemma

Binomial Option Pricing, the Black-Scholes Option Pricing Formula, and Exotic Options

Black-Scholes Option Pricing Model

MathSource Reviews: The Black-Scholes Equation for European Call Options

and a Mathematica Journal article:

Stochastic Integrals and Their Expectations


It looks like Wolfram have written some stochastic stuff for their finance platform:


These are presumably internally written (by Michael Kelly?) add on packages.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.