silicium 0.0.15 → 0.0.20

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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +4 -0
  3. data/.gitignore +3 -1
  4. data/.travis.yml +12 -1
  5. data/Gemfile +4 -0
  6. data/Makefile +269 -0
  7. data/README.md +2 -0
  8. data/Rakefile +7 -0
  9. data/docs/Object.html +117 -0
  10. data/docs/README_md.html +142 -0
  11. data/docs/Silicium.html +101 -0
  12. data/docs/Silicium/Combinatorics.html +270 -0
  13. data/docs/Silicium/Dice.html +99 -0
  14. data/docs/Silicium/Dice/Polyhedron.html +315 -0
  15. data/docs/Silicium/Dice/PolyhedronSet.html +321 -0
  16. data/docs/Silicium/Error.html +106 -0
  17. data/docs/Silicium/Geometry.html +940 -0
  18. data/docs/Silicium/Geometry/Line2dCanon.html +243 -0
  19. data/docs/Silicium/Geometry/VariablesOrderException.html +106 -0
  20. data/docs/Silicium/Graphs.html +164 -0
  21. data/docs/Silicium/Graphs/GraphError.html +106 -0
  22. data/docs/Silicium/Graphs/OrientedGraph.html +775 -0
  23. data/docs/Silicium/Graphs/UnorientedGraph.html +284 -0
  24. data/docs/Silicium/IntegralDoesntExistError.html +106 -0
  25. data/docs/Silicium/NumericalIntegration.html +521 -0
  26. data/docs/Silicium/Optimization.html +639 -0
  27. data/docs/Silicium/Plotter.html +186 -0
  28. data/docs/Silicium/Plotter/Image.html +297 -0
  29. data/docs/created.rid +9 -0
  30. data/docs/css/fonts.css +167 -0
  31. data/docs/css/rdoc.css +619 -0
  32. data/docs/fonts/Lato-Light.ttf +0 -0
  33. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  34. data/docs/fonts/Lato-Regular.ttf +0 -0
  35. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  36. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  37. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  38. data/docs/images/add.png +0 -0
  39. data/docs/images/arrow_up.png +0 -0
  40. data/docs/images/brick.png +0 -0
  41. data/docs/images/brick_link.png +0 -0
  42. data/docs/images/bug.png +0 -0
  43. data/docs/images/bullet_black.png +0 -0
  44. data/docs/images/bullet_toggle_minus.png +0 -0
  45. data/docs/images/bullet_toggle_plus.png +0 -0
  46. data/docs/images/date.png +0 -0
  47. data/docs/images/delete.png +0 -0
  48. data/docs/images/find.png +0 -0
  49. data/docs/images/loadingAnimation.gif +0 -0
  50. data/docs/images/macFFBgHack.png +0 -0
  51. data/docs/images/package.png +0 -0
  52. data/docs/images/page_green.png +0 -0
  53. data/docs/images/page_white_text.png +0 -0
  54. data/docs/images/page_white_width.png +0 -0
  55. data/docs/images/plugin.png +0 -0
  56. data/docs/images/ruby.png +0 -0
  57. data/docs/images/tag_blue.png +0 -0
  58. data/docs/images/tag_green.png +0 -0
  59. data/docs/images/transparent.png +0 -0
  60. data/docs/images/wrench.png +0 -0
  61. data/docs/images/wrench_orange.png +0 -0
  62. data/docs/images/zoom.png +0 -0
  63. data/docs/index.html +132 -0
  64. data/docs/js/darkfish.js +84 -0
  65. data/docs/js/navigation.js +105 -0
  66. data/docs/js/navigation.js.gz +0 -0
  67. data/docs/js/search.js +110 -0
  68. data/docs/js/search_index.js +1 -0
  69. data/docs/js/search_index.js.gz +0 -0
  70. data/docs/js/searcher.js +229 -0
  71. data/docs/js/searcher.js.gz +0 -0
  72. data/docs/table_of_contents.html +608 -0
  73. data/lib/geometry.rb +236 -0
  74. data/lib/graph.rb +164 -0
  75. data/lib/numerical_integration.rb +147 -0
  76. data/lib/optimization.rb +144 -0
  77. data/lib/plotter.rb +96 -0
  78. data/lib/silicium.rb +0 -1
  79. data/lib/silicium/version.rb +1 -1
  80. data/lib/theory_of_probability.rb +227 -0
  81. data/silicium.gemspec +4 -2
  82. metadata +90 -3
