num4diff 0.5.2 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4032b47cfd83b41e99e62fb6d2f7085af8c17692de3a7f40abc3480073213d28
4
- data.tar.gz: 725a5365017a298863de4504382f47ef2340e0b52976eb925164269509809991
3
+ metadata.gz: 90668160b1ac15b0d49e6cff8f558bb9b87173e545f392fda84fb05932e5dba3
4
+ data.tar.gz: c476a5eb4315a1b4707137912f0aa419016b9736393f07579f15542741d22706
5
5
  SHA512:
6
- metadata.gz: 810201bbeef874ac1c946cf454815fb0eb7dcc72cadd5b4ffd5f1150c3bcb5942e342127ef1b2440794a44e797e40922ab5aae55d8ba7be42fb63ab69ec7bcef
7
- data.tar.gz: e330e6e32a55a08798682bdcd83e47b4e9b591d2489491884f07a43b86b530ae95628c2b08578ef112adbd13526a8ddc96645afa437ecfb078436597e3ffd2c5
6
+ metadata.gz: cd2fbd09714a28fc84fe3eb1790b1e2ca05e33250b5d6c76bc25c0ff2112cd0e08920e8645830daf84fc681f5c1f9be16e98f32da0aae1d053eebb8ecbc8950c
7
+ data.tar.gz: d7c9925ba9a1923a8904e634579dc0a020911bcb7edf092f050f51482fc5aa8c2d06ce0b9d949e4ac97ef70748a294a3acf2c9b6f9a22cfa328917d604713de7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.5.4] - 2023-08-29
6
+
7
+ ### Changed
8
+ - chg add sample of yardoc
9
+
10
+ ## [0.5.3] - 2023-07-02
11
+
12
+ ### Fixed
13
+ - change bug for adamsBashforthMethod and adamsMoultonMethod.
14
+
5
15
  ## [0.5.2] - 2023-06-08
6
16
 
7
17
  ### Fixed
