Finance
BrownianMotion
define one- or multi-dimensional Brownian motion process
Calling Sequence
Parameters
Options
Description
Examples
References
Compatibility
BrownianMotion(x0, mu, sigma, opts)
BrownianMotion(x0, mu, sigma, t, opts)
BrownianMotion(X0, Mu, Sigma)
x0
-
real constant; initial value
mu
algebraic expression, operator or procedure; drift parameter
sigma
algebraic expression, operator, procedure or a one-dimensional stochastic process; volatility
t
time parameter
X0
Vector; initial value
Mu
Vector; drift parameter
Sigma
Matrix; covariance matrix
opts
(optional) equation(s) of the form option = value where option is scheme; specify options for the BrownianMotion command
scheme = unbiased or Euler -- This option specifies which discretization scheme should be used for simulating this process.
The BrownianMotion(x0, mu, sigma) and BrownianMotion(x0, mu, sigma, t) commands create a new one-dimensional Brownian motion process. This is a stochastic process X⁡t, which is governed by the stochastic differential equation (SDE)
dX⁡t=μ⁡t⁢dt+σ⁡t⁢dW⁡t
where
μ=μ⁡t is the drift,
σ=σ⁡t is the volatility,
and
W⁡t is the standard Wiener process.
The parameter x0 defines the initial value of the underlying stochastic process. It must be a real constant.
In the simplest case of a constant drift, mu is a real number (i.e. any expression of type realcons). Time-dependent drift can be given either as an algebraic expression or as a Maple procedure. If mu is given as an algebraic expression, then the parameter t must be passed to specify which variable in mu should be used as a time variable. Maple procedure defining a time-dependent drift must accept one parameter (the time) and return the corresponding value for the drift.
Similar to the drift, the volatility parameter can be constant or time dependent. In addition to this, the volatility can involve other (one-dimensional) stochastic variables. Note that stochastic drift is not supported.
The BrownianMotion(X0, Mu, Sigma) defines an n-dimensional Brownian motion with drift Mu and covariance Sigma. This process is defined by the SDE
dX⁡t=Μ⁢dt+B⁢dW⁡t
Μ is a vector of size n,
B is a n×m-matrix B⁢BT=Σ,
W⁡t is the standard m-dimensional Wiener process.
In this case the drift vector and the covariance matrix are time-independent. The drift parameter Mu must be given as a Vector and the covariance matrix Sigma must be a given as a symmetric matrix (see Matrix).
The scheme option specifies the discretization scheme used for simulation of this process. By default the standard Euler scheme is used. When scheme is set to unbiased the transition density will be used to simulate a value X⁡t+dt given X⁡t. This scheme is appropriate in the case of a time-dependent drift and/or volatility.
with⁡Finance:
T≔2.0
First consider the case of a one-dimensional Brownian motion with constant drift and volatility.
X≔BrownianMotion⁡0.,0.02,0.3:
A≔SamplePath⁡X⁡t,t=0..T,timesteps=100,replications=10
PathPlot⁡X⁡t,t=0..T,timesteps=100,replications=10,axes=BOXED,gridlines=true
Compute the drift and diffusion for functions of X.
W≔BrownianMotion⁡1,μ⁡t,σ⁡t,t
W≔_X1
Drift⁡W⁡u
μ⁡u
Diffusion⁡W⁡u
σ⁡u
Drift⁡exp⁡W⁡u
μ⁡u⁢ⅇ_X1⁡u+σ⁡u2⁢ⅇ_X1⁡u2
Here is an example of a one-dimensional Brownian motion with time-dependent parameters given in algebraic form.
μ≔piecewise⁡t<1,0.02,0.02t
μ≔0.02t<10.02totherwise
σ≔evalf3⁡CurveFitting:-Spline⁡0,0.5,1,0.3,1.5,1.5,2,1.0,t,degree=3
σ≔0.500−1.40⁢t+1.20⁢t3t<1.−1.90+2.20⁢t+3.60⁢t−1.2−6.40⁢t−1.3t<1.51.00⁢t−6.00⁢t−1.52+4.00⁢t−1.53otherwise
Y≔BrownianMotion⁡0.,μ,σ,t:
S≔SamplePath⁡Y⁡t,t=0..T,replications=106:
Here is the same example but with drift and volatility given in the form of Maple procedures.
μ≔unapply⁡μ,t
μ≔t↦0.02t<10.02totherwise
σ≔unapply⁡σ,t
σ≔t↦0.500−1.40⋅t+1.20⋅t3t<1.−1.90+2.20⋅t+3.60⋅t−1.2−6.40⋅t−1.3t<1.51.00⋅t−6.00⋅t−1.52+4.00⋅t−1.53otherwise
Z≔BrownianMotion⁡0.,μ,σ:
S≔PathPlot⁡Z⁡t,t=0..T,replications=10,axes=BOXED:
Here is an example of a two-dimensional Brownian motion.
X0≔Vector⁡0.,0.
X0≔0.0.
Μ≔Vector⁡0.2,0.3
Μ≔0.20.3
Σ≔Matrix⁡1.0,0.05,0.5,1.0
Σ≔1.00.050.51.0
W≔BrownianMotion⁡X0,Μ,Σ
W≔_X4
SamplePath⁡W⁡t,t=0..T,replications=105
You can simulate values for any path function given as a Maple procedure.
V≔SampleValues⁡X↦X1,2+X2,2,W,0..T,replications=105:
StatisticsDataSummary⁡V
mean=0.988749213777756standarddeviation=2.04881151111321skewness=0.00386575235144395kurtosis=2.99903802870409minimum=−7.10227512307098maximum=9.60382569520030cumulativeweight=100000.
StatisticsHistogram⁡V,bincount=100
Here are examples involving stochastic volatility.
R≔OrnsteinUhlenbeckProcess⁡0.5,1.0,0.5,0.3
R≔_X5
Y≔BrownianMotion⁡0,0.,R⁡t2,t
Y≔_X7
PathPlot⁡Y⁡t,t=0..3,timesteps=100,replications=10,axes=BOXED,gridlines=true
Here is the same using different discretization schemes. For presentation purposes let us consider a Brownian motion with very low volatility and time-dependent drift. Compare the simulated results with the corresponding solution of an ordinary (non-stochastic) differential equation.
f≔sin⁡t
W1≔BrownianMotion⁡0,f,0.001,t
W1≔_X8
W2≔BrownianMotion⁡0,f,0.001,t,scheme=unbiased
W2≔_X9
W3≔eval⁡y⁡t,dsolve⁡diff⁡y⁡t,t=sin⁡t,y⁡0=0
W3≔−cos⁡t+1
plotsdisplay⁡plot⁡W3,t=0..3,PathPlot⁡W1⁡t,t=0..3,timesteps=10,replications=10,thickness=3,axes=BOXED,gridlines
plotsdisplay⁡plot⁡W3,t=0..3,PathPlot⁡W2⁡t,t=0..3,timesteps=10,replications=10,thickness=3,axes=BOXED,gridlines
Glasserman, P., Monte Carlo Methods in Financial Engineering. New York: Springer-Verlag, 2004.
Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.
The Finance[BrownianMotion] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
Finance[BlackScholesProcess]
Finance[CEVProcess]
Finance[Diffusion]
Finance[Drift]
Finance[ExpectedValue]
Finance[GeometricBrownianMotion]
Finance[ItoProcess]
Finance[PathPlot]
Finance[SamplePath]
Finance[SampleValues]
Finance[StochasticProcesses]
Finance[WienerProcess]
Download Help Document