@@ -0,0 +1,142 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>README - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/navigation.js" defer></script>
15
+ <script src="./js/search.js" defer></script>
16
+ <script src="./js/search_index.js" defer></script>
17
+ <script src="./js/searcher.js" defer></script>
18
+ <script src="./js/darkfish.js" defer></script>
19
+
20
+ <link href="./css/fonts.css" rel="stylesheet">
21
+ <link href="./css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+
25
+
26
+ <body id="top" role="document" class="file">
27
+ <nav role="navigation">
28
+ <div id="project-navigation">
29
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
30
+ <h2>
31
+ <a href="./index.html" rel="home">Home</a>
32
+ </h2>
33
+
34
+ <div id="table-of-contents-navigation">
35
+ <a href="./table_of_contents.html#pages">Pages</a>
36
+ <a href="./table_of_contents.html#classes">Classes</a>
37
+ <a href="./table_of_contents.html#methods">Methods</a>
38
+ </div>
39
+ </div>
40
+
41
+ <div id="search-section" role="search" class="project-section initially-hidden">
42
+ <form action="#" method="get" accept-charset="utf-8">
43
+ <div id="search-field-wrapper">
44
+ <input id="search-field" role="combobox" aria-label="Search"
45
+ aria-autocomplete="list" aria-controls="search-results"
46
+ type="text" name="search" placeholder="Search" spellcheck="false"
47
+ title="Type to search, Up and Down to navigate, Enter to load">
48
+ </div>
49
+
50
+ <ul id="search-results" aria-label="Search Results"
51
+ aria-busy="false" aria-expanded="false"
52
+ aria-atomic="false" class="initially-hidden"></ul>
53
+ </form>
54
+ </div>
55
+
56
+ </div>
57
+
58
+
59
+ <div class="nav-section">
60
+ <h3>Table of Contents</h3>
61
+
62
+ <ul class="link-list" role="directory">
63
+ <li><a href="#label-Silicium">Silicium</a>
64
+ <li><a href="#label-Installation">Installation</a>
65
+ <li><a href="#label-Usage">Usage</a>
66
+ <li><a href="#label-Development">Development</a>
67
+ <li><a href="#label-Contributing">Contributing</a>
68
+ <li><a href="#label-License">License</a>
69
+ <li><a href="#label-Code+of+Conduct">Code of Conduct</a>
70
+ </ul>
71
+ </div>
72
+
73
+
74
+ <div id="project-metadata">
75
+ <div id="fileindex-section" class="nav-section">
76
+ <h3>Pages</h3>
77
+
78
+ <ul class="link-list">
79
+
80
+ <li><a href="./README_md.html">README</a>
81
+
82
+ </ul>
83
+ </div>
84
+
85
+ </div>
86
+ </nav>
87
+
88
+ <main role="main" aria-label="Page README.md">
89
+
90
+ <p><a href="https://travis-ci.org/mmcs-ruby/silicium"><img src="https://travis-ci.org/mmcs-ruby/silicium.svg?branch=master"></a> <a href="https://codeclimate.com/github/mmcs-ruby/silicium/maintainability"><img src="https://api.codeclimate.com/v1/badges/b0ec4b3029f90d4273a1/maintainability"></a> <a href="https://codeclimate.com/github/mmcs-ruby/silicium/test_coverage"><img src="https://api.codeclimate.com/v1/badges/b0ec4b3029f90d4273a1/test_coverage"></a></p>
91
+
92
+ <h1 id="label-Silicium"><a href="Silicium.html"><code>Silicium</code></a><span><a href="#label-Silicium">&para;</a> <a href="#top">&uarr;</a></span></h1>
93
+
94
+ <p>Ruby Math Library written as exercise by MMCS students.</p>
95
+
96
+ <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
97
+
98
+ <p>Add this line to your application&#39;s Gemfile:</p>
99
+
100
+ <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-string">&#39;silicium&#39;</span>
101
+ </pre>
102
+
103
+ <p>And then execute:</p>
104
+
105
+ <pre>$ bundle</pre>
106
+
107
+ <p>Or install it yourself as:</p>
108
+
109
+ <pre>$ gem install silicium</pre>
110
+
111
+ <h2 id="label-Usage">Usage<span><a href="#label-Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>
112
+
113
+ <p>TODO: Write usage instructions here</p>
114
+
115
+ <h2 id="label-Development">Development<span><a href="#label-Development">&para;</a> <a href="#top">&uarr;</a></span></h2>
116
+
117
+ <p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake test</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
118
+
119
+ <p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
120
+
121
+ <h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">&para;</a> <a href="#top">&uarr;</a></span></h2>
122
+
123
+ <p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/[USERNAME]/silicium">github.com/[USERNAME]/silicium</a>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the <a href="http://contributor-covenant.org">Contributor Covenant</a> code of conduct.</p>
124
+
125
+ <h2 id="label-License">License<span><a href="#label-License">&para;</a> <a href="#top">&uarr;</a></span></h2>
126
+
127
+ <p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
128
+
129
+ <h2 id="label-Code+of+Conduct">Code of Conduct<span><a href="#label-Code+of+Conduct">&para;</a> <a href="#top">&uarr;</a></span></h2>
130
+
131
+ <p>Everyone interacting in the <a href="Silicium.html"><code>Silicium</code></a> project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the {code of conduct}[https://github.com/[USERNAME]/silicium/blob/master/CODE_OF_CONDUCT.md].</p>
132
+
133
+ </main>
134
+
135
+
136
+
137
+ <footer id="validator-badges" role="contentinfo">
138
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
139
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
140
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
141
+ </footer>
142
+
@@ -0,0 +1,101 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module Silicium - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/navigation.js" defer></script>
15
+ <script src="./js/search.js" defer></script>
16
+ <script src="./js/search_index.js" defer></script>
17
+ <script src="./js/searcher.js" defer></script>
18
+ <script src="./js/darkfish.js" defer></script>
19
+
20
+ <link href="./css/fonts.css" rel="stylesheet">
21
+ <link href="./css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+
25
+
26
+ <body id="top" role="document" class="module">
27
+ <nav role="navigation">
28
+ <div id="project-navigation">
29
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
30
+ <h2>
31
+ <a href="./index.html" rel="home">Home</a>
32
+ </h2>
33
+
34
+ <div id="table-of-contents-navigation">
35
+ <a href="./table_of_contents.html#pages">Pages</a>
36
+ <a href="./table_of_contents.html#classes">Classes</a>
37
+ <a href="./table_of_contents.html#methods">Methods</a>
38
+ </div>
39
+ </div>
40
+
41
+ <div id="search-section" role="search" class="project-section initially-hidden">
42
+ <form action="#" method="get" accept-charset="utf-8">
43
+ <div id="search-field-wrapper">
44
+ <input id="search-field" role="combobox" aria-label="Search"
45
+ aria-autocomplete="list" aria-controls="search-results"
46
+ type="text" name="search" placeholder="Search" spellcheck="false"
47
+ title="Type to search, Up and Down to navigate, Enter to load">
48
+ </div>
49
+
50
+ <ul id="search-results" aria-label="Search Results"
51
+ aria-busy="false" aria-expanded="false"
52
+ aria-atomic="false" class="initially-hidden"></ul>
53
+ </form>
54
+ </div>
55
+
56
+ </div>
57
+
58
+
59
+
60
+ <div id="class-metadata">
61
+
62
+
63
+
64
+
65
+
66
+ </div>
67
+ </nav>
68
+
69
+ <main role="main" aria-labelledby="module-Silicium">
70
+ <h1 id="module-Silicium" class="module">
71
+ module Silicium
72
+ </h1>
73
+
74
+ <section class="description">
75
+
76
+ <p>require &#39;set&#39; require &#39;silicium&#39;</p>
77
+
78
+ </section>
79
+
80
+
81
+ <section id="5Buntitled-5D" class="documentation-section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+ </section>
92
+
93
+ </main>
94
+
95
+
96
+ <footer id="validator-badges" role="contentinfo">
97
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
98
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
99
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
100
+ </footer>
101
+
@@ -0,0 +1,270 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module Silicium::Combinatorics - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "../";
11
+ var index_rel_prefix = "../";
12
+ </script>
13
+
14
+ <script src="../js/navigation.js" defer></script>
15
+ <script src="../js/search.js" defer></script>
16
+ <script src="../js/search_index.js" defer></script>
17
+ <script src="../js/searcher.js" defer></script>
18
+ <script src="../js/darkfish.js" defer></script>
19
+
20
+ <link href="../css/fonts.css" rel="stylesheet">
21
+ <link href="../css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+
25
+
26
+ <body id="top" role="document" class="module">
27
+ <nav role="navigation">
28
+ <div id="project-navigation">
29
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
30
+ <h2>
31
+ <a href="../index.html" rel="home">Home</a>
32
+ </h2>
33
+
34
+ <div id="table-of-contents-navigation">
35
+ <a href="../table_of_contents.html#pages">Pages</a>
36
+ <a href="../table_of_contents.html#classes">Classes</a>
37
+ <a href="../table_of_contents.html#methods">Methods</a>
38
+ </div>
39
+ </div>
40
+
41
+ <div id="search-section" role="search" class="project-section initially-hidden">
42
+ <form action="#" method="get" accept-charset="utf-8">
43
+ <div id="search-field-wrapper">
44
+ <input id="search-field" role="combobox" aria-label="Search"
45
+ aria-autocomplete="list" aria-controls="search-results"
46
+ type="text" name="search" placeholder="Search" spellcheck="false"
47
+ title="Type to search, Up and Down to navigate, Enter to load">
48
+ </div>
49
+
50
+ <ul id="search-results" aria-label="Search Results"
51
+ aria-busy="false" aria-expanded="false"
52
+ aria-atomic="false" class="initially-hidden"></ul>
53
+ </form>
54
+ </div>
55
+
56
+ </div>
57
+
58
+
59
+
60
+ <div id="class-metadata">
61
+
62
+
63
+
64
+
65
+ <!-- Method Quickref -->
66
+ <div id="method-list-section" class="nav-section">
67
+ <h3>Methods</h3>
68
+
69
+ <ul class="link-list" role="directory">
70
+
71
+ <li ><a href="#method-i-arrangement">#arrangement</a>
72
+
73
+ <li ><a href="#method-i-combination">#combination</a>
74
+
75
+ <li ><a href="#method-i-fact">#fact</a>
76
+
77
+ <li ><a href="#method-i-factorial">#factorial</a>
78
+
79
+ </ul>
80
+ </div>
81
+
82
+ </div>
83
+ </nav>
84
+
85
+ <main role="main" aria-labelledby="module-Silicium::Combinatorics">
86
+ <h1 id="module-Silicium::Combinatorics" class="module">
87
+ module Silicium::Combinatorics
88
+ </h1>
89
+
90
+ <section class="description">
91
+
92
+ </section>
93
+
94
+
95
+ <section id="5Buntitled-5D" class="documentation-section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
106
+ <header>
107
+ <h3>Public Instance Methods</h3>
108
+ </header>
109
+
110
+
111
+ <div id="method-i-arrangement" class="method-detail ">
112
+
113
+ <div class="method-heading">
114
+ <span class="method-name">arrangement</span><span
115
+ class="method-args">(n, k)</span>
116
+
117
+ <span class="method-click-advice">click to toggle source</span>
118
+
119
+ </div>
120
+
121
+
122
+ <div class="method-description">
123
+
124
+ <p>Function A(n,k)</p>
125
+
126
+
127
+
128
+
129
+ <div class="method-source-code" id="arrangement-source">
130
+ <pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 38</span>
131
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">arrangement</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
132
+ <span class="ruby-identifier">f</span> = <span class="ruby-identifier">fact</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
133
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">k</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
134
+ <span class="ruby-value">-1</span>
135
+ <span class="ruby-keyword">else</span>
136
+ <span class="ruby-identifier">f</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">/</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">1</span>]
137
+ <span class="ruby-keyword">end</span>
138
+ <span class="ruby-keyword">end</span></pre>
139
+ </div>
140
+
141
+ </div>
142
+
143
+
144
+
145
+
146
+ </div>
147
+
148
+
149
+ <div id="method-i-combination" class="method-detail ">
150
+
151
+ <div class="method-heading">
152
+ <span class="method-name">combination</span><span
153
+ class="method-args">(n, k)</span>
154
+
155
+ <span class="method-click-advice">click to toggle source</span>
156
+
157
+ </div>
158
+
159
+
160
+ <div class="method-description">
161
+
162
+ <p>Function C(n,k)</p>
163
+
164
+
165
+
166
+
167
+ <div class="method-source-code" id="combination-source">
168
+ <pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 27</span>
169
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">combination</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
170
+ <span class="ruby-identifier">f</span> = <span class="ruby-identifier">fact</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
171
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">k</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
172
+ <span class="ruby-value">-1</span>
173
+ <span class="ruby-keyword">else</span>
174
+ <span class="ruby-identifier">f</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">/</span> (<span class="ruby-identifier">f</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">*</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">1</span>])
175
+ <span class="ruby-keyword">end</span>
176
+ <span class="ruby-keyword">end</span></pre>
177
+ </div>
178
+
179
+ </div>
180
+
181
+
182
+
183
+
184
+ </div>
185
+
186
+
187
+ <div id="method-i-fact" class="method-detail ">
188
+
189
+ <div class="method-heading">
190
+ <span class="method-name">fact</span><span
191
+ class="method-args">(n, k)</span>
192
+
193
+ <span class="method-click-advice">click to toggle source</span>
194
+
195
+ </div>
196
+
197
+
198
+ <div class="method-description">
199
+
200
+ <p>Factorial for counting 3 parameters in one run</p>
201
+
202
+
203
+
204
+
205
+ <div class="method-source-code" id="fact-source">
206
+ <pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 17</span>
207
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">fact</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>)
208
+ <span class="ruby-identifier">res</span> = [<span class="ruby-value">1</span>,<span class="ruby-value">1</span>,<span class="ruby-value">1</span>]
209
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
210
+ <span class="ruby-identifier">fact_n_greater_1</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">k</span>, <span class="ruby-identifier">res</span>)
211
+ <span class="ruby-keyword">end</span>
212
+ <span class="ruby-identifier">res</span>
213
+ <span class="ruby-keyword">end</span></pre>
214
+ </div>
215
+
216
+ </div>
217
+
218
+
219
+
220
+
221
+ </div>
222
+
223
+
224
+ <div id="method-i-factorial" class="method-detail ">
225
+
226
+ <div class="method-heading">
227
+ <span class="method-name">factorial</span><span
228
+ class="method-args">(n)</span>
229
+
230
+ <span class="method-click-advice">click to toggle source</span>
231
+
232
+ </div>
233
+
234
+
235
+ <div class="method-description">
236
+
237
+
238
+
239
+
240
+
241
+
242
+ <div class="method-source-code" id="factorial-source">
243
+ <pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 10</span>
244
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">factorial</span>(<span class="ruby-identifier">n</span>)
245
+ <span class="ruby-identifier">res</span> = (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">n</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-value">:*</span>) <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
246
+ <span class="ruby-identifier">res</span>
247
+ <span class="ruby-keyword">end</span></pre>
248
+ </div>
249
+
250
+ </div>
251
+
252
+
253
+
254
+
255
+ </div>
256
+
257
+
258
+ </section>
259
+
260
+ </section>
261
+
262
+ </main>
263
+
264
+
265
+ <footer id="validator-badges" role="contentinfo">
266
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
267
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
268
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
269
+ </footer>
270
+