RubMat 2.1.5 → 2.1.6
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.
- data/README.md +9 -0
- data/Rakefile +13 -14
- data/bin/rubmat.rb +124 -0
- data/lib/help.rb +40 -0
- data/lib/librbdiscrete.rb +41 -17
- data/lib/rubmat.rb +124 -0
- data/lib/statics.yml +1 -1
- metadata +12 -10
- data/README +0 -4
- data/lib/main.rb +0 -13
data/README.md
ADDED
data/Rakefile
CHANGED
|
@@ -8,15 +8,14 @@ require 'rake/testtask'
|
|
|
8
8
|
|
|
9
9
|
spec = Gem::Specification.new do |s|
|
|
10
10
|
s.name = 'RubMat'
|
|
11
|
-
s.version = '2.1.
|
|
12
|
-
s.
|
|
13
|
-
s.extra_rdoc_files = ['README', 'LICENSE', 'gplv3.png', 'RubMat.png']
|
|
11
|
+
s.version = '2.1.6'
|
|
12
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE', 'gplv3.png', 'RubMat.png']
|
|
14
13
|
s.summary = 'Discrete Mathematics solver and Usable Library'
|
|
15
14
|
s.description = s.summary
|
|
16
|
-
s.author = '
|
|
15
|
+
s.author = 'Mahmut Bulut'
|
|
17
16
|
s.email = 'scienceblock@gmail.com'
|
|
18
|
-
|
|
19
|
-
s.files = %w(LICENSE README Rakefile gplv3.png RubMat.png) + Dir.glob("{bin,lib,spec}/**/*")
|
|
17
|
+
s.executables = ['rubmat.rb']
|
|
18
|
+
s.files = %w(LICENSE README.md Rakefile gplv3.png RubMat.png) + Dir.glob("{bin,lib,spec}/**/*")
|
|
20
19
|
s.require_path = "lib"
|
|
21
20
|
s.bindir = "bin"
|
|
22
21
|
s.homepage = 'http://regularlambda.github.com/RubMat'
|
|
@@ -28,14 +27,14 @@ Rake::GemPackageTask.new(spec) do |p|
|
|
|
28
27
|
p.need_zip = true
|
|
29
28
|
end
|
|
30
29
|
|
|
31
|
-
Rake::RDocTask.new do |rdoc|
|
|
32
|
-
files =['README', 'LICENSE', 'lib/**/*.rb', 'lib/**/*.yml']
|
|
33
|
-
rdoc.rdoc_files.add(files)
|
|
34
|
-
rdoc.main = "README" # page to start on
|
|
35
|
-
rdoc.title = "RubMat Docs"
|
|
36
|
-
rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
|
|
37
|
-
rdoc.options << '--line-numbers'
|
|
38
|
-
end
|
|
30
|
+
#Rake::RDocTask.new do |rdoc|
|
|
31
|
+
# files =['README.md', 'LICENSE', 'lib/**/*.rb', 'lib/**/*.yml']
|
|
32
|
+
# rdoc.rdoc_files.add(files)
|
|
33
|
+
# rdoc.main = "README" # page to start on
|
|
34
|
+
# rdoc.title = "RubMat Docs"
|
|
35
|
+
# rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
|
|
36
|
+
# rdoc.options << '--line-numbers'
|
|
37
|
+
#end
|
|
39
38
|
|
|
40
39
|
Rake::TestTask.new do |t|
|
|
41
40
|
t.test_files = FileList['test/**/*.rb']
|
data/bin/rubmat.rb
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# AUTHOR: Mahmut Bulut
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
require 'librbdiscrete.rb'
|
|
7
|
+
require 'fixnumexpand.rb'
|
|
8
|
+
require 'commander'
|
|
9
|
+
require 'help'
|
|
10
|
+
|
|
11
|
+
puts "===RubMat===
|
|
12
|
+
Copyright (C) <2011> <Mahmut Bulut>
|
|
13
|
+
This program comes with ABSOLUTELY NO WARRANTY; for details type 'help'.
|
|
14
|
+
This is free software, and you are welcome to redistribute it
|
|
15
|
+
under certain conditions; type `certain' for details."
|
|
16
|
+
puts ""
|
|
17
|
+
begin
|
|
18
|
+
command = ask(">=> ")
|
|
19
|
+
#command = commn.chomp!
|
|
20
|
+
# Read arguments and defines commands
|
|
21
|
+
# Will handle command line whitespaces
|
|
22
|
+
|
|
23
|
+
if (command == 'help')
|
|
24
|
+
puts help()
|
|
25
|
+
end
|
|
26
|
+
if (command == 'certain')
|
|
27
|
+
puts "To see certain conditions please visit http://www.gnu.org/licenses/gpl-2.0.html#SEC3"
|
|
28
|
+
end
|
|
29
|
+
if (command == 'factorial')
|
|
30
|
+
n = ask("Enter N value: ", Integer)
|
|
31
|
+
puts factorial(n)
|
|
32
|
+
end
|
|
33
|
+
if (command == 'binsearch')
|
|
34
|
+
begin
|
|
35
|
+
binary = ask("Enter array name with [ & ] suffix: ")
|
|
36
|
+
size = ask("Enter size of search range: ", Integer)
|
|
37
|
+
search_key = ask("Enter search delimiter key", Integer)
|
|
38
|
+
low = ask("Lower limit: ", Integer)
|
|
39
|
+
middle = ask("Medium limit: ", Integer)
|
|
40
|
+
high = ask("High limit: ", Integer)
|
|
41
|
+
puts binary_search(binary, size, search_key, low, middle, high)
|
|
42
|
+
rescue => error
|
|
43
|
+
puts error
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
if (command == 'birdseye')
|
|
47
|
+
n = ask("Enter workspace mass number: ", Integer)
|
|
48
|
+
k = ask("Enter selection mass number: ", Integer)
|
|
49
|
+
puts birds_eye(n, k)
|
|
50
|
+
end
|
|
51
|
+
if (command == 'combinatorial')
|
|
52
|
+
glb = ask("Enter global set objects number: ", Integer)
|
|
53
|
+
ksb = ask("Enter k-subset objects number: ", Integer)
|
|
54
|
+
puts combinatorial(glb, ksb)
|
|
55
|
+
end
|
|
56
|
+
if (command == 'distpres')
|
|
57
|
+
presnum = ask("Present number: ", Integer)
|
|
58
|
+
puts dist_pres(presnum)
|
|
59
|
+
end
|
|
60
|
+
if (command == 'eagleview')
|
|
61
|
+
m = ask("Enter m value: ", Integer)
|
|
62
|
+
t = ask("Enter t value: ", Integer)
|
|
63
|
+
puts eagle_view(m, t)
|
|
64
|
+
end
|
|
65
|
+
if (command == 'fermatlittle')
|
|
66
|
+
p = ans("Enter power number: ", Integer)
|
|
67
|
+
a = ans("Enter base number:", Integer)
|
|
68
|
+
puts fermat_little(p, a)
|
|
69
|
+
end
|
|
70
|
+
if (command == 'fib')
|
|
71
|
+
n = ans("Enter the last incremental number: ", Integer)
|
|
72
|
+
puts fib(n)
|
|
73
|
+
end
|
|
74
|
+
if (command == 'isprime')
|
|
75
|
+
raise RuntimeError.new("Have some critical issues closed to next minor version")
|
|
76
|
+
# nb = ask("Control number: ", Integer)
|
|
77
|
+
# puts is_prime(nb)
|
|
78
|
+
end
|
|
79
|
+
if (command == 'iterativefact')
|
|
80
|
+
begin
|
|
81
|
+
itrtnum = ask("Enter the factorial input: ", Integer)
|
|
82
|
+
throw :ball if (itrtnum >= MAX_INTEGER)
|
|
83
|
+
puts iterative_fact(itrtnum)
|
|
84
|
+
end
|
|
85
|
+
catch(:ball) do
|
|
86
|
+
raise ArgumentError.new("iterative factorial couldn't take this value's load. Terminated.")
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
if (command == 'sigma')
|
|
90
|
+
inta = ask("Enter a value: ", Integer)
|
|
91
|
+
intx = ask("Enter x value: ", Integer)
|
|
92
|
+
intb = ask("Enter b value: ", Integer)
|
|
93
|
+
pw = ask("Enter power value: ", Integer)
|
|
94
|
+
puts sigma(inta, intx, intb, pw)
|
|
95
|
+
end
|
|
96
|
+
if (command == 'stirling')
|
|
97
|
+
begin
|
|
98
|
+
strln = ask("Enter stirling procedure value: ", Integer)
|
|
99
|
+
throw :glass if (strln >= MAX_INTEGER)
|
|
100
|
+
puts stirling(strln)
|
|
101
|
+
end
|
|
102
|
+
catch(:glass) do
|
|
103
|
+
raise ArgumentError.new("stirling couldn't take this value's load. Terminated.")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
if (command == 'subset')
|
|
107
|
+
gen = ask("Enter mass objects number: ", Integer)
|
|
108
|
+
zerosbst = agree("Include zero subset?")
|
|
109
|
+
puts subset(gen, zerosbst)
|
|
110
|
+
end
|
|
111
|
+
if (command == 'fibsum')
|
|
112
|
+
n = ask("Enter n value: ", Integer)
|
|
113
|
+
puts sum_of_fib(n)
|
|
114
|
+
end
|
|
115
|
+
if (command == 'twinprdx')
|
|
116
|
+
mass = ask("Enter mass number: ", Integer)
|
|
117
|
+
puts twin_prdx(mass)
|
|
118
|
+
end
|
|
119
|
+
if (command == 'uipow')
|
|
120
|
+
base = ask("Enter base value: ", Integer)
|
|
121
|
+
exp = ask("Enter power value: ", Integer)
|
|
122
|
+
puts ui_pow(base, exp)
|
|
123
|
+
end
|
|
124
|
+
end until(command == 'exit')
|
data/lib/help.rb
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
def help
|
|
3
|
+
puts "
|
|
4
|
+
Valid Commands
|
|
5
|
+
===============
|
|
6
|
+
help Show this manpage
|
|
7
|
+
certain Show certain conditions page
|
|
8
|
+
factorial Recursive definition of factorial
|
|
9
|
+
'n' is the number which will calculated in procedure
|
|
10
|
+
binsearch *binary => array
|
|
11
|
+
*size => binary array's size
|
|
12
|
+
*search_key => Compare string
|
|
13
|
+
*General values
|
|
14
|
+
*low => low value representation
|
|
15
|
+
*middle => middle value representation
|
|
16
|
+
*high => high value representation
|
|
17
|
+
birdseye Bird's Eye View Procedure
|
|
18
|
+
combinatorial 'glb' represents is General mass of combinatorial approach
|
|
19
|
+
'klb' represents is Selection mass of combinatorial approach
|
|
20
|
+
distpres 'presnum' value represents Present count.
|
|
21
|
+
eagleview Eagle View Procedure
|
|
22
|
+
fermatlittle Fermat Little Theorem's Procedural Representation
|
|
23
|
+
fib Additive recursive definition of Fibonacci
|
|
24
|
+
isprime Is Prime Procedure
|
|
25
|
+
'nb' is the input argument number of procedure
|
|
26
|
+
iterativefact Iterative factorial of procedural representation
|
|
27
|
+
sigma Sigma procedure's simple procedure is rely on '(ax+b)^pw'
|
|
28
|
+
a represented by inta;
|
|
29
|
+
b represented by intb;
|
|
30
|
+
x represented by intx;
|
|
31
|
+
power represented by pw.
|
|
32
|
+
stirling 'strln' is the stirling number in stirling formula
|
|
33
|
+
subset 'zerosbst' variable, decision mechanism of zero subset is included or not included
|
|
34
|
+
'gen' is the general mass elements(objects) number
|
|
35
|
+
fibsum Fibonacci Sum Procedure
|
|
36
|
+
twinprdx Twin Paradox Lemma Solution Procedure
|
|
37
|
+
Selection mass represented by 'mass' value
|
|
38
|
+
uipow Non-balanced power calculation procedure
|
|
39
|
+
"
|
|
40
|
+
end
|
data/lib/librbdiscrete.rb
CHANGED
|
@@ -5,6 +5,7 @@ require 'yaml'
|
|
|
5
5
|
|
|
6
6
|
EVALUE = 2.718281828459045235360287471352662497757247093
|
|
7
7
|
PIVALUE = 3.141592653589793238462643383279502884197169399
|
|
8
|
+
MAX_INTEGER = 1073741823
|
|
8
9
|
|
|
9
10
|
err = "An error occured during during procedure"
|
|
10
11
|
|
|
@@ -20,7 +21,7 @@ factorial(n)
|
|
|
20
21
|
Iterative factorial definition
|
|
21
22
|
=end
|
|
22
23
|
def factorial( n )
|
|
23
|
-
if n <= 1
|
|
24
|
+
if (n <= 1)
|
|
24
25
|
return 1
|
|
25
26
|
else
|
|
26
27
|
return n*factorial( n-1 ).to_i
|
|
@@ -78,21 +79,19 @@ Subset Procedure v1.1.3
|
|
|
78
79
|
= SYNOPSIS
|
|
79
80
|
subset(gen, zerosbst)
|
|
80
81
|
'zerosbst' variable, decision mechanism of zero subset is included or not included
|
|
81
|
-
'gen' is the
|
|
82
|
+
'gen' is the general mass elements(objects) number
|
|
82
83
|
|
|
83
84
|
= DESCRIPTION
|
|
84
85
|
Calculate subset number of input arguments
|
|
85
86
|
=end
|
|
86
87
|
def subset(gen, zerosbst)
|
|
87
88
|
main = case (zerosbst)
|
|
88
|
-
when zerosbst ==
|
|
89
|
+
when zerosbst == true
|
|
89
90
|
rslt = ui_pow(2, gen) - 1
|
|
90
91
|
return rslt
|
|
91
|
-
when zerosbst ==
|
|
92
|
+
when zerosbst == false
|
|
92
93
|
rslt = ui_pow(2, gen)
|
|
93
94
|
return rslt
|
|
94
|
-
else
|
|
95
|
-
puts "Enter 'y' or 'n' char"
|
|
96
95
|
end
|
|
97
96
|
return main
|
|
98
97
|
end
|
|
@@ -247,7 +246,7 @@ Additive recursive definition of Fibonacci
|
|
|
247
246
|
def fib(n)
|
|
248
247
|
if (n <= 1)
|
|
249
248
|
return n;
|
|
250
|
-
|
|
249
|
+
else
|
|
251
250
|
return fib(n-1)+fib(n-2);
|
|
252
251
|
end
|
|
253
252
|
end
|
|
@@ -286,11 +285,11 @@ end
|
|
|
286
285
|
Binary Search Spec. Procedure v1.5.9
|
|
287
286
|
|
|
288
287
|
= SYNOPSIS
|
|
289
|
-
binary_search(binary, size,
|
|
288
|
+
binary_search(binary, size, search_key, low, middle, high)
|
|
290
289
|
== Binary search
|
|
291
290
|
*binary => array
|
|
292
291
|
*size => binary array's size
|
|
293
|
-
*
|
|
292
|
+
*search_key => Compare string
|
|
294
293
|
*General values
|
|
295
294
|
*low => low value representation
|
|
296
295
|
*middle => middle value representation
|
|
@@ -299,13 +298,13 @@ binary_search(binary, size, searchKey, low, middle, high)
|
|
|
299
298
|
= DESCRIPTION
|
|
300
299
|
Binary search
|
|
301
300
|
=end
|
|
302
|
-
def binary_search(binary, size,
|
|
301
|
+
def binary_search(binary, size, search_key, low, middle, high)
|
|
303
302
|
while (low <= high)
|
|
304
303
|
middle=(low+high)/2;
|
|
305
304
|
print_row(binary, size, low, middle, high);
|
|
306
|
-
if (
|
|
305
|
+
if (search_key == binary[middle])
|
|
307
306
|
return middle;
|
|
308
|
-
elsif (
|
|
307
|
+
elsif (search_key <= binary[middle])
|
|
309
308
|
high=middle-1
|
|
310
309
|
else
|
|
311
310
|
low=middle+1
|
|
@@ -351,7 +350,7 @@ sum_of_fib(n)
|
|
|
351
350
|
Basic reps
|
|
352
351
|
|
|
353
352
|
= DESCRIPTION
|
|
354
|
-
|
|
353
|
+
Fibonacci Sum Procedure
|
|
355
354
|
=end
|
|
356
355
|
def sum_of_fib(n)
|
|
357
356
|
return fib(n+2)-1;
|
|
@@ -375,18 +374,18 @@ Is Prime Procedure
|
|
|
375
374
|
=end
|
|
376
375
|
def is_prime(nb)
|
|
377
376
|
test = count = 0
|
|
378
|
-
if (nb
|
|
377
|
+
if (nb == 1)
|
|
379
378
|
return -1
|
|
380
379
|
end
|
|
381
380
|
for i in 2..nb-1
|
|
382
381
|
count++
|
|
383
382
|
if (nb % i == 0)
|
|
384
|
-
test =
|
|
383
|
+
test = false
|
|
385
384
|
end
|
|
386
385
|
end
|
|
387
386
|
if (!test)
|
|
388
387
|
return 1
|
|
389
|
-
|
|
388
|
+
else
|
|
390
389
|
return 0
|
|
391
390
|
end
|
|
392
391
|
end
|
|
@@ -404,9 +403,34 @@ Fermat Little Theorem's Procedural Representation
|
|
|
404
403
|
(('WARNING'))((-Modular representation maybe couldn't evaluated-))
|
|
405
404
|
=end
|
|
406
405
|
def fermat_little(p, a)
|
|
406
|
+
begin
|
|
407
407
|
if(p%(ui_pow(a, (p-1))-1) == 0)
|
|
408
408
|
return 0
|
|
409
|
-
|
|
409
|
+
else
|
|
410
410
|
return 1
|
|
411
411
|
end
|
|
412
|
+
end
|
|
413
|
+
rescue
|
|
414
|
+
begin
|
|
415
|
+
ArgumentError.new("High load. Terminated.")
|
|
416
|
+
end
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
=begin
|
|
420
|
+
= NAME
|
|
421
|
+
to_bool v.0.0.1
|
|
422
|
+
|
|
423
|
+
=SYNOPSIS
|
|
424
|
+
to_bool(void)
|
|
425
|
+
=DESCRIPTION
|
|
426
|
+
to bool is convert integer valus to string boolean
|
|
427
|
+
=end
|
|
428
|
+
def to_bool
|
|
429
|
+
if (self.to_bool == 1)
|
|
430
|
+
puts "TRUE"
|
|
431
|
+
elsif (self.to_bool == 0)
|
|
432
|
+
puts "FALSE"
|
|
433
|
+
elsif (self.to_bool == -1)
|
|
434
|
+
puts "NaN"
|
|
435
|
+
end
|
|
412
436
|
end
|
data/lib/rubmat.rb
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# AUTHOR: Mahmut Bulut
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
require 'librbdiscrete.rb'
|
|
7
|
+
require 'fixnumexpand.rb'
|
|
8
|
+
require 'commander'
|
|
9
|
+
require 'help'
|
|
10
|
+
|
|
11
|
+
puts "===RubMat===
|
|
12
|
+
Copyright (C) <2011> <Mahmut Bulut>
|
|
13
|
+
This program comes with ABSOLUTELY NO WARRANTY; for details type 'help'.
|
|
14
|
+
This is free software, and you are welcome to redistribute it
|
|
15
|
+
under certain conditions; type `certain' for details."
|
|
16
|
+
puts ""
|
|
17
|
+
begin
|
|
18
|
+
command = ask(">=> ")
|
|
19
|
+
#command = commn.chomp!
|
|
20
|
+
# Read arguments and defines commands
|
|
21
|
+
# Will handle command line whitespaces
|
|
22
|
+
|
|
23
|
+
if (command == 'help')
|
|
24
|
+
puts help()
|
|
25
|
+
end
|
|
26
|
+
if (command == 'certain')
|
|
27
|
+
puts "To see certain conditions please visit http://www.gnu.org/licenses/gpl-2.0.html#SEC3"
|
|
28
|
+
end
|
|
29
|
+
if (command == 'factorial')
|
|
30
|
+
n = ask("Enter N value: ", Integer)
|
|
31
|
+
puts factorial(n)
|
|
32
|
+
end
|
|
33
|
+
if (command == 'binsearch')
|
|
34
|
+
begin
|
|
35
|
+
binary = ask("Enter array name with [ & ] suffix: ")
|
|
36
|
+
size = ask("Enter size of search range: ", Integer)
|
|
37
|
+
search_key = ask("Enter search delimiter key", Integer)
|
|
38
|
+
low = ask("Lower limit: ", Integer)
|
|
39
|
+
middle = ask("Medium limit: ", Integer)
|
|
40
|
+
high = ask("High limit: ", Integer)
|
|
41
|
+
puts binary_search(binary, size, search_key, low, middle, high)
|
|
42
|
+
rescue => error
|
|
43
|
+
puts error
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
if (command == 'birdseye')
|
|
47
|
+
n = ask("Enter workspace mass number: ", Integer)
|
|
48
|
+
k = ask("Enter selection mass number: ", Integer)
|
|
49
|
+
puts birds_eye(n, k)
|
|
50
|
+
end
|
|
51
|
+
if (command == 'combinatorial')
|
|
52
|
+
glb = ask("Enter global set objects number: ", Integer)
|
|
53
|
+
ksb = ask("Enter k-subset objects number: ", Integer)
|
|
54
|
+
puts combinatorial(glb, ksb)
|
|
55
|
+
end
|
|
56
|
+
if (command == 'distpres')
|
|
57
|
+
presnum = ask("Present number: ", Integer)
|
|
58
|
+
puts dist_pres(presnum)
|
|
59
|
+
end
|
|
60
|
+
if (command == 'eagleview')
|
|
61
|
+
m = ask("Enter m value: ", Integer)
|
|
62
|
+
t = ask("Enter t value: ", Integer)
|
|
63
|
+
puts eagle_view(m, t)
|
|
64
|
+
end
|
|
65
|
+
if (command == 'fermatlittle')
|
|
66
|
+
p = ans("Enter power number: ", Integer)
|
|
67
|
+
a = ans("Enter base number:", Integer)
|
|
68
|
+
puts fermat_little(p, a)
|
|
69
|
+
end
|
|
70
|
+
if (command == 'fib')
|
|
71
|
+
n = ans("Enter the last incremental number: ", Integer)
|
|
72
|
+
puts fib(n)
|
|
73
|
+
end
|
|
74
|
+
if (command == 'isprime')
|
|
75
|
+
raise RuntimeError.new("Have some critical issues closed to next minor version")
|
|
76
|
+
# nb = ask("Control number: ", Integer)
|
|
77
|
+
# puts is_prime(nb)
|
|
78
|
+
end
|
|
79
|
+
if (command == 'iterativefact')
|
|
80
|
+
begin
|
|
81
|
+
itrtnum = ask("Enter the factorial input: ", Integer)
|
|
82
|
+
throw :ball if (itrtnum >= MAX_INTEGER)
|
|
83
|
+
puts iterative_fact(itrtnum)
|
|
84
|
+
end
|
|
85
|
+
catch(:ball) do
|
|
86
|
+
raise ArgumentError.new("iterative factorial couldn't take this value's load. Terminated.")
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
if (command == 'sigma')
|
|
90
|
+
inta = ask("Enter a value: ", Integer)
|
|
91
|
+
intx = ask("Enter x value: ", Integer)
|
|
92
|
+
intb = ask("Enter b value: ", Integer)
|
|
93
|
+
pw = ask("Enter power value: ", Integer)
|
|
94
|
+
puts sigma(inta, intx, intb, pw)
|
|
95
|
+
end
|
|
96
|
+
if (command == 'stirling')
|
|
97
|
+
begin
|
|
98
|
+
strln = ask("Enter stirling procedure value: ", Integer)
|
|
99
|
+
throw :glass if (strln >= MAX_INTEGER)
|
|
100
|
+
puts stirling(strln)
|
|
101
|
+
end
|
|
102
|
+
catch(:glass) do
|
|
103
|
+
raise ArgumentError.new("stirling couldn't take this value's load. Terminated.")
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
if (command == 'subset')
|
|
107
|
+
gen = ask("Enter mass objects number: ", Integer)
|
|
108
|
+
zerosbst = agree("Include zero subset?")
|
|
109
|
+
puts subset(gen, zerosbst)
|
|
110
|
+
end
|
|
111
|
+
if (command == 'fibsum')
|
|
112
|
+
n = ask("Enter n value: ", Integer)
|
|
113
|
+
puts sum_of_fib(n)
|
|
114
|
+
end
|
|
115
|
+
if (command == 'twinprdx')
|
|
116
|
+
mass = ask("Enter mass number: ", Integer)
|
|
117
|
+
puts twin_prdx(mass)
|
|
118
|
+
end
|
|
119
|
+
if (command == 'uipow')
|
|
120
|
+
base = ask("Enter base value: ", Integer)
|
|
121
|
+
exp = ask("Enter power value: ", Integer)
|
|
122
|
+
puts ui_pow(base, exp)
|
|
123
|
+
end
|
|
124
|
+
end until(command == 'exit')
|
data/lib/statics.yml
CHANGED
metadata
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: RubMat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 7
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 2.1.
|
|
9
|
+
- 6
|
|
10
|
+
version: 2.1.6
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
|
-
-
|
|
13
|
+
- Mahmut Bulut
|
|
14
14
|
autorequire:
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-07-08 00:00:00 Z
|
|
19
19
|
dependencies: []
|
|
20
20
|
|
|
21
21
|
description: Discrete Mathematics solver and Usable Library
|
|
22
22
|
email: scienceblock@gmail.com
|
|
23
|
-
executables:
|
|
24
|
-
|
|
23
|
+
executables:
|
|
24
|
+
- rubmat.rb
|
|
25
25
|
extensions: []
|
|
26
26
|
|
|
27
27
|
extra_rdoc_files:
|
|
28
|
-
- README
|
|
28
|
+
- README.md
|
|
29
29
|
- LICENSE
|
|
30
30
|
- gplv3.png
|
|
31
31
|
- RubMat.png
|
|
32
32
|
files:
|
|
33
33
|
- LICENSE
|
|
34
|
-
- README
|
|
34
|
+
- README.md
|
|
35
35
|
- Rakefile
|
|
36
36
|
- gplv3.png
|
|
37
37
|
- RubMat.png
|
|
38
|
+
- bin/rubmat.rb
|
|
38
39
|
- lib/fixnumexpand.rb
|
|
40
|
+
- lib/help.rb
|
|
39
41
|
- lib/librbdiscrete.rb
|
|
40
|
-
- lib/
|
|
42
|
+
- lib/rubmat.rb
|
|
41
43
|
- lib/statics.yml
|
|
42
44
|
homepage: http://regularlambda.github.com/RubMat
|
|
43
45
|
licenses: []
|
data/README
DELETED
data/lib/main.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/ruby
|
|
2
|
-
|
|
3
|
-
# AUTHOR: Matthew Manahan
|
|
4
|
-
|
|
5
|
-
require 'yaml'
|
|
6
|
-
require 'librbdiscrete.rb'
|
|
7
|
-
require 'fixnumexpand.rb'
|
|
8
|
-
|
|
9
|
-
puts "===RubMat===
|
|
10
|
-
Copyright (C) <2011> <Matthew Manahan>
|
|
11
|
-
This program comes with ABSOLUTELY NO WARRANTY; for details type 'help'.
|
|
12
|
-
This is free software, and you are welcome to redistribute it
|
|
13
|
-
under certain conditions; type `certain' for details."
|