dydx 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/lib/dydx.rb +10 -6
- data/lib/dydx/helper.rb +4 -0
- data/lib/dydx/version.rb +1 -1
- data/spec/lib/function_spec.rb +6 -0
- data/spec/lib/integrand_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05d9adcc67c3ad1cbaf217f11bf2d71a5926588a
|
4
|
+
data.tar.gz: bd230293d17b20bf98ab7b6af22d03a544454f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96db75da9bb34f1dd34b4f7dc725d380031fd3092d93062e7d9289a41c35132612521ece1e3770ed0649f3c936ebd0daea965b13465a9c060f7b63258e7aa882
|
7
|
+
data.tar.gz: 47038bba5523d403d3f07153e22236e6f71d15846256d9f2db0772bf679834ac4c0b3ec9a16bd2b86f953ad268ee831e9fb9c6257529e4fe2b35046befafebd5
|
data/lib/dydx.rb
CHANGED
@@ -13,12 +13,16 @@ module Dydx
|
|
13
13
|
raise ArgumentError, "invalid number of values (#{vars.count} for #{function.vars.count})" unless function.vars.count == vars.count
|
14
14
|
return function if function.vars == vars
|
15
15
|
if function.algebra
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
if vars.all?{|v| v.is_a?(Numeric)}
|
17
|
+
string = function.algebra.to_s
|
18
|
+
.gsub('cos', 'Math.cos')
|
19
|
+
.gsub('sin', 'Math.sin')
|
20
|
+
.gsub('log', 'Math.log')
|
21
|
+
.gsub('e', 'Math::E')
|
22
|
+
.gsub('pi', 'Math::PI')
|
23
|
+
else
|
24
|
+
string = function.algebra.to_s
|
25
|
+
end
|
22
26
|
function.vars.each_with_index do |var, i|
|
23
27
|
string.gsub!(var.to_s, vars[i].to_s)
|
24
28
|
end
|
data/lib/dydx/helper.rb
CHANGED
data/lib/dydx/version.rb
CHANGED
data/spec/lib/function_spec.rb
CHANGED
@@ -30,4 +30,10 @@ describe Dydx:Function do
|
|
30
30
|
it{ expect(h(a, b, c) <= d/db(g(a, b))).to eq($h) }
|
31
31
|
it{ expect(h(a, b, c)).to eq(( ( 2 * b ) + a )) }
|
32
32
|
it{ expect(h(a, b, c).algebra).to eq(( ( 2 * b ) + a )) }
|
33
|
+
|
34
|
+
it 'ex.4' do
|
35
|
+
$f = nil
|
36
|
+
f(x) <= log(x)
|
37
|
+
expect(f(a)).to eq(log(a))
|
38
|
+
end
|
33
39
|
end
|
data/spec/lib/integrand_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dydx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gogotanaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|