physics_plus 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bc4da6fd12bc78fa6ae8a0caff854bd453d174fd6e303a7c1261744c7f79b0f
4
- data.tar.gz: 0ed44719ca8736e15d710730ff4911507aacd914d3f86526f1009295e16f6221
3
+ metadata.gz: 6329fe0a88532e91bafbf7e96649dc08177209c28bb76734fcda6450c6828995
4
+ data.tar.gz: 4fe3a269c76cf789e45289b27582c6ce04790eebc1327ed55f0438087280fc5b
5
5
  SHA512:
6
- metadata.gz: a21a567967c8e42c6c736e015fefc758efe9fdee602aa952f839c7b31d7c592d0c0d3b4bbc5fd5428d96084e0a57de02764134293d9d94418aeb0ef7ea7e5277
7
- data.tar.gz: d39463800150f7a712f215bd975318a52fa1ce9643b349fd8f37e7079d3feef819e0bf218c0ce2a7b8ae18a49512fb15090d430508038b0f240bc29439cc0940
6
+ metadata.gz: dc7f39606c5cedbb88b6f895aa45dc37dd18cfbaceba6f1bd68777adada393d3bc584f7fd0548370307631379561b190a1de6c9ebac7ba2e9c2216a299fd73cf
7
+ data.tar.gz: 6a6d4d89e427bd49d378bb2c88708875f56e5ee8b43c017c5f312fda731076df1dbd49009f10dcbd11cca7175eaf014019d112a58795500e18e8d383f355f909
data/README.md CHANGED
@@ -41,12 +41,19 @@ puts PhysicsPlus::Constants.List_planck_quantities
41
41
  puts PhysicsPlus::Constants.List_different_systems_quantities
42
42
  puts PhysicsPlus::Constants.List_electromagnetic_constants
43
43
 
44
-
45
44
  PhysicsPlus::Constants::C => 299792458
46
45
  PhysicsPlus::Constants::Speed_light_vacuum => 299792458
47
46
 
48
47
  PhysicsPlus::Constants::G => 6.02214076e+23
49
48
  PhysicsPlus::Constants::Gravitational_constant => 6.02214076e+23
