discrete.mac: a list of functions Andrej Vodopivec [email protected]

1

Number theory

chinese remainder(a lst, m lst): solves the system of congruences x ≡ a1

(mod m1 )

x ≡ a2 .. .

(mod m2 )

x ≡ ak

(mod mk )

The function returns [ x0 , M] such that every x, x ≡ xo for the system of congruences.

(mod M), is a solution

divisiblep(a,b): checks if a divides b. solve lde(eqn): solves a linear diophantine equation eqn. int digits(n): returns the list of digits of the integer n. num digits(b): returns the number of digits of the integer n.

2

Graph theory

The package discrete.mac loads the package graphs which is included with M AXIMA. It adds the following graph theory functions. binary tree(n): returns a binary tree of depth n. find k cycles(k, g): returns a list of all cycles of length k in the graph g. find k paths(k, g): returns a list of all paths of length k in the graph g. flow poly(g): uses the external program tutte to compute the flow polynomial of the graph g. from degree sequence(lst): construct a graph with degree sequence lst. 1

graph automorphisms(g): returns the group of automorphisms of the graph g as the set of permutations. The function accepts two optional arguments. With generators=true it only returns a set of generators for the automorphism group. With program=bliss it uses an external program bliss to compute the automorphism group. The location of the bliss program should be specified in blissprogram option variable. graph from lcf(lst): returns the symmetric Hamiltonian graph as specified by the lcf. graph generating function(n, t): returns the generating function for the number of graphs on n vertices. number of graphs(n,m): returns the number of graphs with n vertices and m edges. If m is not provided, all graphs on n vertices are returned. max clique cliquer(g): uses the program cliquer to compute the maximum clique in the graph g. The location of the program is specified in the option variable cliquer_program. max independent set cliquer(g): uses the program cliquer to compute the maximum independent set in the graph g. number of graphs(n, m): returns the number of graphs on n vertices with m edges. number of spanning trees(g): returns the number of spanning trees in the graph g. permute vertices(g, p): returns a new graph h such that the permutation p is an isomorphism between g and h. relabel graph vertices(g, option): relabels the graph vertices. Option is usually min_di=1. tutte poly(g): uses the external program tutte to compute the Tutte polynomial of the graph g. The location of the program is specified in the option variable tutte_program.

3

Relations on finite sets

relation product(r1,r2,. . . ): computes the product of relations relation power(R,n): computes the power relation Rn . identity relation(A): returns the identity relation on the set A. inverse relation(R): returns the inverse relation of the relation R. relation inverval(A,R,a,b): returns the set of elements x ∈ A such that aRxRb. graph of relation(R, A): returns the graph of the relation R on the set A (note that the graph is simple, the loops xRx are missing from the graph). 2

draw graph of relation(R, A): draws the graph of the relation R on the set A (the loops xRx will be drawn on the graph). antisymmetric relationp(R): checks if the relation is antisymmetric. reflexive relationp(R): checks if the relation is reflexive. symmetric relationp(R): checks if the relation is symmetric. tranzitive relationp(R): checks if the relation is tranzitive. equivalence relationp(R, A): checks if the relation is an equivalence relation. equivalence classes(R): returns the set of equivalence classes of the equivalence relation R. partial order relationp(R, A): checks if the relation R is a partial order on the set A. hasse diagram(R): returns the graph which represents the Hasse diagram for the relation R (which should be a partial order).

4 4.1

Permutations and permutation groups Permutations

identity permutation(n): returns the identity permutation of n elements. inverse permutation(p): returns the inverse permutation of the permutation p. random permutation1(n): returns a random permutation of the list [1, 2, . . . , n]. permutation product(p1, p2,...): computes the product of permutations. permutation power(p, n): computes the power permutation pn of the permutation p. permutation to cycles(p): returns the permutation p as a product of disjoint cycles. permutation from cycles(cl, n): returns the product of disjoint cycles as a permutation. permutation cycle structure(p): returns the cycle structure of the permutation p. permutation to transpositions(p): returns the permutation p as a product of transpositions. permutation from transpositions(tl, n): returns the product of transpositions as a permutation.

