pepper: Combine variables in every possible order

Description Usage Arguments Author(s) See Also Examples

Description

Given a list of variables, construct every term comprising only those variables; function pepper() returns a free algebra object equal to the sum of these terms.

The function is named for a query from an exam question set by Sarah Marshall in which she asked how many ways there are to arrange the letters of word “pepper”, the answer being 6!/(1!2!3!)=60.

Function multiset() in the partitions package gives related functionality.

Usage

1
pepper(v)

Arguments

v

Variables to combine. If a character string, coerce to variable numbers

Author(s)

Robin K. S. Hankin

See Also

linear

Examples

1
2
pepper(c(1,2,2,2,3))
pepper("pepper")

freealg documentation built on Nov. 19, 2021, 9:07 a.m.