BrownianMotion - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Finance

  

BrownianMotion

  

define one- or multi-dimensional Brownian motion process

 

Calling Sequence

Parameters

Options

Description

Examples

References

Compatibility

Calling Sequence

BrownianMotion(x0, mu, sigma, opts)

BrownianMotion(x0, mu, sigma, t, opts)

BrownianMotion(X0, Mu, Sigma)

Parameters

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

Options

• 

scheme = unbiased or Euler -- This option specifies which discretization scheme should be used for simulating this process.

Description

• 

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 Xt, which is governed by the stochastic differential equation (SDE)

dXt=μtdt+σtdWt

where

– 

μ=μt is the drift,

– 

σ=σt is the volatility,

and

– 

Wt 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

dXt=Μdt+BdWt

where

– 

Μ is a vector of size n,

– 

B is a n×m-matrix BBT=Σ,

and

– 

Wt 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 Xt+dt given Xt. This scheme is appropriate in the case of a time-dependent drift and/or volatility.

Examples

withFinance:

T2.0

T2.0

(1)

First consider the case of a one-dimensional Brownian motion with constant drift and volatility.

XBrownianMotion0.,0.02,0.3:

ASamplePathXt,t=0..T,timesteps=100,replications=10

PathPlotXt,t=0..T,timesteps=100,replications=10,axes=BOXED,gridlines=true

Compute the drift and diffusion for functions of X.

WBrownianMotion1,μt,σt,t

W_X1

(2)

DriftWu

μu

(3)

DiffusionWu

σu

(4)

DriftexpWu

μuⅇ_X1u+σu2ⅇ_X1u2

(5)

Here is an example of a one-dimensional Brownian motion with time-dependent parameters given in algebraic form.

μpiecewiset<1&comma;0.02&comma;0.02t

μ0.02t<10.02totherwise

(6)

σevalf3CurveFitting:-Spline0&comma;0.5&comma;1&comma;0.3&comma;1.5&comma;1.5&comma;2&comma;1.0&comma;t&comma;degree=3

σ0.5001.40t+1.20t3t<1.1.90+2.20t+3.60t1.26.40t1.3t<1.51.00t6.00t1.52+4.00t1.53otherwise

(7)

YBrownianMotion0.&comma;μ&comma;σ&comma;t&colon;

SSamplePathYt&comma;t=0..T&comma;replications=106&colon;

Here is the same example but with drift and volatility given in the form of Maple procedures.

μunapplyμ&comma;t

μt0.02t<10.02totherwise

(8)

σunapplyσ&comma;t

σt0.5001.40t+1.20t3t<1.1.90+2.20t+3.60t1.26.40t1.3t<1.51.00t6.00t1.52+4.00t1.53otherwise

(9)

ZBrownianMotion0.&comma;μ&comma;σ&colon;

SPathPlotZt&comma;t=0..T&comma;replications=10&comma;axes=BOXED&colon;

Here is an example of a two-dimensional Brownian motion.

X0Vector0.&comma;0.

X00.0.

(10)

ΜVector0.2&comma;0.3

Μ0.20.3

(11)

ΣMatrix1.0&comma;0.05&comma;0.5&comma;1.0

Σ1.00.050.51.0

(12)

WBrownianMotionX0&comma;Μ&comma;Σ

W_X4

(13)

SamplePathWt&comma;t=0..T&comma;replications=105

You can simulate values for any path function given as a Maple procedure.

VSampleValuesXX1,2+X2,2&comma;W&comma;0..T&comma;replications=105&colon;

StatisticsDataSummaryV

mean=0.988749213777756standarddeviation=2.04881151111321skewness=0.00386575235144395kurtosis=2.99903802870409minimum=−7.10227512307098maximum=9.60382569520030cumulativeweight=100000.

(14)

StatisticsHistogramV&comma;bincount=100

Here are examples involving stochastic volatility.

ROrnsteinUhlenbeckProcess0.5&comma;1.0&comma;0.5&comma;0.3

R_X5

(15)

YBrownianMotion0&comma;0.&comma;Rt2&comma;t

Y_X7

(16)

PathPlotYt&comma;t=0..3&comma;timesteps=100&comma;replications=10&comma;axes=BOXED&comma;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.

fsint

fsint

(17)

W1BrownianMotion0&comma;f&comma;0.001&comma;t

W1_X8

(18)

W2BrownianMotion0&comma;f&comma;0.001&comma;t&comma;scheme=unbiased

W2_X9

(19)

W3evalyt&comma;dsolvediffyt&comma;t=sint&comma;y0=0

W3cost+1

(20)

plotsdisplayplotW3&comma;t=0..3&comma;PathPlotW1t&comma;t=0..3&comma;timesteps=10&comma;replications=10&comma;thickness=3&comma;axes=BOXED&comma;gridlines

plotsdisplayplotW3&comma;t=0..3&comma;PathPlotW2t&comma;t=0..3&comma;timesteps=10&comma;replications=10&comma;thickness=3&comma;axes=BOXED&comma;gridlines

References

  

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.

Compatibility

• 

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]