inst/doc/representation.R

## ----set-options, echo = FALSE------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", dev = "png", fig.width = 7, fig.height = 3.5, message = FALSE, warning = FALSE)
options(width = 80, tibble.width = Inf)

## -----------------------------------------------------------------------------
library("permutations")
options("print_word_as_cycle" = FALSE)

## -----------------------------------------------------------------------------
a <- as.word(char2cycle("(175296)(348)"))
b <- as.word(char2cycle("(27)(45)(89)"))
a
b

## -----------------------------------------------------------------------------
M <- diag(9)
rownames(M) <- 1:9
colnames(M) <- 1:9
M

## -----------------------------------------------------------------------------
M[a,]

## -----------------------------------------------------------------------------
all(M[as.word(id,9),] == diag(9))
all(M[a*b,] == M[a,] %*% M[b,])

## -----------------------------------------------------------------------------
all(M[inverse(a),] == solve(M[a,]))

## -----------------------------------------------------------------------------
all(M[,a*b] == M[,a] %*% M[,b])

## -----------------------------------------------------------------------------
all(M[,b*a] == M[,a] %*% M[,b])

Try the permutations package in your browser

Any scripts or data that you put into this service are public.

permutations documentation built on March 7, 2023, 8:26 p.m.