rical 1.2.0 → 1.2.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/lib/rical.rb +9 -7
- data/lib/rical/version.rb +1 -1
- 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: 48031978c206844c5d5466c54e889e6405539038
|
|
4
|
+
data.tar.gz: c16632c44d9c8e98af45558589ca1439cb26c149
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c082f799a788a7a474ae229852c924f7cd47a18bb9f643dc3b6718edb345f79f674db83e835a62b460ebdc1be9e2360484f2bdeb9c6ebb246c4c0967e72900c
|
|
7
|
+
data.tar.gz: 0726601abf8ea7de181228ea190b42868b1ca79cf0ffd82942e94145eb12b52d0ebe77f23eadf636aac3508f713486bbf5c01f7706754bdd1232922c316621e2
|
data/lib/rical.rb
CHANGED
|
@@ -30,10 +30,10 @@ module Rical
|
|
|
30
30
|
private
|
|
31
31
|
def newton_raphson_root_for f, fargs, df, dfargs, x, n, err
|
|
32
32
|
n.times do
|
|
33
|
-
fx
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
x = x -
|
|
33
|
+
fx = compute f, x, fargs
|
|
34
|
+
slope = compute df, x, dfargs
|
|
35
|
+
slope = 10 * err if slope == 0
|
|
36
|
+
x = x - fx / slope
|
|
37
37
|
return x if compute(f, x, fargs).abs < err
|
|
38
38
|
end
|
|
39
39
|
raise NoConvergenceError
|
|
@@ -43,9 +43,11 @@ private
|
|
|
43
43
|
n.times do
|
|
44
44
|
fx0 = compute f, x0, fargs
|
|
45
45
|
fx1 = compute f, x1, fargs
|
|
46
|
-
delta =
|
|
47
|
-
delta =
|
|
48
|
-
|
|
46
|
+
delta = x1 - x0
|
|
47
|
+
delta = 10 * err if delta == 0
|
|
48
|
+
slope = (fx1 - fx0) / delta
|
|
49
|
+
slope = 10 * err if slope == 0
|
|
50
|
+
x = x1 - fx1 / slope
|
|
49
51
|
return x if compute(f, x, fargs).abs < err
|
|
50
52
|
x0, x1 = x1, x
|
|
51
53
|
end
|
data/lib/rical/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rical
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luis Bacelar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-01-
|
|
11
|
+
date: 2015-01-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|