@@ -146,8 +146,9 @@ static double CNum4Diff_doAdamsBashforthMethod(int k, double a, double b, double
146
146
  f[k - 1] = y0;
147
147
  for (i = 0; i < k - 2; i++) {
148
148
  f[k - (i + 2)] = CNum4Diff_Tier_rungeKuttaMethod(f[k - (i + 1)], xi, h, func);
149
+ xi = xi + h;
149
150
  }
150
- for (xi = xi + h; xi < b; xi += h) {
151
+ for (xi = xi; xi < b; xi += h) {
151
152
  f[0] = CNum4Diff_Tier_rungeKuttaMethod(f[1], xi, h, func);
152
153
  // 予測子
153
154
  bk = 0.0;
@@ -180,8 +181,9 @@ static double CNum4Diff_doAdamsMoultonMethod(int k, double a, double b, double y
180
181
  f[k - 1] = y0;
181
182
  for (i = 0; i < k - 2; i++) {
182
183
  f[k - (i + 2)] = CNum4Diff_Tier_rungeKuttaMethod(f[k - (i + 1)], xi, h, func);
184
+ xi = xi + h;
183
185
  }
184
- for (xi = xi + h; xi < b; xi += h) {
186
+ for (xi = xi; xi < b; xi += h) {
185
187
  f[0] = CNum4Diff_Tier_rungeKuttaMethod(f[1], xi, h, func);
186
188
  // 予測子
187
189
  bk = 0.0;
data/lib/num4diff.rb CHANGED
@@ -15,39 +15,57 @@ module Num4DiffLib
15
15
  # @return [double] xiに対するyの値
16
16
  callback :f, [:double], :double
17
17
 
18
- #
19
18
  # オイラー法による数値計算
19
+ #
20
20
  # @overload eulerMethod(yi, xi, h, func)
21
- # yi_1 = eulerMethod(yi, xi, h, func)
22
21
  # @param [double] yi xiに対するyiの値
23
22
  # @param [double] xi xiの値
24
23
  # @param [double] h 刻み幅
25
24
  # @param [callback] func xiに対する傾きを計算する関数
26
25
  # @return [double] xi+hに対するyi_1の値
26
+ # @example
27
+ # yi = 1.0
28
+ # h = v
29
+ # func = Proc.new{|x|
30
+ # 1.0 + @a * x
31
+ # }
32
+ # yi_1 = Num4DiffLib::eulerMethod(yi, 0.0, h, func)
27
33
  #
28
34
  attach_function :eulerMethod,
29
35
  :CNum4Diff_Tier_eulerMethod, [:double, :double, :double, :f], :double
30
- #
31
36
  # ホイン法による数値計算
37
+ #
32
38
  # @overload heunMethod(yi, xi, h, func)
33
- # yi_1 = heunMethod(yi, xi, h, func)
34
39
  # @param [double] yi xiに対するyiの値
35
40
  # @param [double] xi xiの値
36
41
  # @param [double] h 刻み幅
37
42
  # @param [callback] func xiに対する傾きを計算する関数
38
43
  # @return [double] xi+hに対するyi_1の値
44
+ # @example
45
+ # yi = 1.0
46
+ # h = v
47
+ # func = Proc.new{|x|
48
+ # 1.0 + @a * x
49
+ # }
50
+ # yi_1 = Num4DiffLib::heunMethod(yi, 0.0, h, func)
39
51
  #
40
52
  attach_function :heunMethod,
41
53
  :CNum4Diff_Tier_heunMethod, [:double, :double, :double, :f], :double
42
- #
43
54
  # 4次のルンゲ=クッタ法による数値計算
55
+ #
44
56
  # @overload rungeKuttaMethod(yi, xi, h, func)
45
- # yi_1 = rungeKuttaMethod(yi, xi, h, func)
46
57
  # @param [double] yi xiに対するyiの値
47
58
  # @param [double] xi xiの値
48
59
  # @param [double] h 刻み幅
49
60
  # @param [callback] func xiに対する傾きを計算する関数
50
61
  # @return [double] xi+hに対するyi_1の値
62
+ # @example
63
+ # yi = 1.0
64
+ # h = v
65
+ # func = Proc.new{|x|
66
+ # 1.0 + @a * x
67
+ # }
68
+ # yi_1 = Num4DiffLib::rungeKuttaMethod(yi, 0.0, h, func)
51
69
  #
52
70
  attach_function :rungeKuttaMethod,
53
71
  :CNum4Diff_Tier_rungeKuttaMethod, [:double, :double, :double, :f], :double
@@ -61,12 +79,19 @@ module Num4DiffLib
61
79
  # @param [double] h 刻み幅
62
80
  # @param [callback] func xiに対する傾きを計算する関数
63
81
  # @return [double] [a,b]の積分値
82
+ # @example
83
+ # yi = 1.0
84
+ # h = v
85
+ # func = Proc.new{|x|
86
+ # 1.0 + @a * x
87
+ # }
88
+ # yi_1 = Num4DiffLib::adamsBashforthMethod(2, 0, 1, yi, h, func)
64
89
  #
65
90
  attach_function :adamsBashforthMethod,
66
91
  :CNum4Diff_Multistage_adamsBashforthMethod, [:int, :double, :double, :double, :double, :f], :double
67
- #
68
92
  # アダムス・ムルトン法(k段)による数値計算
69
- # @overload adamsMoultonMethod(k, a, b, y0, xi, h, func)
93
+ #
94
+ # @overload adamsMoultonMethod(k, a, b, y0, h, func)
70
95
  # @param [int] k k段アダムス法
71
96
  # @param [double] a 下限値
72
97
  # @param [double] b 上限値
@@ -74,6 +99,13 @@ module Num4DiffLib
74
99
  # @param [double] h 刻み幅
75
100
  # @param [callback] func xiに対する傾きを計算する関数
76
101
  # @return [double] [a,b]の積分値
102
+ # @example
103
+ # yi = 1.0
104
+ # h = v
105
+ # func = Proc.new{|x|
106
+ # 1.0 + @a * x
107
+ # }
108
+ # yi_1 = Num4DiffLib::adamsMoultonMethod(2, 0, 1, yi, h, func)
77
109
  #
78
110
  attach_function :adamsMoultonMethod,
79
111
  :CNum4Diff_Multistage_adamsMoultonMethod, [:int, :double, :double, :double, :double, :f], :double
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: num4diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - siranovel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-08 00:00:00.000000000 Z
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi-compiler
@@ -69,7 +69,7 @@ licenses:
69
69
  - MIT
70
70
  metadata:
71
71
  changelog_uri: http://github.com/siranovel/num4different/blob/main/CHANGELOG.md
72
- documentation_uri: https://rubydoc.info/gems/num4diff/0.5.2
72
+ documentation_uri: https://rubydoc.info/gems/num4diff/0.5.4
73
73
  homepage_uri: http://github.com/siranovel/num4different
74
74
  wiki_uri: https://github.com/siranovel/mydocs/tree/main/num4different
75
75
  post_install_message: