Skip to content

Instantly share code, notes, and snippets.

@WalkerHarrison
Last active October 23, 2018 22:57
Show Gist options
  • Save WalkerHarrison/1b913bfa8e3b3dee744afd035e81ba99 to your computer and use it in GitHub Desktop.
Save WalkerHarrison/1b913bfa8e3b3dee744afd035e81ba99 to your computer and use it in GitHub Desktop.
library(expm)
p <- 4
mt <- rep(1, p)
G <- diag(p); G[1:(p-1), 2:p] <- G[1:(p-1), 2:p] + diag(p-1);
F <- c(1, rep(0, p-1))
print(G); print(mt); print(F)
k <- 5
G %^% k
F * ((G %^% k) %*% mt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment