RubMat 2.2.1 → 2.2.2
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/.document +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +46 -17
- data/VERSION +1 -0
- data/bin/rubmat +4 -128
- data/lib/rubmat.rb +597 -102
- data/test/helper.rb +18 -0
- data/test/test_rubmat.rb +7 -0
- metadata +119 -30
- data/LICENSE +0 -17
- data/README.md +0 -9
- data/RubMat.png +0 -0
- data/gplv3.png +0 -0
- data/lib/fixnumexpand.rb +0 -35
- data/lib/help.rb +0 -40
- data/lib/librbdiscrete.rb +0 -435
- data/lib/main.rb +0 -125
- data/lib/statics.yml +0 -4
data/lib/main.rb
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# AUTHOR: Mahmut Bulut
|
4
|
-
#$LOAD_PATH.unshift File.dirname(__FILE__)
|
5
|
-
#require File.dirname(__FILE__) + '/lib/librbdiscrete.rb'
|
6
|
-
#require File.expand_path(File.join(File.dirname(__FILE__)))
|
7
|
-
require 'librbdiscrete'
|
8
|
-
require 'fixnumexpand'
|
9
|
-
require 'commander'
|
10
|
-
require 'help'
|
11
|
-
|
12
|
-
puts "===RubMat===
|
13
|
-
Copyright (C) <2011> <Mahmut Bulut>
|
14
|
-
This program comes with ABSOLUTELY NO WARRANTY; for details type 'help'.
|
15
|
-
This is free software, and you are welcome to redistribute it
|
16
|
-
under certain conditions; type `certain' for details."
|
17
|
-
puts ""
|
18
|
-
begin
|
19
|
-
command = ask(">=> ")
|
20
|
-
#command = commn.chomp!
|
21
|
-
# Read arguments and defines commands
|
22
|
-
# Will handle command line whitespaces
|
23
|
-
|
24
|
-
if (command == 'help')
|
25
|
-
puts help()
|
26
|
-
end
|
27
|
-
if (command == 'certain')
|
28
|
-
puts "To see certain conditions please visit http://www.gnu.org/licenses/gpl-2.0.html#SEC3"
|
29
|
-
end
|
30
|
-
if (command == 'factorial')
|
31
|
-
n = ask("Enter N value: ", Integer)
|
32
|
-
puts factorial(n)
|
33
|
-
end
|
34
|
-
if (command == 'binsearch')
|
35
|
-
begin
|
36
|
-
binary = ask("Enter array name with [ & ] suffix: ")
|
37
|
-
size = ask("Enter size of search range: ", Integer)
|
38
|
-
search_key = ask("Enter search delimiter key", Integer)
|
39
|
-
low = ask("Lower limit: ", Integer)
|
40
|
-
middle = ask("Medium limit: ", Integer)
|
41
|
-
high = ask("High limit: ", Integer)
|
42
|
-
puts binary_search(binary, size, search_key, low, middle, high)
|
43
|
-
rescue => error
|
44
|
-
puts error
|
45
|
-
end
|
46
|
-
end
|
47
|
-
if (command == 'birdseye')
|
48
|
-
n = ask("Enter workspace mass number: ", Integer)
|
49
|
-
k = ask("Enter selection mass number: ", Integer)
|
50
|
-
puts birds_eye(n, k)
|
51
|
-
end
|
52
|
-
if (command == 'combinatorial')
|
53
|
-
glb = ask("Enter global set objects number: ", Integer)
|
54
|
-
ksb = ask("Enter k-subset objects number: ", Integer)
|
55
|
-
puts combinatorial(glb, ksb)
|
56
|
-
end
|
57
|
-
if (command == 'distpres')
|
58
|
-
presnum = ask("Present number: ", Integer)
|
59
|
-
puts dist_pres(presnum)
|
60
|
-
end
|
61
|
-
if (command == 'eagleview')
|
62
|
-
m = ask("Enter m value: ", Integer)
|
63
|
-
t = ask("Enter t value: ", Integer)
|
64
|
-
puts eagle_view(m, t)
|
65
|
-
end
|
66
|
-
if (command == 'fermatlittle')
|
67
|
-
p = ans("Enter power number: ", Integer)
|
68
|
-
a = ans("Enter base number:", Integer)
|
69
|
-
puts fermat_little(p, a)
|
70
|
-
end
|
71
|
-
if (command == 'fib')
|
72
|
-
n = ans("Enter the last incremental number: ", Integer)
|
73
|
-
puts fib(n)
|
74
|
-
end
|
75
|
-
if (command == 'isprime')
|
76
|
-
raise RuntimeError.new("Have some critical issues closed to next minor version")
|
77
|
-
# nb = ask("Control number: ", Integer)
|
78
|
-
# puts is_prime(nb)
|
79
|
-
end
|
80
|
-
if (command == 'iterativefact')
|
81
|
-
begin
|
82
|
-
itrtnum = ask("Enter the factorial input: ", Integer)
|
83
|
-
throw :ball if (itrtnum >= MAX_INTEGER)
|
84
|
-
puts iterative_fact(itrtnum)
|
85
|
-
end
|
86
|
-
catch(:ball) do
|
87
|
-
raise ArgumentError.new("iterative factorial couldn't take this value's load. Terminated.")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
if (command == 'sigma')
|
91
|
-
inta = ask("Enter a value: ", Integer)
|
92
|
-
intx = ask("Enter x value: ", Integer)
|
93
|
-
intb = ask("Enter b value: ", Integer)
|
94
|
-
pw = ask("Enter power value: ", Integer)
|
95
|
-
puts sigma(inta, intx, intb, pw)
|
96
|
-
end
|
97
|
-
if (command == 'stirling')
|
98
|
-
begin
|
99
|
-
strln = ask("Enter stirling procedure value: ", Integer)
|
100
|
-
throw :glass if (strln >= MAX_INTEGER)
|
101
|
-
puts stirling(strln)
|
102
|
-
end
|
103
|
-
catch(:glass) do
|
104
|
-
raise ArgumentError.new("stirling couldn't take this value's load. Terminated.")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
if (command == 'subset')
|
108
|
-
gen = ask("Enter mass objects number: ", Integer)
|
109
|
-
zerosbst = agree("Include zero subset?")
|
110
|
-
puts subset(gen, zerosbst)
|
111
|
-
end
|
112
|
-
if (command == 'fibsum')
|
113
|
-
n = ask("Enter n value: ", Integer)
|
114
|
-
puts sum_of_fib(n)
|
115
|
-
end
|
116
|
-
if (command == 'twinprdx')
|
117
|
-
mass = ask("Enter mass number: ", Integer)
|
118
|
-
puts twin_prdx(mass)
|
119
|
-
end
|
120
|
-
if (command == 'uipow')
|
121
|
-
base = ask("Enter base value: ", Integer)
|
122
|
-
exp = ask("Enter power value: ", Integer)
|
123
|
-
puts ui_pow(base, exp)
|
124
|
-
end
|
125
|
-
end until(command == 'exit')
|
data/lib/statics.yml
DELETED