3

permutation sign(p): returns the parity of the permutation p. permutation order(p): returns the order of the permutation p. permute list(p, l): permutes the list l according to the permutation p. permutation fixed points(p): returns the set of fixed points of the permutation p. permutation matrix(p): returns the permutation p as a permutation matrix. number of inversions(p): returns the number of inversions in the permutation p.

4.2

Permutation groups

permutation group p(grp): checks if the set of permutations grp is a permutation group. group action(grp, st): computes a permutation group on st which is defined by the action of grp on st. group from generators(grp): returns the set of permutation of the group defined by generators in grp. group sgs(grp): computes a strong generating set for the group defined by generators in grp. group stabilizer(elt, grp): returns the stabilizer group of the element elt (elt can be a list of elements). group permutation(grp, elt1, elt2): returns a permutation p in the group defined by generators in grp which sends elt1 to elt2. group memberp(perm, grp): tests if the permutation perm is contained in the group defined by generators in grp. group orbit(elt, grp): returns the orbit of the element elt. group orbits(grp): returns all orbits of the group grp. group orbit representatives(grp): returns the representatives of group orbits of grp. goup order(grp): computes the order of the group defined by generators in grp. group fixed pointp(elt, grp): tests if elt is a fixed point for all permutations in the group grp. group action(grp, set): computes the action of the group grp on the set set. symmetric group(n): returns the symmetric group on n elements. 4

alternating group(n): returns the alternating group on n elements. cyclic group(n): returns the cyclic group on n elements. dihedral group(n): returns the dihedral group on n elements. multiplication table(grp): returns a matrix which represents the multiplication table for the group grp. reduce generator set(grp): returns a possibly smaller set of generators for the group defined by generators in grp.

4.3

Polya ´ theory

cycle index permutation(p): computes the cycle index of the permutation p. cycle index group(grp): computes the cycle index of the group grp. cycle index symmetric(n): computes the cycle index of the symmetric group on n elements. cycle index dihedral(n): computes the cycle index of the dihedral group on n elements. cycle index cyclic(n): computes the cycle index of the cyclic group on n elements. cycle index graph vertices(g): returns the cycle index of the automorphism group of the graph g which acts on the vertices of g. cycle index graph edges(g): returns the cycle index of the automorphism group of the graph g which acts on the edges of g. subst inventory(inv, ci): substitutes the appropriate inventory into the cycle index ci.

5

Logic

latomp(expr): checks if expr is an atom or a negation of an atom. boolean equiv(e1, e2): checks if two boolean expressions e1 and e2 are logically equivalent. boolean eval(expr): evaluates a boolean expression. boolean expression(k, vars) : returns the k–th boolean expression in variables vars |vars| (0 ≤ k < 22 ).

5

boolean form(expr): rewrites expr in a form in which the only connectives are ∧, ∨ and ¬. boolean minterm(n, vars): returns the n–th minterm in variables vars. boolean maxterm(n, vars): returns the n–the maxterm in variables vars. boolean minimize(e): finds a shortest formula in disjunctive normal form which is equivalent to e. boolean simp(e): applies some identities to simplify the boolean expression e. boolean table(expr, vars): writes the boolean table for expr. characteristic vector(expr): returns the characteristic vector of the expression expr. contradictionp(e): checks if e is a contradiction. An option algorithm can be specified to select the algorithm used. See also satisfiablep. convert to cnf(expr): converts expr to conjunctive normal form. convert to dnf(expr): converts expr to disjunctive normal form. convert to mod2(expr): converts a boolean expression into a mod–2 polynomial. functionally complete(conn1, conn2,...): tests if {conn1 , conn2 , . . .} is a functionally complete set of connectives. majority(v1,v2,. . . ): returns an expression which is true if the majority of variables v1 , v2 , . . ., is true. random boolean expression(vars): returns a random boolean expression in variables vars. sat solution : if satisfiablep_dpll(e) returns true and the selected algorithm is dpll or minisat, sat solution will hold the assingments under which e evaluates to true. satisfiability instances(e): returns the values for logic variables in e for which the formula e is true. satisfiablep(e): checks if the formula e is satisfiable. An option algorithm can be specified to select the algorithm used. The accepted values are algorithm=charvect, algorithm=dpll (the default) or algorithm=minisat. If algorithm=minisat then the minisat program should be installed and the option variable minisat program should point to the minisat program. tautologyp(e): checks if e is a tautology. An option algorithm can be specified to select the algorithm used. See also satisfiablep. 6

