Learn R Programming

sdetorus (version 0.1.10)

driftWn2D: Drift of the WN diffusion in 2D

Description

Computes the drift of the WN diffusion in 2D in a vectorized way.

Usage

driftWn2D(x, A, mu, sigma, rho = 0, maxK = 2L, expTrc = 30)

Value

A matrix of size c(n, 2) containing the drift evaluated at x.

Arguments

x

a matrix of dimension c(n, 2) containing angles. They all must be in \([\pi,\pi)\) so that the truncated wrapping by maxK windings is able to capture periodicity.

A

drift matrix of size c(2, 2).

mu

a vector of length 2 giving the mean.

sigma

vector of length 2 containing the square root of the diagonal of \(\Sigma\), the diffusion matrix.

rho

correlation coefficient of \(\Sigma\).

maxK

maximum absolute value of the windings considered in the computation of the WN.

expTrc

truncation for exponential: exp(x) with x <= -expTrc is set to zero. Defaults to 30.

Examples

Run this code
alpha <- 3:1
mu <- c(0, 0)
sigma <- 1:2
rho <- 0.5
Sigma <- diag(sigma^2)
Sigma[1, 2] <- Sigma[2, 1] <- rho * prod(sigma)
A <- alphaToA(alpha = alpha, sigma = sigma, rho = rho)
x <- rbind(c(0, 1), c(1, 0.1), c(pi, pi), c(-pi, -pi), c(pi / 2, 0))
driftWn2D(x = x, A = A, mu = mu, sigma = sigma, rho = rho)
driftWn(x = x, A = A, mu = c(0, 0), Sigma = Sigma)

Run the code above in your browser using DataLab