leapfrog: Leapfrog steps

Description Usage Arguments Examples

Description

Leapfrog steps

Usage

1
leapfrog(qp, dUdq, Minv, eps, L = 1L)

Arguments

qp

data frame with columns q and p denoting the position and momentum of the particles respectively

dUdq

derivative of potential energy

Minv

inverse of the mass matrix

eps

step-size

L

number of steps to simulate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
nt <- 30
qp <- data.frame(q=0,p=1)
eps_gen <- function() 0.3
Minv = matrix(1,1,1)

dUdq <- function(q) q

for(i in 1:(nt-1))
  qp[i+1,] <- leapfrog(qp = qp[1,], dUdq = dUdq, Minv = Minv,eps = eps_gen(),L=i)

plot(qp$q,qp$p)

andrewzm/hmc documentation built on May 10, 2019, 11:15 a.m.