math_probability 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +33 -2
- data/lib/math_probability/version.rb +1 -1
- data/test/test_helper.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 512ad96cd9913406ad58ea4fbeefa4d09e13032f
|
4
|
+
data.tar.gz: 857404e2821e0b4b0dec8077340b35f2b87d0a17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 606b30f62503ca92d8804887298bab08304db167417a5617fe9dd2be18080349ececf8da413fb9d19ce8c55ed6dce7a1ff2f516eef5079d0baf17f63cb99f503
|
7
|
+
data.tar.gz: 12649f47c02bc83d8eab0a36cddaf90d2ac91fa7489b068da1186b6d1ca88d56bd328ffa7782b5712a355e6acd0e57dbe3925fcd1219b4dbbd1758e788cece09
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# MathProbability
|
2
2
|
|
3
3
|
[](https://travis-ci.org/polysaturate/math_probability)
|
4
|
+
[](https://coveralls.io/r/polysaturate/math_probability?branch=master)
|
5
|
+
[](https://codeclimate.com/github/polysaturate/math_probability)
|
4
6
|
|
5
7
|
Quickly find factorals, summnations, permutations, combanations and probability answers
|
6
8
|
|
@@ -19,8 +21,37 @@ Or install it yourself as:
|
|
19
21
|
$ gem install math_probability
|
20
22
|
|
21
23
|
## Usage
|
22
|
-
|
23
|
-
|
24
|
+
General Usage:
|
25
|
+
|
26
|
+
5.factoral
|
27
|
+
=> 120
|
28
|
+
prob = MathProbability::Probability
|
29
|
+
|
30
|
+
Sigma(Summation) | Usage: sigma(start, end, formula)
|
31
|
+
|
32
|
+
prob.sigma(1,4,"4*x-3")
|
33
|
+
=> 28
|
34
|
+
|
35
|
+
Permutation without repeating | Usage permutation_no_repeat(objects, at_a_time)
|
36
|
+
|
37
|
+
prob.permutations_no_repeat(8,5)
|
38
|
+
=> 6720
|
39
|
+
|
40
|
+
Permutation with repeating | Usage permutation_no_repeat(objects, at_a_time)
|
41
|
+
|
42
|
+
prob.permutations_with_repeat(8,5)
|
43
|
+
=> 32768
|
44
|
+
|
45
|
+
Combinations | Usage combinations(objects, at_a_time)
|
46
|
+
|
47
|
+
prob.combinations(10,4)
|
48
|
+
=> 210
|
49
|
+
|
50
|
+
Probability | Usage probability(choices, outcomes)
|
51
|
+
|
52
|
+
prob.probability(1,4)
|
53
|
+
=> [0.25, "25.0%", "1/4"]
|
54
|
+
|
24
55
|
|
25
56
|
## Contributing
|
26
57
|
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
4
|
+
SimpleCov.start
|
5
|
+
|
1
6
|
require 'rubygems'
|
2
7
|
gem 'minitest'
|
3
8
|
|
4
9
|
require 'minitest/spec'
|
5
10
|
require 'minitest/autorun'
|
6
11
|
|
7
|
-
require 'coveralls'
|
8
|
-
Coveralls.wear!
|
9
|
-
|
10
12
|
require File.expand_path('../../lib/math_probability.rb', __FILE__)
|