devanp92 / Combinatorics.js
Programming Languages
Labels
Projects that are alternatives of or similar to Combinatorics.js
Combinatorics.js
Introduction
Combinatorics.js is a standalone math library for Javascript and Node.js. It features a solution to work with Permutations, Posets, Trees, and other enumerative collections.
Combinatorics.js is also a module to math.js.
Please see this blog article to get a general feel for this project.
Table of Contents
Install/Build
To clone this project:
git clone [email protected]:devanp92/combinatorics.js.git
cd combinatorics.js
To install via npm:
npm install combinatoricsjs
To install the necessary dependencies:
npm install
To test we use Mocha:
npm test // mocha test --recursive
To build we use Gulp:
gulp
Roadmap
A rough roadmap for Combinatorics.js
-
Permutation: π : {1...n} -> {1...n}:
- Behaviors
InverseMultiplyCalculate number of cyclesComplementReverseRandomize Permutation
- States
Number of cyclesParity (odd/even)Number of fixed points (is it a Derangement?)Is Identity
- Ancillary
- Create/Return iterator
Print to cycle notation
- Behaviors
-
Permutation Patterns (subclass of Permutation)
A permutation π is said to 'contain' a permutation σ (σ is a permuation {1..m}, such that m < n) if there exists a subsequence in π in the same relative order.
Alternatively, a permutation avoids σ if there does not exist such a subsequence.
- Behaviors
- Contains
- Avoids
- Permutation avoiding pattern generator (all permutations π from [1..n] avoiding σ)
- States
- List of permutations given containing or avoiding a pattern
- Cardinality
- Behaviors
-
Util Functions
Is IntegerCombinations- Enumerative Methods
- Bell Numbers
- Stirling numbers of the first kind
- Partitions
- (Weak) Compositions
- Set Partitions
- Stirling numbers of the second kind
- Integer Paritions
Contributing
Feel free to contribute to combinatorics.js! You can contribute in different ways: spread the word, report bugs, come up with ideas and suggestions, and contribute to the code.
There are a few preferences regarding code contributions:
Combinatorics.js follows the node.js code style
Send pull requests to the develop branch, not the master branch.
Pleae do not commit any files other than in lib/ and test/.
If adding functionality, please include source (lib/) and test (test/) files.
Thanks!
Adapted from math.js
License
The MIT License (MIT)
Copyright (c) 2016 Devan Patel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.