# naginterfaces.library.rand.bb_​init¶

naginterfaces.library.rand.bb_init(t0, tend, times)[source]

bb_init initializes the Brownian bridge generator bb(). It must be called before any calls to bb().

For full information please refer to the NAG Library document for g05xa

https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/g05/g05xaf.html

Parameters
t0float

The starting value of the time interval.

tendfloat

The end value of the time interval.

timesfloat, array-like, shape

The points in the time interval at which the Wiener process is to be constructed. The order in which points are listed in determines the bridge construction order. The function bb_make_bridge_order() can be used to create predefined bridge construction orders from a set of input times.

Returns
commdict, communication object

Communication structure.

Raises
NagValueError
(errno )

An unexpected error occurred during execution of bb_init. Please contact NAG with the following error message: error in , .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: for all .

(errno )

On entry, and both equal .

Constraint: all elements of must be unique.

Notes

Brownian Bridge Algorithm

Details on the Brownian bridge algorithm and the Brownian bridge process (sometimes also called a non-free Wiener process) can be found in the G05 Introduction. We briefly recall some notation and definitions.

Fix two times and let be any set of time points satisfying . Let denote a -dimensional Wiener sample path at these time points, and let be any matrix such that is the desired covariance structure for the Wiener process. Each point of the sample path is constructed according to the Brownian bridge interpolation algorithm (see Glasserman (2004) or the G05 Introduction). We always start at some fixed point . If we set where is any -dimensional standard Normal random variable, then will behave like a normal (free) Wiener process. However if we fix the terminal value , then will behave like a non-free Wiener process.

Implementation

Given the start and end points of the process, the order in which successive interpolation times are chosen is called the bridge construction order. The construction order is given by the array . Further information on construction orders is given in the G05 Introduction. For clarity we consider here the common scenario where the Brownian bridge algorithm is used with quasi-random points. If pseudorandom numbers are used instead, these details can be ignored.

Suppose we require Wiener sample paths each of dimension . The main input to the Brownian bridge algorithm is then an array of quasi-random points where each point has dimension or respectively, depending on whether a free or non-free Wiener process is required. When bb() is called, the th sample path for is constructed as follows: if a non-free Wiener process is required set equal to the terminal value , otherwise construct as

where is the matrix described in Brownian Bridge Algorithm. The array holds the remaining time points in the order in which the bridge is to be constructed. For each set , find

and

and construct the point as

where or respectively depending on whether a free or non-free Wiener process is required. Note that in our discussion is indexed from , and so is interpolated between the nearest (in time) Wiener points which have already been constructed. The function bb_make_bridge_order() can be used to initialize the array for several predefined bridge construction orders.

References

Glasserman, P, 2004, Monte Carlo Methods in Financial Engineering, Springer