6 6.1

Combinatorial species Constructions

Prod(A, B): the product species A and B. Sum(A, B): the sum of species A and B. Set(A): the species of sets with elements in A. MSet(A): the species of multisets with elements in A. Seq(A): the species of sequences with elements in A. Cycle(A): the species of cycles with elements in A. Function(fun): the number of elements of size n is computed with the function fun. Epsilon: a special element of size 0. The constructions Set, MSet, Seq and Cycle accept an optional argument card, min card or max card.

6.2

Functions

count species(A, spec, n): counts the number of elements of size n in the species A which is defines with specification spec. list species(A, spec, n): returns the list of elements of size n in the species A which is defines with specification spec. select from species(A, spec, n): returns a random element size n in the species A which is defines with specification spec. gf equations(spec, t): return the generating functions for species defined in spec in variable t. gf express(eqs, A(t)): find the algebraic equation for the generating function A(t) defines with a system of equations eqs. Usually eqs is obtained with gf equations. alg eq to rec(eq, A(t)): find the recurrence for the coefficients in the generating function A(t) for which there exists an algebraic equation eq. Usually eq is obtained with gf express. nice disp: nicely displays an element of a combinatorial species. Replaces construction operators with lists. nice disp1: like nice_disp but replaces Epsilon with an empty list. 7

7

Other functions

number of derangements(n): returns the number of derangements of n elements. mcoeff(expr, v1, p1, v2, p2,. . .): computes the coefficient of the monomial v1 p1 v2 p2 · · · in the expression expr. necklace polynomial(n, x): returns the necklace polynomial of degree n in the variable x. An optional argument dihedral=true can be provided. list necklaces(n, lst): returns the set of necklaces with n beads with colors from lst. An optional argument dihedral=true can be provided. rook polynomial(M, x): returns the rook polynomial of the board defined by the 0–1 matrix M in the variable x. nth subset(n, st): returns the n–th subset of the set st. random subset(st): returns a random subset of the set st. random choice(lst): returns a random element from the list lst. random choice n(lst, n): returns n random elements from the list lst. count(elt, lst): counts the number of times that elt appears in the list lst. int range(a b, c): returns the integers from a to b by step c. If c is omitted, the step is 1. If b and c are omitted, it returns the integers from 1 to a by step 1. remove duplicates(lst): removes the duplicates in the list lst. remove duplicates sorted(lst): removes the duplicates in the list lst which is a sorted list.

8

discrete.mac: a list of functions - GitHub

flow poly(g): uses the external program tutte to compute the flow polynomial of the graph g. from degree sequence(lst): construct a graph with degree sequence ...

118KB Sizes 14 Downloads 368 Views

Recommend Documents

Perceptual Reward Functions - GitHub
expected discounted cumulative reward an agent will receive after ... Domains. Task Descriptors. Figure 3: Task Descriptors. From left to right: Breakout TG, ...

Recursive Functions - GitHub
Since the successor function can increment by one, we can easily find primitive ... Here we have used the convention of ending predicate names with “?”; in this .... that is, functions that are undefined, or divergent, at some values in the domai

Physics-based basis functions - GitHub
effect of element mutual coupling on both signal and noise response of the .... evlamemo69.pdf ..... {10o, 20o, 30o, 40o, 50o}, which give rise to a rank-five voltage covariance matrix. ... An illustration of two sets of CBFPs for modeling the.

Parts List - GitHub
Page 1 ..... 7. Follow README file to setup Camputer: https://github.com/facebook/surround360 .... Firmware Version: Firware Build Time: Driver. 16130496.

