num4mechaequ 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/num4mechaequ.rb +41 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece1c1f8ac4951ed3e9225bc0139f6a332f4ecc22d271cdcb149cd191e28840f
|
4
|
+
data.tar.gz: e9579a5fe2e05b269f0e0aac9c232588bcbe2660268098087311337b694ecd08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c943c0d56cdb23ba471236f6e772c70f20f0bc96303d9a3138ce7247e27c4ad48a52e63047ad055a2fb03522bdf99eeed6bc4b09b3d104ce19a5276046a8656
|
7
|
+
data.tar.gz: 2428c482848f27714fe833dd741347aa30e29f37191faecf35984a28bdab2c38a4c96787a4d1e7469afb94d927792322570769775bb20c44de330800c250cd7a
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## [0.1.2] - 2022-07-13
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- add function of UCM
|
9
|
+
- add function of pendulumMotion
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- change order of parameter of SHM
|
13
|
+
|
14
|
+
SHM(k, m, t, h0, v0) -> SHM(m, k, t, h0, v0)
|
15
|
+
|
5
16
|
## [0.1.1] - 2022-07-10
|
6
17
|
|
7
18
|
### Changed
|
data/lib/num4mechaequ.rb
CHANGED
@@ -38,15 +38,15 @@ module Num4MechaEquLib
|
|
38
38
|
|
39
39
|
#
|
40
40
|
# 単振動(simple harmonic motion)
|
41
|
-
# @overload SHM(
|
42
|
-
# @param [double] k バネ定数
|
41
|
+
# @overload SHM(m, k, t, h0, v0)
|
43
42
|
# @param [double] m 重りの重さ
|
43
|
+
# @param [double] k バネ定数
|
44
44
|
# @param [double] t 時間
|
45
45
|
# @param [double] h0 初期位置値
|
46
46
|
# @param [double] v0 初期速度
|
47
47
|
# @return [hash[]] 0秒からt秒までの位置(h)と速度(v)の値
|
48
48
|
#
|
49
|
-
def SHM(
|
49
|
+
def SHM(m, k, t, h0, v0)
|
50
50
|
@w = Math.sqrt((k / m))
|
51
51
|
hvt = []
|
52
52
|
yi_1 = []
|
@@ -111,6 +111,44 @@ module Num4MechaEquLib
|
|
111
111
|
yyi = yyi_1
|
112
112
|
}
|
113
113
|
return hvt
|
114
|
+
end
|
115
|
+
#
|
116
|
+
# 等速円運動(Uniform Circular motion)
|
117
|
+
# @overload UCM(m, r, w, t)
|
118
|
+
# @param [double] m 重りの重さ
|
119
|
+
# @param [double] r 半径
|
120
|
+
# @param [double] w 角速度
|
121
|
+
# @param [double] t 時間
|
122
|
+
# @return [hash[]] 0秒からt秒までの位置(h)と速度(v)の値
|
123
|
+
def UCM(m, r, w, t)
|
124
|
+
hvt = []
|
125
|
+
h = []
|
126
|
+
v = []
|
127
|
+
0.step(t, @dt) { |x|
|
128
|
+
sinwt = Math.sin(w * x)
|
129
|
+
coswt = Math.cos(w * x)
|
130
|
+
h = [r * coswt, r * sinwt]
|
131
|
+
v = [r * w * -sinwt, r * w * coswt]
|
132
|
+
a = [-r * w * w * coswt, -r * w * w * sinwt]
|
133
|
+
hvt.push({"t" => x,
|
134
|
+
"x" => {"h" => h[0], "v" => m * v[0]},
|
135
|
+
"y" => {"h" => h[1], "v" => m * v[1]},
|
136
|
+
}
|
137
|
+
)
|
138
|
+
}
|
139
|
+
return hvt
|
140
|
+
end
|
141
|
+
#
|
142
|
+
# 振り子運動
|
143
|
+
# @overload pendulumMotion(m, l, t, h0, v0)
|
144
|
+
# @param [double] m 重りの重さ
|
145
|
+
# @param [double] l 糸の長さ
|
146
|
+
# @param [double] t 時間
|
147
|
+
# @param [double] h0 初期位置値
|
148
|
+
# @param [double] v0 初期速度
|
149
|
+
# @return [hash[]] 0秒からt秒までの位置(h)と速度(v)の値
|
150
|
+
def pendulumMotion(m, l, t, h0, v0)
|
151
|
+
return SHM(m, l, t, h0, v0)
|
114
152
|
end
|
115
153
|
end
|
116
154
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: num4mechaequ
|
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
|
- siranovel
|
@@ -45,7 +45,7 @@ licenses:
|
|
45
45
|
- MIT
|
46
46
|
metadata:
|
47
47
|
changelog_uri: http://github.com/siranovel/num4mechaequation/blob/main/CHANGELOG.md
|
48
|
-
documentation_uri: https://rubydoc.info/gems/num4mechaequ/0.1.
|
48
|
+
documentation_uri: https://rubydoc.info/gems/num4mechaequ/0.1.2
|
49
49
|
homepage_uri: http://github.com/siranovel/num4mechaequation
|
50
50
|
wiki_uri: https://github.com/siranovel/mydocs/tree/main/num4phyequation/num4mechaequation
|
51
51
|
post_install_message:
|