Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Itovsn3

Guides

  • Main

Tech Notes

  • Bessel
  • BlackScholes
  • ItoArea
  • MardiaDryden
  • Reflect
  • Stochastic Integration

Symbols

  • AddDrift
  • AddFixed
  • AddQuadVar
  • Brktbydt
  • BrownBasis
  • BrownSingle
  • BSDQ
  • Drftbydt
  • Drift
  • Fixed
  • GetItoProc
  • InitialValue
  • Introduce
  • ItoD
  • ItoExpand
  • ItoInit
  • ItoIntegral
  • ItoReset
  • Itosde
  • ItoStatus
  • RandomQ
ItoArea
Set up the semimartingale framework
Contact Information
The basic calculation
Acknowledgements
Analysis of the criterion
References
Compute the answer
​
Author Information
Wilfrid S . Kendall
Statistics, University of Warwick,
Coventry CV4 7 AL, UK.
Purpose
This is a Mathematica notebook to introduce a simple application of Ito calculus. It computes the distribution of the Levy stochastic area at fixed time t, using a method due to S. Jansson.
IMPORTANT
This notebook assumes nothing has been previously defined. Quit Mathematica and reload if this is not the case!
Load package
In[1]:=
Needs["FernandoDuarte`Itovsn3`"]
Set up the semimartingale framework
Initialization of Itovsn3: the basic time semimartingale is t, X and Y are introduced as independent scalar Brownian motions (so (X,Y) is a two-dimensional Brownian motion) and we use Itosde to set up the stochastic area process A:
In[2]:=
ItoReset
[t,dt]​​
BrownBasis
[{X,Y},{0,0}]​​
Itosde
[A,dAXdY-YdX,0]​​
ItoStatus
[]
Out[2]//TableForm=
Itovsn3 resetting ...
Itovsn3 initialized
with time semimartingale t
and time differential dt
Out[5]=
Summary of current structure of stochastic differentials
Current second-order structure of semimartingale differentials:
dA
dY
dX
dt
dA
dt
2
X
+dt
2
Y
dtX
-dtY
0
dY
dtX
dt
0
0
dX
-dtY
0
dt
0
dt
0
0
0
0
Current first-order structure of semimartingale differentials:
dA
dY
dX
dt
0
0
0
dt
Current initial values:
A
Y
X
t
0
0
0
0
The basic calculation
For constant u, consider when the expression exp(V) is a local martingale. Here alpha and beta are undetermined deterministic functions vanishing at the target time t0.
In[6]:=
SetAttributes[u,Constant];​​Print"V=",V=IuA-
1
2
α[t](
2
X
+
2
Y
)+β[t]
V=Au-
1
2
(
2
X
+
2
Y
)α[t]+β[t]
The drift of exp(V) should vanish, so we calculate it as the first step towards a solution:
In[8]:=
criterion=Together
Drift

ItoD
[Exp[V]]
Exp[V]

Out[8]=
-
1
2
dt(
2
u
2
X
+
2
u
2
Y
+2α[t]-
2
X
2
α[t]
-
2
Y
2
α[t]
+
2
X
′
α
[t]+
2
Y
′
α
[t]-2
′
β
[t])
Analysis of the criterion
Split criterion into two parts. Notice we divide here by a stochastic differential! this is rather improper and demonstrates the weakness of this implementation: what here is legitimate might elsewhere be nonsense. The AXIOM implementation will do better, by implementing stochastic differentials as module elements which cannot be divided into each other!
In[9]:=
Print"criterion1 = ",criterion1=
criterion
dt
/.{X0,Y0}
criterion1 =
1
2
(-2α[t]+2
′
β
[t])
In[10]:=
Print"criterion2 = ",criterion2=Together
Expand
criterion
dt
-criterion1
2
X
+
2
Y

criterion2 =
1
2
(-
2
u
+
2
α[t]
-
′
α
[t])

Solve the ordinary differential equations

These criteria must both vanish if the drift is to vanish, and this leads to two ordinary differential equations. It is simple to solve the first one, using the fact that beta[t0]=0. First we define the initial time t0 as a constant:
In[11]:=
SetAttributes[t0,Constant];
Here is Mathematica's solution, using the requirement that beta should vanish at time t0:
In[12]:=
betatrial=First[DSolve[{criterion10,β[t0]0},β,t]]
Out[12]=
βFunction{t},
t
∫
1
α[K[1]]K[1]-
t0
∫
1
α[K[1]]K[1]
We see that Mathematica got it right!
In[13]:=
(criterion1/.betatrial)0&&(β[t0]/.betatrial)0
Out[13]=
True
However we have to re-arrange the solution by hand to avoid trouble with complex numbers later on.
In[14]:=
betatrial=βFunction{t},
t
∫
t0
α[K$11381]K$11381
Out[14]=
βFunction{t},
t
∫
t0
α[K$11381]K$11381
Here is Mathematica's attempt at the second criterion, this time using a requirement that alpha should vanish at time t0:
In[15]:=
alfatrial=First[DSolve[{criterion20,α[t0]0},α,t]]
Solve
:Inverse functions are being used by Solve​, so some solutions may not be found; use Reduce for complete solution information.
Out[15]=
{αFunction[{t},-uTanh[tu-t0u]]}
In Mathematica, there is a warning about inverses. Were that to be a problem we could solve the above by hand as below, but in fact the above manipulation gives the correct answer.
alfatrial={αFunction[t,-uTanh[u(t-t0)]]}
Now we check this out:
In[16]:=
Simplify[criterion2/.alfatrial]0&&(α[t0]/.alfatrial)0
Out[16]=
True
And here is a portmanteau check that criterion vanishes:
In[17]:=
Simplify[criterion/.betatrial/.alfatrial]0
Out[17]=
True
Compute the answer
The answer can now be computed: notice that Mathematica worries here about convergence of definite integrals!
In[18]:=
EVtrial=Refine[Exp[V]/.betatrial/.alfatrial,t>t0&&t0>0&&u>0]
Out[18]=
Au+
1
2
u(
2
X
+
2
Y
)Tanh[tu-t0u]

Sech[(-t+t0)u]
We confirm it has zero drift:
In[19]:=
driftdV=Simplify
Drift

ItoD
[EVtrial]0
Out[19]=
True
Subject to the integrability issue of checking that Exp[V] is a martingale, not just a local martingale (an analytic exercise we probably should not expect to do by computer algebra!), we can deduce the following:
In[20]:=
PrintExpectation
InitialValue
[0,EVtrial]
ExpectationSech[t0u]
Contact Information
Email: w.s.kendall@warwick.ac.uk
URL: http://www.warwick.ac.uk/go/WSK
Acknowledgements
The research reported here was supported by EPSRC grants GR/71677 (Stochastic calculus in AXIOM using modules of stochastic differentials) and GR/L56831 (Perfect simulation in stochastic geometry), and a joint EPSRC/BBSRC research grant (Multi-strain species modelling and control via differential algebra reductions). This Mathematica notebook was constructed on a visit to MSRI Berkeley CA during its 1997-1998 program Stochastic Analysis. Finally, it is a pleasure to express my gratitude to my friends Suzanne Scotchmer and Joseph Farrell for the generous hospitality they showed to me during my visit to MSRI.
References
A discussion of this particular application, in its original form using the implementation of Itovsn3 in the REDUCE computer algebra package:

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com