Off the rich list - GitHub
embed_fonts("demo.pdf", outfile="demo_embed.pdf"). ## Warning: package 'ggplot2' was built under R version 3.2.4. ## Registering fonts with R. 0. 50. 100. 150. 200. 1996. 2000. 2005. 2010. 2015. 0. 500. 1000. 1500. 2000. Number in Russia. Rest of wor

Toward the Web of Functions: Interoperable Higher-Order ... - GitHub
enabling a generation of Web APIs for sparql that we call Web of Func- tions. The paper ... Functions with a Remote Procedure Call (RPC) approach, that is, users can call ...... tional World Wide Web Conference, WWW (Companion Volume).

Counting with generating functions in MAXIMA - GitHub
In this paper we describe implementations of two counting methods which are based on generating func- ... Pólya theory [2] is an important counting method when some objects that are ...... [9] http://www.tcs.hut.fi/Software/bliss/index.html. 19.

What part of List do you not understand? - GitHub
scala.Equals. • private AbstractXXX hierarchy. • redundant inheritance paths. - linearization. Comments and Corrections: @tpolecat (Twitter and #scala)

NAME Give an example of it. Give a non-exomple of it. List 1 ... - GitHub
Page 1. NAME. Give an example of it. Give a non-exomple of it. List 1 thing to remember about it.

Data 8R Table Methods and Functions Summer 2017 1 ... - GitHub
Jul 18, 2017 - We have the dataset trips, which contains data on trips taken as part ofa ... def num_long_trips(cutoff): ... We want to see what the distribution of.

Data 8R Plotting Functions Summer 2017 1 Midterm Review ... - GitHub
Jul 20, 2017 - In physics calculations, we often want to have the data in terms of centimeters. Create a table called cm table that has the original data and a ...

Data 8R Plotting Functions Summer 2017 1 Midterm Review ... - GitHub
Data 8R. Plotting Functions. Summer 2017. Discussion 7: July 20, 2017. 1 Midterm Review. Question 4 ... function onto the table: Hint: Velocity = distance / time.

Defining functions Defining Rules Generating and Capturing ... - GitHub
language and are defined like this: (, ... ... generates an error with an error code and an error message. ... node(*v, *l, *r) => 1 + size(*l) + size(*r).

Data 8R Table Methods and Functions Summer 2017 1 ... - GitHub
Jul 18, 2017 - Data 8R. Table Methods and Functions. Summer 2017. Discussion 7: ... its range - the difference between the highest value in the array and.

A Network of Rails - GitHub
network of open source projects centered around Ruby on Rails. This dataset provides ... reasons, were often hosted on large source code hosting sites, the most dominant of ... GitHub also added two major new “social” features: the ability to sta

Theory of functions of a real variable.
space (X, dX) to a pseudo-metric space (Y,dY ) is called a Lipschitz map with. Lipschitz constant C if. dY (f(x1),f(x2)) ...... agree outside two intervals of length 2 m and on these intervals |fm(x)−fn(x)| ≤. 1. So fm − fn. 2 ≤ 1. 2π. · 2/

A simple proof of the nonconcavifiability of functions ...
journal homepage: www.elsevier.com/locate/jmateco. Short communication ... have shown that such a quasiconcave function is not concavifiable,. i.e., that no ...

A Demo of knitr - List of Attendants (a dynamic list hosted at Google ...
You should be able to compile the TEX document and get a PDF file like this one. See the func- tion for accessing Google Docs via R at ...

List of centrally authorised products requiring a notification of a ...
Oct 16, 2017 - All presentations 15/09/2017 ... dasabuvir based on the company's core data sheet. ... data from the HZC113782 (SUMMIT) study (designed.

Functions of the Cranial Nerves
Glosso-pharyngeal Taste (Pharyngeal). Pharyngeal muscles. X. Vagus. Viscero-sensation. (including taste) + somaticsensory from head. Visceral motor:.

A Snapshot of the OWL Web - GitHub
OWL ontologies are used across a wide spectrum of domains, ranging from chemistry to bio-health ..... File name and file size patterns First, a random sample of 100 ontologies was repeatedly drawn from ... to be largely cluster-free. In order to ...