49
+
50
+ PhysicsPlus::Optics.absolute_refractive_index(200_000_000) => 1.49896229
51
+ PhysicsPlus::Optics.power_lens(2) => 0.5
52
+
53
+ PhysicsPlus::ElementsTheoryRelativity.inertial_system_length(1.5, 200_000_000) => 1.1174144036800955
54
+ PhysicsPlus::ElementsTheoryRelativity.inertial_system_time(60, 200_000_000) => 80.54308205048527
55
+
56
+ PhysicsPlus::Quantums.equivalence_of_mass_and_energy(0.0000000001) => 8987551.787368177
50
57
  ```
51
58
 
52
59
 
@@ -55,3 +62,4 @@ PhysicsPlus::Constants::Gravitational_constant => 6.02214076e+23
55
62
  MIT
56
63
 
57
64
  **Free Software, Hell Yeah!**
65
+
@@ -16,22 +16,22 @@ module PhysicsPlus
16
16
  end
17
17
 
18
18
  # @return [Integer]
19
- Speed_light_vacuum = C = 299792458.freeze
19
+ Speed_light_vacuum = C = 299792458
20
20
 
21
21
  # @return [Float]
22
- Gravitational_constant = G = (6.674484 * ( 10 ** (11 * -1.0 ) )).freeze
22
+ Gravitational_constant = G = (6.674484 * ( 10 ** (11 * -1.0 ) ))
23
23
 
24
24
  # @return [Float]
25
- Planck_constant = (6.62607015 * ( 10 ** (34 * -1.0 ) )).freeze
25
+ Planck_constant = (6.62607015 * ( 10 ** (34 * -1.0 ) ))
26
26
 
27
27
  # @return [Float]
28
- Reduced_Planck_constant = (1.0545718 * ( 10 ** (34 * -1.0 ) )).freeze
28
+ Reduced_Planck_constant = (1.0545718 * ( 10 ** (34 * -1.0 ) ))
29
29
 
30
30
  # @return [Float]
31
- Elementary_charge = (1.602176634 * ( 10 ** (19 * -1.0 ) )).freeze
31
+ Elementary_charge = (1.602176634 * ( 10 ** (19 * -1.0 ) ))
32
32
 
33
33
  # @return [Float]
34
- Boltzmanns_constant = (1.380649 * ( 10 ** (23 * -1.0 ) )).freeze
34
+ Boltzmanns_constant = (1.380649 * ( 10 ** (23 * -1.0 ) ))
35
35
 
36
36
 
37
37
  # @return [String] List of planck quantities
@@ -45,16 +45,16 @@ module PhysicsPlus
45
45
  end
46
46
 
47
47
  # @return [Float]
48
- Planck_mass = (2.176434 * ( 10 ** (8 * -1.0 ) )).freeze
48
+ Planck_mass = (2.176434 * ( 10 ** (8 * -1.0 ) ))
49
49
 
50
50
  # @return [Float]
51
- Planck_length = (1.616255 * ( 10 ** (35 * -1.0 ) )).freeze
51
+ Planck_length = (1.616255 * ( 10 ** (35 * -1.0 ) ))
52
52
 
53
53
  # @return [Float]
54
- Planck_time = (5.391247 * ( 10 ** (44 * -1.0 ) )).freeze
54
+ Planck_time = (5.391247 * ( 10 ** (44 * -1.0 ) ))
55
55
 
56
56
  # @return [Float]
57
- Planck_temperature = (1.416784 * ( 10 ** (32 * 1.0 ) )).freeze
57
+ Planck_temperature = (1.416784 * ( 10 ** (32 * 1.0 ) ))
58
58
 
59
59
  # @return [String] List Constants linking different systems of units and conversion factors
60
60
  def self.List_different_systems_quantities
@@ -70,25 +70,25 @@ module PhysicsPlus
70
70
  end
71
71
 
72
72
  # @return [Float]
73
- Fine_structure_constant = (7.2973525693 * ( 10 ** (3 * -1.0 ) )).freeze
73
+ Fine_structure_constant = (7.2973525693 * ( 10 ** (3 * -1.0 ) ))
74
74
 
75
75
  # @return [Float]
76
- Electrical_constant = (8.8541878128 * ( 10 ** (12 * -1.0 ) )).freeze
76
+ Electrical_constant = (8.8541878128 * ( 10 ** (12 * -1.0 ) ))
77
77
 
78
78
  # @return [Float]
79
- Atomic_mass_unit = (1.66053906660 * ( 10 ** (27 * -1.0 ) )).freeze
79
+ Atomic_mass_unit = (1.66053906660 * ( 10 ** (27 * -1.0 ) ))
80
80
 
81
81
  # @return [Float]
82
- Avogadros_constant = (6.02214076 * ( 10 ** (23 * 1.0 ) )).freeze
82
+ Avogadros_constant = (6.02214076 * ( 10 ** (23 * 1.0 ) ))
83
83
 
84
84
  # @return [Float]
85
- Electron_volt = (1.602176634 * ( 10 ** (19 * -1.0 ) )).freeze
85
+ Electron_volt = (1.602176634 * ( 10 ** (19 * -1.0 ) ))
86
86
 
87
87
  # @return [Float]
88
- Calorie = 4.1868.freeze
88
+ Calorie = 4.1868
89
89
 
90
90
  # @return [Integer]
91
- Liter_atmosphere = (101325).freeze
91
+ Liter_atmosphere = (101325)
92
92
 
93
93
  # @return [String] List electromagnetic constants
94
94
  def self.List_electromagnetic_constants
@@ -101,13 +101,30 @@ module PhysicsPlus
101
101
  end
102
102
 
103
103
  # @return [Float]
104
- Magnetic_constant = (1.25663706212 * ( 10 ** (6 * -1.0 ) )).freeze
104
+ Magnetic_constant = (1.25663706212 * ( 10 ** (6 * -1.0 ) ))
105
105
 
106
106
  # @return [Float]
107
107
  Vacuum_impedance = 376.73
108
108
 
109
109
  # @return [Float]
110
- Coulombs_constant = (8.98755 * ( 10 ** (9 * 1.0 ) )).freeze
110
+ Coulombs_constant = (8.98755 * ( 10 ** (9 * 1.0 ) ))
111
111
 
112
+ # @return [String] Some other physical constants
113
+ def Some_other_physical_constants
114
+ constants = <<~CONSTANTS
115
+ Electron_mass => 9.1093837015e-31 (Electron mass)
116
+ Proton_mass => 1.67262192369e-27 (Proton mass)
117
+ Neutron_mass => 1.67492749804e-27 (Neutron_mass)
118
+ CONSTANTS
119
+ end
120
+
121
+ # @return [Float]
122
+ Electron_mass = (9.1093837015 * ( 10 ** (31 * -1.0 ) ))
123
+
124
+ # @return [Float]
125
+ Proton_mass = (1.67262192369 * ( 10 ** (27 * -1.0 ) ))
126
+
127
+ # @return [Float]
128
+ Neutron_mass = (1.67492749804 * ( 10 ** (27 * -1.0 ) ))
112
129
  end
113
130
  end
@@ -0,0 +1,26 @@
1
+ # This module elements theory relativity
2
+ module PhysicsPlus
3
+ # This class elements theory relativity formulas
4
+ class ElementsTheoryRelativity
5
+ def self.relativistic_velocity_addition(speed_1, speed_2)
6
+ (speed_1 + speed_2)/(1 + (speed_1 * speed_2.to_f)/Constants::C ** 2 )
7
+ end
8
+
9
+ def self.inertial_system_length(length_0, speed)
10
+ length_0 * Math.sqrt(1-(speed.to_f ** 2)/(Constants::C ** 2))
11
+ end
12
+
13
+ def self.inertial_system_time(time_0, speed)
14
+ time_0 / Math.sqrt(1 - (speed.to_f ** 2)/(Constants::C ** 2))
15
+ end
16
+
17
+ def self.inertial_system_weight(weight_0, speed)
18
+ weight_0 / Math.sqrt(1 - (speed.to_f ** 2)/(Constants::C ** 2))
19
+ end
20
+
21
+ def self.relationship_mass_energy(weight)
22
+ weight.to_f * (Constants::C ** 2)
23
+ end
24
+ end
25
+ end
26
+
@@ -1,6 +1,6 @@
1
- # This module contains physical constants
1
+ # This module optics
2
2
  module PhysicsPlus
3
- # This module contains the solution of problems in optics
3
+ # This class optics formulas
4
4
  class Optics
5
5
  def self.absolute_refractive_index(speed)
6
6
  raise 'speed must not exceed the speed of light' if Constants::C < speed
@@ -0,0 +1,38 @@
1
+ module PhysicsPlus
2
+ # This class quantums formulas
3
+ class Quantums
4
+ def self.photon_energy(frequency)
5
+ raise 'frequency must be greater than zero' if frequency <= 0
6
+
7
+ Constants::Planck_constant * frequency.to_f
8
+ end
9
+
10
+ def self.photon_momentum(frequency)
11
+ raise 'frequency must be greater than zero' if frequency <= 0
12
+
13
+ Constants::Planck_constant * frequency.to_f / Constants::C
14
+ end
15
+
16
+ def self.einstein_equation_photoelectric_effect(work_function, speed)
17
+ raise 'work function must be greater than zero' if work_function <= 0
18
+
19
+ work_function + (Constants::Electron_mass * speed ** 2)/2.to_f
20
+ end
21
+
22
+ def self.work_function(frequency_min)
23
+ Constants::Planck_constant * frequency_min.abs
24
+ end
25
+
26
+ def self.de_Broglie_wavelength(massa, speed)
27
+ Constants::Planck_constant/(massa.abs * speed.abs)
28
+ end
29
+
30
+ def self.law_of_radioactive_decay(n0, t, half_life)
31
+ n0.to_f * 2 ** (-1 * ( t / half_life.to_f) )
32
+ end
33
+
34
+ def self.equivalence_of_mass_and_energy(massa)
35
+ massa * (Constants::C ** 2)
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # This module VERSION gem
2
2
  module PhysicsPlus
3
3
  # @return VERSION
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.7'
5
5
  end
data/lib/physics_plus.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require_relative 'physics_plus/constants'
2
2
  require_relative 'physics_plus/optics'
3
3
  require_relative 'physics_plus/version'
4
+ require_relative 'physics_plus/elements_theory_relativity'
5
+ require_relative 'physics_plus/quantums'
4
6
 
5
7
  # This module is the main one for the gem
6
8
 
7
9
  module PhysicsPlus
8
- end
10
+ end
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.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlexVikPast
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -35,7 +35,9 @@ files:
35
35
  - README.md
36
36
  - lib/physics_plus.rb
37
37
  - lib/physics_plus/constants.rb
38
+ - lib/physics_plus/elements_theory_relativity.rb
38
39
  - lib/physics_plus/optics.rb
40
+ - lib/physics_plus/quantums.rb
39
41
  - lib/physics_plus/version.rb
40
42
  homepage: https://github.com/AlexVikPast/physics_plus
41
43
  licenses:
@@ -57,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
59
  - !ruby/object:Gem::Version
58
60
  version: '0'
59
61
  requirements: []
60
- rubygems_version: 3.4.17
62
+ rubygems_version: 3.5.1
61
63
  signing_key:
62
64
  specification_version: 4
63
65
  summary: physics_plus