music.PlainChanges

class music.PlainChanges(nelements=4, nhunts=None, hunts=None)[source]

Bases: object

Presents plain changes as swaps and acts in domains to make peals.

__init__(nelements=4, nhunts=None, hunts=None)[source]

Initializes a PlainChanges object.

Parameters:
nelementsint, optional

The number of elements. Defaults to 4.

nhuntsint, optional

The number of hunts. Defaults to None.

huntsdict, optional

The hunts dictionary. Defaults to None.

Raises:
ValueError

If the number of hunts is invalid.

Methods

__init__([nelements, nhunts, hunts])

Initializes a PlainChanges object.

act([domain, peal])

Acts in a domain using a peal.

act_all([domain])

Acts in all peals using a domain.

initialize_hunts([nelements, nhunts])

Initializes the hunts dictionary.

perform_change(nelements, hunts[, hunt])

Performs a change procedure.

perform_peal(nelements[, hunts])

Performs a peal.

saturating_hunts(nelements)

Number of hunts that yields a peal over the whole symmetric group.

static saturating_hunts(nelements)[source]

Number of hunts that yields a peal over the whole symmetric group.

For nelements bells this is nelements - 3, floored at one. Below it the peal is a proper subset of the permutations: with the old default of two hunts, PlainChanges(6) produced 120 of the 720 rows and PlainChanges(8) produced 224 of 40320. Above it nothing is gained, which is what the warning in initialize_hunts reports.

Parameters:
nelementsint

The number of elements.

Returns:
int

The saturating number of hunts.

initialize_hunts(nelements=4, nhunts=None)[source]

Initializes the hunts dictionary.

Parameters:
nelementsint, optional

The number of elements. Defaults to 4.

nhuntsint, optional

The number of hunts. Defaults to the value of saturating_hunts(nelements), which is the number that makes the peal traverse every permutation exactly once. Pass a smaller value deliberately for a shorter peal.

Returns:
dict

The hunts dictionary.

Raises:
ValueError

If the number of hunts is invalid.

perform_peal(nelements, hunts=None)[source]

Performs a peal.

Parameters:
nelementsint

The number of elements.

huntsdict, optional

The hunts dictionary. Defaults to None.

Returns:
dict

The updated hunts dictionary.

perform_change(nelements, hunts, hunt=None)[source]

Performs a change procedure.

Parameters:
nelementsint

The number of elements.

huntsdict

The hunts dictionary.

huntstr, optional

The current hunt. Defaults to None.

Returns:
Permutation

The permutation of the change.

dict

The updated hunts dictionary.

act(domain=None, peal=None)[source]

Acts in a domain using a peal.

Parameters:
domainlist, optional

The domain. Defaults to None.

peallist, optional

The peal. Defaults to None.

Returns:
list

The acted domain.

act_all(domain=None)[source]

Acts in all peals using a domain.

Parameters:
domainlist, optional

The domain. Defaults to None.