num4mechaequ 0.0.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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE +21 -0
  5. data/lib/num4mechaequ.rb +42 -0
  6. metadata +69 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6a18f5e7ca589b774ab80c59c19c94c24e4901277064c2bbd1de066c2a5eae6c
4
+ data.tar.gz: 11ecea5860ece5096d7537a9602f2f1c398e6854e4e38db128b101cb708c56eb
5
+ SHA512:
6
+ metadata.gz: 0260dc768dc3130a2ffc1173ba2fa4bc87a0c95e4cd386273e328d158e8a79606ab8bdb174b6e967194a944f0b861fa51d87c990a58a02c836d09e4219157ddc
7
+ data.tar.gz: cced4fc0b159eaf0ab3e6acff661ff9d243dedb129508fe4402883466f33b6dc9b3e3feb09e270e735b594708cb5274cb63ac943ab6e47b901eb016dbaf3e088
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Change Log
2
+
3
+ ## Unreleased
4
+
5
+ ## [0.0.1] - 2022-05-11
6
+
7
+ ### Fixed
8
+ - fix first fixed.
9
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 siranovel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,42 @@
1
+ require 'num4simdiff'
2
+
3
+ #
4
+ # 数値計算による力学方程式の解法するライブラリ
5
+ #
6
+ module Num4MechaEquLib
7
+ @g = 9.8 # 重力定数
8
+ @t = 0.001 # 時間刻み
9
+ @k = 0.0 # バネ定数
10
+ @m = 0.0 # 重りの重さ
11
+ @springFunc = Proc.new do | n, yi |
12
+ f = []
13
+ f[0] = yi[1]
14
+ f[1] = - (@k / @m) * yi[0] - @g
15
+ next f
16
+ end
17
+ class << self
18
+ #
19
+ # バネの固有振動
20
+ # @overload springFreqEqu(k, m, h0, v0)
21
+ # @param [double] k バネ定数
22
+ # @param [double] m 重りの重さ
23
+ # @param [double] h0 初期位置値
24
+ # @param [double] v0 初期速度
25
+ # @return [hash[]] 0秒から1秒までの位置(h)と速度(v)の値
26
+ #
27
+ def springFreqEqu(k, m, h0, v0)
28
+ @k = k
29
+ @m = m
30
+ hvt = []
31
+ yi_1 = []
32
+ yi = [h0, v0]
33
+ 0.step(1, @t) { |x|
34
+ yi_1 = Num4SimDiffLib.rungeKuttaMethod(yi, @t, @springFunc)
35
+ hvt.push({"t" => x, "h" => yi_1[0], "v" => yi_1[1]})
36
+ yi = yi_1
37
+ }
38
+ return hvt
39
+ end
40
+ end
41
+ end
42
+
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: num4mechaequ
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - siranovel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: num4simdiff
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.2.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.1
33
+ description: numerical solution for mechanics equation.
34
+ email: siranovel@gmail.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - CHANGELOG.md
40
+ - Gemfile
41
+ - LICENSE
42
+ - lib/num4mechaequ.rb
43
+ homepage: http://github.com/siranovel/num4mechaequation
44
+ licenses:
45
+ - MIT
46
+ metadata:
47
+ changelog_uri: http://github.com/siranovel/num4mechaequation/blob/main/CHANGELOG.md
48
+ documentation_uri: https://rubydoc.info/gems/num4mechaequ/0.0.1
49
+ homepage_uri: http://github.com/siranovel/num4mechaequation
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubygems_version: 3.3.7
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: num for mechanics equation!
69
+ test_files: []