physics_plus 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/lib/physics_plus/main/constants.rb +90 -8
- data/lib/physics_plus/version.rb +3 -1
- data/lib/physics_plus.rb +3 -0
- 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: 82dadf52a9ab3f1247263fee36ec44d96a1db1c32834de56a08885340911a4ea
|
4
|
+
data.tar.gz: bf135e851c6fd21f66c9a410fcca934ecdb086c12d386c95694b3c834a553375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6780927452c1b49e8435c36717ec88cd9997778a40972d2e20de7939f07e695278dcca117edf2ac43d0c6314bcc866b898f12a2aa117c5812fc696862160d6e4
|
7
|
+
data.tar.gz: 4c2a8b81af41ef99a20de6f95e4a1ae1de94736b7c55b3c262de602fb0f8441d46adbc3e30945ad1ba36e51d5133573b8a290c1b24bd2fc8ebbda7f777cacd82
|
data/README.md
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
# gem 'physics_plus'
|
2
|
+
## Evolving set for solving problems in physics
|
3
|
+
|
4
|
+
I will try every week to add new gem functionality.
|
5
|
+
|
6
|
+
### features already implemented
|
7
|
+
- Fundamental Constants
|
8
|
+
|
9
|
+
### plans to implement functions
|
10
|
+
- Mechanics
|
11
|
+
- Thermodynamics
|
12
|
+
- Optics
|
13
|
+
- Electrodynamics
|
14
|
+
|
15
|
+
### Installation
|
16
|
+
GEMFILE:
|
17
|
+
```
|
18
|
+
gem 'physics_plus', '~> 0.0.1'
|
19
|
+
```
|
20
|
+
|
21
|
+
INSTALL:
|
22
|
+
```
|
23
|
+
gem install physics_plus
|
24
|
+
```
|
25
|
+
|
26
|
+
EXAMPLE (Fundamental Constants):
|
27
|
+
```
|
28
|
+
require 'physics_plus' => true
|
29
|
+
|
30
|
+
puts PhysicsPlus.list_fundamental_constants
|
31
|
+
puts PhysicsPlus.list_planck_quantities
|
32
|
+
|
33
|
+
PhysicsPlus.C => 299792458
|
34
|
+
PhysicsPlus.Na => 6.02214076e+23
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
### License
|
39
|
+
|
40
|
+
MIT
|
41
|
+
|
42
|
+
**Free Software, Hell Yeah!**
|
@@ -1,47 +1,129 @@
|
|
1
|
+
# This module contains physical constants
|
1
2
|
module Main
|
3
|
+
# This module contains physical constants
|
2
4
|
module Constants
|
3
5
|
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
# @return [String] List fundamental constants
|
7
|
+
def list_fundamental_constants
|
8
|
+
constants = <<~CONSTANTS
|
9
|
+
C => 299792458 (speed of light)
|
10
|
+
G => 6.674484e-11 (gravitational constant)
|
11
|
+
h => 6.62607015e-34 (constant Plank)
|
12
|
+
h_line => 1.0545717999999998e-34 (Dirac constant)
|
13
|
+
e => 1.6021766340000001e-19 (elementary charge)
|
14
|
+
k => 1.380649e-23 (Boltzmann's constant)
|
15
|
+
CONSTANTS
|
16
|
+
end
|
8
17
|
|
9
|
-
#
|
18
|
+
# @return [Integer]
|
10
19
|
def C
|
11
20
|
299792458
|
12
21
|
end
|
13
22
|
|
23
|
+
# @return [Float]
|
14
24
|
def G
|
15
25
|
6.674484 * ( 10 ** (11 * -1.0 ) )
|
16
26
|
end
|
17
27
|
|
28
|
+
# @return [Float]
|
18
29
|
def h
|
19
30
|
6.62607015 * ( 10 ** (34 * -1.0 ) )
|
20
31
|
end
|
21
32
|
|
33
|
+
# @return [Float]
|
34
|
+
def h_line
|
35
|
+
1.0545718 * ( 10 ** (34 * -1.0 ) )
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Float]
|
22
39
|
def e
|
23
40
|
1.602176634 * ( 10 ** (19 * -1.0 ) )
|
24
41
|
end
|
25
42
|
|
43
|
+
# @return [Float]
|
26
44
|
def k
|
27
45
|
1.380649 * ( 10 ** (23 * -1.0 ) )
|
28
46
|
end
|
29
47
|
|
30
|
-
|
48
|
+
|
49
|
+
# @return [String] List of planck quantities
|
50
|
+
def list_planck_quantities
|
51
|
+
constants = <<~CONSTANTS
|
52
|
+
m_p => 2.176434e-08 (Planck mass)
|
53
|
+
l_p => 1.616255e-35 (Planck length)
|
54
|
+
t_p => 5.391246999999999e-44 (Planck time)
|
55
|
+
T_p => 1.4167840000000002e+32 (Planck temperature)
|
56
|
+
CONSTANTS
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [Float]
|
60
|
+
def m_p
|
61
|
+
2.176434 * ( 10 ** (8 * -1.0 ) )
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Float]
|
65
|
+
def l_p
|
66
|
+
1.616255 * ( 10 ** (35 * -1.0 ) )
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [Float]
|
70
|
+
def t_p
|
71
|
+
5.391247 * ( 10 ** (44 * -1.0 ) )
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [Integer]
|
75
|
+
def T_p
|
76
|
+
1.416784 * ( 10 ** (32 * 1.0 ) )
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
# @return [String] List Constants linking different systems of units and conversion factors
|
81
|
+
def list_planck_quantities
|
82
|
+
constants = <<~CONSTANTS
|
83
|
+
alpha => 0.0072973525693 (fine structure constant)
|
84
|
+
epsilon_0 => 8.854187812799999e-12 (electrical constant)
|
85
|
+
a_e_m => 4.1868 (atomic mass unit)
|
86
|
+
Na => 6.02214076e+23 (Avogadro's constant)
|
87
|
+
eV => 1.6021766340000001e-19 (electron volt)
|
88
|
+
calorie => 4.1868 (calorie)
|
89
|
+
liter_atmosphere => 101325 (liter * atmosphere)
|
90
|
+
CONSTANTS
|
91
|
+
end
|
92
|
+
|
93
|
+
# @return [Float]
|
94
|
+
def alpha
|
95
|
+
7.2973525693 * ( 10 ** (3 * -1.0 ) )
|
96
|
+
end
|
97
|
+
|
98
|
+
# @return [Float]
|
99
|
+
def epsilon_0
|
100
|
+
8.8541878128 * ( 10 ** (12 * -1.0 ) )
|
101
|
+
end
|
102
|
+
|
103
|
+
# @return [Float]
|
31
104
|
def a_e_m
|
32
105
|
1.66053906660 * ( 10 ** (27 * -1.0 ) )
|
33
106
|
end
|
34
107
|
|
108
|
+
# @return [Integer]
|
35
109
|
def Na
|
36
110
|
6.02214076 * ( 10 ** (23 * 1.0 ) )
|
37
111
|
end
|
38
|
-
|
112
|
+
|
113
|
+
# @return [Float]
|
39
114
|
def eV
|
40
115
|
1.602176634 * ( 10 ** (19 * -1.0 ) )
|
41
116
|
end
|
42
117
|
|
43
|
-
|
118
|
+
# @return [Float]
|
119
|
+
def calorie
|
44
120
|
4.1868
|
45
121
|
end
|
122
|
+
|
123
|
+
# @return [Integer]
|
124
|
+
def liter_atmosphere
|
125
|
+
101325
|
126
|
+
end
|
127
|
+
|
46
128
|
end
|
47
129
|
end
|
data/lib/physics_plus/version.rb
CHANGED
data/lib/physics_plus.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: physics_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AlexVikPast
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|