---
title: "Math 339SP -- Matrix products"
author: "Tim Chumley"
date: "Spring 2022"
output:
pdf_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tinytex)
library(expm)
```
# Matrix power calculations
The commands below demonstrate how to input a matrix, entry by entry,
and do some computations with matrix multiplication and exponentiation.
```{r}
P = matrix(c(0, 1/3, 0, 1/3, 1/3, 0,
1/2, 0, 0, 1/2, 0, 0,
0, 0, 0, 1/2, 1/2, 0,
1/4, 1/4, 1/4, 0, 1/4, 0,
1/4, 0, 1/4, 1/4, 0, 1/4,
0, 0, 0, 0, 1, 0), nrow = 6, ncol = 6, byrow = T)
(P %^% 3)[4,5]
(P %^% 10)[2,5]
(P %^% 8)[1,3]
P %^% 25
P %^% 50
P %^% 75
```