num4inte 0.1.2 → 0.1.3
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/CHANGELOG.md +5 -0
- data/lib/num4inte.rb +36 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef1a2753baae3d2afbad40324d2b539be362f2ac2d251098c4e31fdd241d1313
|
4
|
+
data.tar.gz: 54f341ae2ba1d78c33c85645b047b71dd6f99d0fe5c7912d0023cfc1f4b7368d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e546ea9835614ae65f33138843cce8276c4a9a7c869b5b58191048c4ecee155b8c6ed3e101dd8c6472758739f589ef8fa19817d5077fb94e6ab8a5fe41c85099
|
7
|
+
data.tar.gz: 553347ed076023b15316dd254f0ebb6ddd6800318db8b1ec68451449d29d9d4a2aab389f9639fa79fd41e49b8f253bc8d34e85cdc1db8a155be2b200ad222ae6
|
data/CHANGELOG.md
CHANGED
data/lib/num4inte.rb
CHANGED
@@ -15,8 +15,8 @@ module Num4InteLib
|
|
15
15
|
# @return [double] xiに対するyの値
|
16
16
|
callback :f, [:double], :double
|
17
17
|
|
18
|
-
#
|
19
18
|
# 左リーマン和法
|
19
|
+
#
|
20
20
|
# @overload leftReimannSumMethod(a, b, h, func)
|
21
21
|
# y = leftReimannSumMethod(a, b, h, func)
|
22
22
|
# @param [double] a aの値
|
@@ -24,11 +24,17 @@ module Num4InteLib
|
|
24
24
|
# @param [double] h 刻み幅
|
25
25
|
# @param [callback] func xiに対する傾きを計算する関数
|
26
26
|
# @return [double] [a,b]の間の積分値
|
27
|
+
# @example
|
28
|
+
# h = 0.001
|
29
|
+
# func = Proc.new{|x|
|
30
|
+
# next 4 / (1 + x * x)
|
31
|
+
# }
|
32
|
+
# y = Num4InteLib.leftReimannSumMethod(0, 1, h, func)
|
27
33
|
#
|
28
34
|
attach_function :leftReimannSumMethod,
|
29
35
|
:CNum4Inte_reimann_leftReimannSumMethod, [:double, :double, :double, :f], :double
|
30
|
-
#
|
31
36
|
# 右リーマン和法
|
37
|
+
#
|
32
38
|
# @overload rigtReimannSumMethod(a, b, h, func)
|
33
39
|
# y = rigtReimannSumMethod(a, b, h, func)
|
34
40
|
# @param [double] a aの値
|
@@ -36,11 +42,17 @@ module Num4InteLib
|
|
36
42
|
# @param [double] h 刻み幅
|
37
43
|
# @param [callback] func xiに対する傾きを計算する関数
|
38
44
|
# @return [double] [a,b]の間の積分値
|
45
|
+
# @example
|
46
|
+
# h = 0.001
|
47
|
+
# func = Proc.new{|x|
|
48
|
+
# next 4 / (1 + x * x)
|
49
|
+
# }
|
50
|
+
# y = Num4InteLib.rigtReimannSumMethod(0, 1, h, func)
|
39
51
|
#
|
40
52
|
attach_function :rigtReimannSumMethod,
|
41
53
|
:CNum4Inte_reimann_rigtReimannSumMethod, [:double, :double, :double, :f], :double
|
42
|
-
#
|
43
54
|
# ニュートン・コーツ法(1次:台形公式)
|
55
|
+
#
|
44
56
|
# @overload trapezioidalRule(a, b, h, func)
|
45
57
|
# y = trapezioidalRule(a, b, h, func)
|
46
58
|
# @param [double] a aの値
|
@@ -48,11 +60,17 @@ module Num4InteLib
|
|
48
60
|
# @param [double] h 刻み幅
|
49
61
|
# @param [callback] func xiに対する傾きを計算する関数
|
50
62
|
# @return [double] [a,b]の間の積分値
|
63
|
+
# @example
|
64
|
+
# h = 0.001
|
65
|
+
# func = Proc.new{|x|
|
66
|
+
# next 4 / (1 + x * x)
|
67
|
+
# }
|
68
|
+
# y = Num4InteLib.trapezioidalRule(0, 1, h, func)
|
51
69
|
#
|
52
70
|
attach_function :trapezioidalRule,
|
53
71
|
:CNum4Inte_rewton_trapezioidalRule, [:double, :double, :double, :f], :double
|
54
|
-
#
|
55
72
|
# ニュートン・コーツ法(2次:シンプソンの公式)
|
73
|
+
#
|
56
74
|
# @overload simpsonRule(a, b, h, func)
|
57
75
|
# y = simpsonRule(a, b, h, func)
|
58
76
|
# @param [double] a aの値
|
@@ -60,11 +78,17 @@ module Num4InteLib
|
|
60
78
|
# @param [double] h 刻み幅
|
61
79
|
# @param [callback] func xiに対する傾きを計算する関数
|
62
80
|
# @return [double] [a,b]の間の積分値
|
81
|
+
# @example
|
82
|
+
# h = 0.001
|
83
|
+
# func = Proc.new{|x|
|
84
|
+
# next 4 / (1 + x * x)
|
85
|
+
# }
|
86
|
+
# y = Num4InteLib.simpsonRule(0, 1, h, func)
|
63
87
|
#
|
64
88
|
attach_function :simpsonRule,
|
65
89
|
:CNum4Inte_rewton_simpsonRule, [:double, :double, :double, :f], :double
|
66
|
-
#
|
67
90
|
# ガウス求積法
|
91
|
+
#
|
68
92
|
# @overload gaussLegendreRule(n, a, b, h, func)
|
69
93
|
# y = gaussLegendreRule(n, a, b, h, func)
|
70
94
|
# @param [int] n 分割数
|
@@ -73,6 +97,13 @@ module Num4InteLib
|
|
73
97
|
# @param [double] h 刻み幅
|
74
98
|
# @param [callback] func xiに対する傾きを計算する関数
|
75
99
|
# @return [double] [a,b]の間の積分値
|
100
|
+
# @example
|
101
|
+
# h = 0.001
|
102
|
+
# func = Proc.new{|x|
|
103
|
+
# next 4 / (1 + x * x)
|
104
|
+
# }
|
105
|
+
# y = Num4InteLib.gaussLegendreRule(3, 0, 1, h, func)
|
106
|
+
#
|
76
107
|
attach_function :gaussLegendreRule,
|
77
108
|
:CNum4Inte_gauss_gaussLegendreRule, [:int, :double, :double, :double, :f], :double
|
78
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: num4inte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- siranovel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-18 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/num4integral/blob/main/CHANGELOG.md
|
72
|
-
documentation_uri: https://rubydoc.info/gems/num4inte/0.1.
|
72
|
+
documentation_uri: https://rubydoc.info/gems/num4inte/0.1.3
|
73
73
|
homepage_uri: http://github.com/siranovel/num4integral
|
74
74
|
wiki_uri: https://github.com/siranovel/mydocs/tree/main/num4integral
|
75
75
|
post_install_message:
|