define one- or multi-dimensional Brownian motion process - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Finance : Stochastic Processes : Finance/BrownianMotion

Finance[BrownianMotion] - define one- or multi-dimensional Brownian motion process

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

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:

T:=2.0

T:=2.0

(1)

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

X:=BrownianMotion0.0,0.02,0.3:

A:=SamplePathXt,t=0..T,timesteps=100,replications=10

A:= 1..10 x 1..101 ArrayData Type: float8Storage: rectangularOrder: C_order

(2)

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

Compute the drift and diffusion for functions of X.

W:=BrownianMotion1,μt,σt,t

W:=_X0

(3)

DriftWu

μu

(4)

DiffusionWu

σu

(5)

DriftⅇWu

μuⅇ_X0u+12σu2ⅇ_X0u

(6)

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

&mu;:=piecewiset<1&comma;0.02&comma;0.02t

&mu;:=&lcub;0.02t<10.02totherwise

(7)

&sigma;:=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&equals;3

&sigma;:=&lcub;0.5001.40t&plus;1.20t3t<1.1.90&plus;2.20t&plus;3.601.&plus;t26.401.&plus;t3t<1.51.t6.t1.52&plus;4.t1.53otherwise

(8)

Y:=BrownianMotion0.0&comma;&mu;&comma;&sigma;&comma;t&colon;

S:=SamplePathYt&comma;t&equals;0..T&comma;replications&equals;106&colon;

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

&mu;:=unapply&mu;&comma;t

&mu;:=t&rarr;piecewiset<1&comma;0.02&comma;0.02t

(9)

&sigma;:=unapply&sigma;&comma;t

&sigma;:=t&rarr;piecewiset<1.&comma;0.5001.40t&plus;1.20t3&comma;t<1.5&comma;1.90&plus;2.20t&plus;3.601.&plus;t26.401.&plus;t3&comma;1.t6.t1.52&plus;4.t1.53

(10)

Z:=BrownianMotion0.0&comma;&mu;&comma;&sigma;&colon;

S:=PathPlotZt&comma;t&equals;0..T&comma;replications&equals;10&comma;axes&equals;BOXED&colon;

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

X0:=Vector0.0&comma;0.0

X0:=0.0.

(11)

&Mu;:=Vector0.2&comma;0.3

&Mu;:=0.20.3

(12)

&Sigma;:=Matrix1.0&comma;0.05&comma;0.5&comma;1.0

&Sigma;:=1.00.050.51.0

(13)

W:=BrownianMotionX0&comma;&Mu;&comma;&Sigma;

W:=_X3

(14)

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

1..100000 x 1..2 x 1..2 ArrayData Type: float8Storage: rectangularOrder: C_order

(15)

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

V:=SampleValuesX&rarr;X1&comma;2&plus;X2&comma;2&comma;W&comma;0..T&comma;replications&equals;105&colon;

Statistics&lsqb;DataSummary&rsqb;V

mean&equals;0.988749213777756standarddeviation&equals;2.04881151111321skewness&equals;0.00386575235144395kurtosis&equals;2.99903802870409minimum&equals;7.10227512307098maximum&equals;9.60382569520030cumulativeweight&equals;1.00000105

(16)

Statistics&lsqb;Histogram&rsqb;V&comma;bincount&equals;100

Here are examples involving stochastic volatility.

R:=OrnsteinUhlenbeckProcess0.5&comma;1.0&comma;0.5&comma;0.3

R:=_X4

(17)

Y:=BrownianMotion0&comma;0.0&comma;Rt2&comma;t

Y:=_X6

(18)

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

f:=sint

(19)

W1:=BrownianMotion0&comma;f&comma;0.001&comma;t

W1:=_X7

(20)

W2:=BrownianMotion0&comma;f&comma;0.001&comma;t&comma;scheme&equals;unbiased

W2:=_X8

(21)

W3:=evalyt&comma;dsolve&DifferentialD;&DifferentialD;tyt&equals;sint&comma;y0&equals;0

W3:=cost&plus;1

(22)

plots&lsqb;display&rsqb;plotW3&comma;t&equals;0..3&comma;PathPlotW1t&comma;t&equals;0..3&comma;timesteps&equals;10&comma;replications&equals;10&comma;thickness&equals;3&comma;axes&equals;BOXED&comma;gridlines

plots&lsqb;display&rsqb;plotW3&comma;t&equals;0..3&comma;PathPlotW2t&comma;t&equals;0..3&comma;timesteps&equals;10&comma;replications&equals;10&comma;thickness&equals;3&comma;axes&equals;BOXED&comma;gridlines

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]

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.


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam