Skip to content
Permalink
Browse files

fixed small bugs

  • Loading branch information...
cheyneh committed Jan 24, 2013
1 parent 984b1c5 commit bc2555cb37f285dbe02c353b4bc444aba060b657
Showing with 133 additions and 0 deletions.
  1. BIN ex.pdf
  2. +132 −0 ex.tex
  3. +1 −0 permutation.py
BIN +52 KB ex.pdf
Binary file not shown.
132 ex.tex
@@ -0,0 +1,132 @@
\documentclass[]{article}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifxetex
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else
\ifluatex
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else
\usepackage[utf8]{inputenc}
\fi
\fi
\usepackage{color}
\usepackage{fancyvrb}
\DefineShortVerb[commandchars=\\\{\}]{\|}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\newenvironment{Shaded}{}{}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
\newcommand{\RegionMarkerTok}[1]{{#1}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
\newcommand{\NormalTok}[1]{{#1}}
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex,
colorlinks=true,
linkcolor=blue]{hyperref}
\else
\usepackage[unicode=true,
colorlinks=true,
linkcolor=blue]{hyperref}
\fi
\hypersetup{breaklinks=true, pdfborder={0 0 0}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{0}


\begin{document}

\section{pyperm}

\subsection{A Python Permutations Class}

Contains Various tools for working interactively with permutaions.
Easily extensible.

\subsubsection{Examples:}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{>>>}
\NormalTok{>>> }\CharTok{import} \NormalTok{pyperm }\CharTok{as} \NormalTok{pp}
\NormalTok{>>> }
\NormalTok{>>> }
\NormalTok{>>> p = pp.Perm.random(}\DecValTok{8}\NormalTok{)}
\NormalTok{>>> }
\NormalTok{>>> p}
\DecValTok{5} \DecValTok{4} \DecValTok{7} \DecValTok{1} \DecValTok{6} \DecValTok{2} \DecValTok{3} \DecValTok{8}
\NormalTok{>>> }
\NormalTok{>>> }
\NormalTok{>>> p.cycles()}
\StringTok{'( 6 2 4 1 5 ) ( 7 3 ) ( 8 )'}
\NormalTok{>>> }
\NormalTok{>>> p.order()}
\DecValTok{10}
\NormalTok{>>> }
\NormalTok{>>> p ** }\DecValTok{10}
\DecValTok{1} \DecValTok{2} \DecValTok{3} \DecValTok{4} \DecValTok{5} \DecValTok{6} \DecValTok{7} \DecValTok{8}
\NormalTok{>>>}

\NormalTok{>>> S = pp.PermSet.}\DataTypeTok{all}\NormalTok{(}\DecValTok{6}\NormalTok{)}
\NormalTok{>>> }
\NormalTok{>>> S}
\NormalTok{Set of }\DecValTok{720} \NormalTok{permutations}
\NormalTok{>>> }
\NormalTok{>>> S.total_statistic(Perm.inversions)}
\DecValTok{5400}
\NormalTok{>>> }
\NormalTok{>>> S.total_statistic(Perm.descents)}
\DecValTok{1800}
\NormalTok{>>> }

\NormalTok{>>> }
\NormalTok{>>> A = pp.AvClass(}\DecValTok{8}\NormalTok{)}
\NormalTok{>>> }
\NormalTok{>>> A}
\NormalTok{<<< }
\NormalTok{[Set of }\DecValTok{0} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{1} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{2} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{6} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{24} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{120} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{720} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{5040} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{40320} \NormalTok{permutations]}
\NormalTok{>>> }
\NormalTok{>>> }
\NormalTok{>>> A.avoid( pp.Perm([}\DecValTok{2}\NormalTok{,}\DecValTok{3}\NormalTok{,}\DecValTok{1}\NormalTok{]) )}
\NormalTok{>>> }
\NormalTok{>>> A}
\NormalTok{<<< }
\NormalTok{[Set of }\DecValTok{0} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{1} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{2} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{5} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{14} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{42} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{132} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{429} \NormalTok{permutations,}
\NormalTok{Set of }\DecValTok{1430} \NormalTok{permutations]}
\NormalTok{>>> }
\NormalTok{>>> }
\end{Highlighting}
\end{Shaded}

\end{document}
@@ -2,6 +2,7 @@
import random
import fractions

__author__ = 'cheyne.homberger@gmail.com'



0 comments on commit bc2555c

Please sign in to comment.
You can’t perform that action at this time.