physics_plus 0.0.3 → 0.0.5
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/README.md +22 -7
 - data/lib/physics_plus/constants.rb +113 -0
 - data/lib/physics_plus/optics.rb +49 -0
 - data/lib/physics_plus/version.rb +1 -1
 - data/lib/physics_plus.rb +4 -4
 - metadata +5 -4
 - data/lib/physics_plus/main/constants.rb +0 -129
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6bc4da6fd12bc78fa6ae8a0caff854bd453d174fd6e303a7c1261744c7f79b0f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0ed44719ca8736e15d710730ff4911507aacd914d3f86526f1009295e16f6221
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a21a567967c8e42c6c736e015fefc758efe9fdee602aa952f839c7b31d7c592d0c0d3b4bbc5fd5428d96084e0a57de02764134293d9d94418aeb0ef7ea7e5277
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d39463800150f7a712f215bd975318a52fa1ce9643b349fd8f37e7079d3feef819e0bf218c0ce2a7b8ae18a49512fb15090d430508038b0f240bc29439cc0940
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -3,14 +3,13 @@ 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            I will try every week to add new gem functionality.
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            ### features already implemented
         
     | 
| 
       7 
     | 
    
         
            -
            - Fundamental Constants
         
     | 
| 
       8 
6 
     | 
    
         | 
| 
       9 
7 
     | 
    
         
             
            ### plans to implement functions
         
     | 
| 
       10 
8 
     | 
    
         
             
            - Mechanics
         
     | 
| 
       11 
9 
     | 
    
         
             
            - Thermodynamics
         
     | 
| 
       12 
10 
     | 
    
         
             
            - Optics
         
     | 
| 
       13 
11 
     | 
    
         
             
            - Electrodynamics
         
     | 
| 
      
 12 
     | 
    
         
            +
            - and others
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
       15 
14 
     | 
    
         
             
            ### Installation
         
     | 
| 
       16 
15 
     | 
    
         
             
            GEMFILE:
         
     | 
| 
         @@ -23,15 +22,31 @@ INSTALL: 
     | 
|
| 
       23 
22 
     | 
    
         
             
            gem install physics_plus
         
     | 
| 
       24 
23 
     | 
    
         
             
            ```
         
     | 
| 
       25 
24 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            EXAMPLE ( 
     | 
| 
      
 25 
     | 
    
         
            +
            EXAMPLE (List fundamental constants):
         
     | 
| 
       27 
26 
     | 
    
         
             
            ```
         
     | 
| 
       28 
27 
     | 
    
         
             
            require 'physics_plus' => true
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
            puts PhysicsPlus. 
     | 
| 
       31 
     | 
    
         
            -
            puts PhysicsPlus.list_planck_quantities
         
     | 
| 
      
 29 
     | 
    
         
            +
            puts PhysicsPlus::Constants.List_fundamental_constants
         
     | 
| 
       32 
30 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
            Speed_light_vacuum => 299792458                           (Speed of light)
         
     | 
| 
      
 32 
     | 
    
         
            +
            Gravitational_constant => 6.674484e-11                    (Gravitational constant)
         
     | 
| 
      
 33 
     | 
    
         
            +
            Planck_constant => 6.62607015e-34                         (Constant Plank)
         
     | 
| 
      
 34 
     | 
    
         
            +
            Reduced_Planck_constant => 1.0545717999999998e-34         (Dirac constant)
         
     | 
| 
      
 35 
     | 
    
         
            +
            Elementary_charge => 1.6021766340000001e-19               (Elementary charge)
         
     | 
| 
      
 36 
     | 
    
         
            +
            Boltzmanns_constant => 1.380649e-23                       (Boltzmann's constant)
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            to others
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            puts PhysicsPlus::Constants.List_planck_quantities
         
     | 
| 
      
 41 
     | 
    
         
            +
            puts PhysicsPlus::Constants.List_different_systems_quantities
         
     | 
| 
      
 42 
     | 
    
         
            +
            puts PhysicsPlus::Constants.List_electromagnetic_constants
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            PhysicsPlus::Constants::C => 299792458
         
     | 
| 
      
 46 
     | 
    
         
            +
            PhysicsPlus::Constants::Speed_light_vacuum => 299792458
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            PhysicsPlus::Constants::G => 6.02214076e+23
         
     | 
| 
      
 49 
     | 
    
         
            +
            PhysicsPlus::Constants::Gravitational_constant => 6.02214076e+23
         
     | 
| 
       35 
50 
     | 
    
         
             
            ```
         
     | 
| 
       36 
51 
     | 
    
         | 
| 
       37 
52 
     | 
    
         | 
| 
         @@ -0,0 +1,113 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This module contains physical constants
         
     | 
| 
      
 2 
     | 
    
         
            +
            module PhysicsPlus
         
     | 
| 
      
 3 
     | 
    
         
            +
              # This module contains physical constants
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Constants
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                # @return [String] List fundamental constants
         
     | 
| 
      
 7 
     | 
    
         
            +
                def self.List_fundamental_constants
         
     | 
| 
      
 8 
     | 
    
         
            +
                  constants = <<~CONSTANTS  
         
     | 
| 
      
 9 
     | 
    
         
            +
                    Speed_light_vacuum => 299792458                           (Speed of light)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    Gravitational_constant => 6.674484e-11                    (Gravitational constant)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    Planck_constant => 6.62607015e-34                         (Constant Plank)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    Reduced_Planck_constant => 1.0545717999999998e-34         (Dirac constant)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    Elementary_charge => 1.6021766340000001e-19               (Elementary charge)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    Boltzmanns_constant => 1.380649e-23                       (Boltzmann's constant)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  CONSTANTS
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                # @return [Integer]
         
     | 
| 
      
 19 
     | 
    
         
            +
                Speed_light_vacuum = C = 299792458.freeze
         
     | 
| 
      
 20 
     | 
    
         
            +
                
         
     | 
| 
      
 21 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 22 
     | 
    
         
            +
                Gravitational_constant = G = (6.674484 * ( 10 ** (11 * -1.0 ) )).freeze
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 25 
     | 
    
         
            +
                Planck_constant = (6.62607015 * ( 10 ** (34 * -1.0 ) )).freeze
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 28 
     | 
    
         
            +
                Reduced_Planck_constant = (1.0545718 * ( 10 ** (34 * -1.0 ) )).freeze
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 31 
     | 
    
         
            +
                Elementary_charge = (1.602176634 * ( 10 ** (19 * -1.0 ) )).freeze
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 34 
     | 
    
         
            +
                Boltzmanns_constant = (1.380649 * ( 10 ** (23 * -1.0 ) )).freeze
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                # @return [String] List of planck quantities
         
     | 
| 
      
 38 
     | 
    
         
            +
                def self.List_planck_quantities
         
     | 
| 
      
 39 
     | 
    
         
            +
                  constants = <<~CONSTANTS
         
     | 
| 
      
 40 
     | 
    
         
            +
                    Planck_mass => 2.176434e-08                               (Planck mass)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    Planck_length => 1.616255e-35                             (Planck length)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    Planck_time => 5.391246999999999e-44                      (Planck time)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    Planck_temperature => 1.4167840000000002e+32              (Planck temperature)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  CONSTANTS
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 48 
     | 
    
         
            +
                Planck_mass = (2.176434 * ( 10 ** (8 * -1.0 ) )).freeze
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 51 
     | 
    
         
            +
                Planck_length = (1.616255 * ( 10 ** (35 * -1.0 ) )).freeze
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 54 
     | 
    
         
            +
                Planck_time = (5.391247 * ( 10 ** (44 * -1.0 ) )).freeze
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 57 
     | 
    
         
            +
                Planck_temperature = (1.416784 * ( 10 ** (32 * 1.0 ) )).freeze
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                # @return [String] List Constants linking different systems of units and conversion factors
         
     | 
| 
      
 60 
     | 
    
         
            +
                def self.List_different_systems_quantities
         
     | 
| 
      
 61 
     | 
    
         
            +
                  constants = <<~CONSTANTS
         
     | 
| 
      
 62 
     | 
    
         
            +
                    Fine_structure_constant => 0.0072973525693                (Fine structure constant)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    Electrical_constant => 8.854187812799999e-12              (Electrical constant)
         
     | 
| 
      
 64 
     | 
    
         
            +
                    Atomic_mass_unit => 4.1868                                (Atomic mass unit)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    Avogadros_constant => 6.02214076e+23                      (Avogadro's constant)
         
     | 
| 
      
 66 
     | 
    
         
            +
                    Electron_volt => 1.6021766340000001e-19                   (Electron volt)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    Calorie => 4.1868                                         (Calorie)
         
     | 
| 
      
 68 
     | 
    
         
            +
                    Liter_atmosphere => 101325                                (Liter * atmosphere)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  CONSTANTS
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 73 
     | 
    
         
            +
                Fine_structure_constant = (7.2973525693 * ( 10 ** (3 * -1.0 ) )).freeze
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 76 
     | 
    
         
            +
                Electrical_constant = (8.8541878128 * ( 10 ** (12 * -1.0 ) )).freeze
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 79 
     | 
    
         
            +
                Atomic_mass_unit = (1.66053906660 * ( 10 ** (27 * -1.0 ) )).freeze
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 82 
     | 
    
         
            +
                Avogadros_constant = (6.02214076 * ( 10 ** (23 * 1.0 ) )).freeze
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 85 
     | 
    
         
            +
                Electron_volt = (1.602176634 * ( 10 ** (19 * -1.0 ) )).freeze
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 88 
     | 
    
         
            +
                Calorie = 4.1868.freeze
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                # @return [Integer]
         
     | 
| 
      
 91 
     | 
    
         
            +
                Liter_atmosphere = (101325).freeze
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                # @return [String] List electromagnetic constants
         
     | 
| 
      
 94 
     | 
    
         
            +
                def self.List_electromagnetic_constants
         
     | 
| 
      
 95 
     | 
    
         
            +
                  constants = <<~CONSTANTS
         
     | 
| 
      
 96 
     | 
    
         
            +
                    Magnetic_constant => 1.25663706212e-06                    (Magnetic constant)
         
     | 
| 
      
 97 
     | 
    
         
            +
                    Vacuum_impedance => 376.73                                (Vacuum impedance)
         
     | 
| 
      
 98 
     | 
    
         
            +
                    Electrical_constant => 8.854187812799999e-12              (Electrical constant)
         
     | 
| 
      
 99 
     | 
    
         
            +
                    Coulombs_constant => 8987550000.0                         (Coulombs constant)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  CONSTANTS
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 104 
     | 
    
         
            +
                Magnetic_constant = (1.25663706212 * ( 10 ** (6 * -1.0 ) )).freeze
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 107 
     | 
    
         
            +
                Vacuum_impedance = 376.73
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                # @return [Float]
         
     | 
| 
      
 110 
     | 
    
         
            +
                Coulombs_constant = (8.98755 * ( 10 ** (9 * 1.0 ) )).freeze
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,49 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # This module contains physical constants
         
     | 
| 
      
 2 
     | 
    
         
            +
            module PhysicsPlus
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module contains the solution of problems in optics
         
     | 
| 
      
 4 
     | 
    
         
            +
                class Optics
         
     | 
| 
      
 5 
     | 
    
         
            +
                  def self.absolute_refractive_index(speed)
         
     | 
| 
      
 6 
     | 
    
         
            +
                    raise 'speed must not exceed the speed of light' if Constants::C < speed
         
     | 
| 
      
 7 
     | 
    
         
            +
                    raise 'speed must be positive' if speed.negative?
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    (Constants::C / speed.to_f)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  def self.power_lens(focal_length)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    raise 'optical distance must be positive' if focal_length.negative?
         
     | 
| 
      
 14 
     | 
    
         
            +
                    raise 'optical distance must not be zero' if focal_length.zero?
         
     | 
| 
      
 15 
     | 
    
         
            +
                    
         
     | 
| 
      
 16 
     | 
    
         
            +
                    1/focal_length.to_f
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  def self.thin_lens_formula(f, d)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    raise 'distance from object to lens must be positive' if d.negative?
         
     | 
| 
      
 22 
     | 
    
         
            +
                    raise 'distance from image to lens must be positive' if f.negative?
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    raise 'distance from object to lens must not be zero' if d.zero?
         
     | 
| 
      
 25 
     | 
    
         
            +
                    raise 'distance from image to lens must not be zero' if f.zero?
         
     | 
| 
      
 26 
     | 
    
         
            +
                    
         
     | 
| 
      
 27 
     | 
    
         
            +
                    (f + d)/(f.to_f * d)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def self.linear_magnification_lens(image_size, item_size)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    raise 'image size must be positive' if image_size.negative?
         
     | 
| 
      
 32 
     | 
    
         
            +
                    raise 'item size must be positive' if item_size.negative?
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                    raise 'image_size not be zero' if image_size.zero?
         
     | 
| 
      
 35 
     | 
    
         
            +
                    raise 'item_size not be zero' if item_size.zero?
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    image_size.to_f/item_size
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  def self.interference_minimum_condition(k, lambda)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    (2*k+1)*lambda.to_f/2
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  def self.interference_maximum_condition(k, lambda)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    k * lambda.to_f
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/physics_plus/version.rb
    CHANGED
    
    
    
        data/lib/physics_plus.rb
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require_relative 'physics_plus/ 
     | 
| 
      
 1 
     | 
    
         
            +
            require_relative 'physics_plus/constants'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'physics_plus/optics'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'physics_plus/version'
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            # This module is the main one for the gem
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            module PhysicsPlus
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
              extend Main::Constants
         
     | 
| 
       8 
     | 
    
         
            -
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
            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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - AlexVikPast
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-08-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rspec
         
     | 
| 
         @@ -24,7 +24,7 @@ dependencies: 
     | 
|
| 
       24 
24 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '3.6'
         
     | 
| 
       27 
     | 
    
         
            -
            description: physics_plus
         
     | 
| 
      
 27 
     | 
    
         
            +
            description: physics_plus - basic formulas in physics
         
     | 
| 
       28 
28 
     | 
    
         
             
            email: steplerpav@gmail.com
         
     | 
| 
       29 
29 
     | 
    
         
             
            executables: []
         
     | 
| 
       30 
30 
     | 
    
         
             
            extensions: []
         
     | 
| 
         @@ -34,7 +34,8 @@ files: 
     | 
|
| 
       34 
34 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       35 
35 
     | 
    
         
             
            - README.md
         
     | 
| 
       36 
36 
     | 
    
         
             
            - lib/physics_plus.rb
         
     | 
| 
       37 
     | 
    
         
            -
            - lib/physics_plus/ 
     | 
| 
      
 37 
     | 
    
         
            +
            - lib/physics_plus/constants.rb
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib/physics_plus/optics.rb
         
     | 
| 
       38 
39 
     | 
    
         
             
            - lib/physics_plus/version.rb
         
     | 
| 
       39 
40 
     | 
    
         
             
            homepage: https://github.com/AlexVikPast/physics_plus
         
     | 
| 
       40 
41 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -1,129 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # This module contains physical constants
         
     | 
| 
       2 
     | 
    
         
            -
            module Main
         
     | 
| 
       3 
     | 
    
         
            -
              # This module contains physical constants
         
     | 
| 
       4 
     | 
    
         
            -
              module Constants
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       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
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                # @return [Integer]
         
     | 
| 
       19 
     | 
    
         
            -
                def C
         
     | 
| 
       20 
     | 
    
         
            -
                  299792458
         
     | 
| 
       21 
     | 
    
         
            -
                end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       24 
     | 
    
         
            -
                def G
         
     | 
| 
       25 
     | 
    
         
            -
                  6.674484 * ( 10 ** (11 * -1.0 ) )
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       29 
     | 
    
         
            -
                def h
         
     | 
| 
       30 
     | 
    
         
            -
                  6.62607015 * ( 10 ** (34 * -1.0 ) )
         
     | 
| 
       31 
     | 
    
         
            -
                end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       34 
     | 
    
         
            -
                def h_line
         
     | 
| 
       35 
     | 
    
         
            -
                  1.0545718 * ( 10 ** (34 * -1.0 ) )
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       39 
     | 
    
         
            -
                def e
         
     | 
| 
       40 
     | 
    
         
            -
                  1.602176634 * ( 10 ** (19 * -1.0 ) )
         
     | 
| 
       41 
     | 
    
         
            -
                end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       44 
     | 
    
         
            -
                def k
         
     | 
| 
       45 
     | 
    
         
            -
                  1.380649 * ( 10 ** (23 * -1.0 ) )
         
     | 
| 
       46 
     | 
    
         
            -
                end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       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]
         
     | 
| 
       104 
     | 
    
         
            -
                def a_e_m
         
     | 
| 
       105 
     | 
    
         
            -
                  1.66053906660 * ( 10 ** (27 * -1.0 ) )
         
     | 
| 
       106 
     | 
    
         
            -
                end
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                # @return [Integer]
         
     | 
| 
       109 
     | 
    
         
            -
                def Na
         
     | 
| 
       110 
     | 
    
         
            -
                  6.02214076 * ( 10 ** (23 * 1.0 ) )
         
     | 
| 
       111 
     | 
    
         
            -
                end
         
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       114 
     | 
    
         
            -
                def eV
         
     | 
| 
       115 
     | 
    
         
            -
                  1.602176634 * ( 10 ** (19 * -1.0 ) )
         
     | 
| 
       116 
     | 
    
         
            -
                end
         
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
                # @return [Float]
         
     | 
| 
       119 
     | 
    
         
            -
                def calorie 
         
     | 
| 
       120 
     | 
    
         
            -
                  4.1868
         
     | 
| 
       121 
     | 
    
         
            -
                end
         
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
                # @return [Integer]
         
     | 
| 
       124 
     | 
    
         
            -
                def liter_atmosphere
         
     | 
| 
       125 
     | 
    
         
            -
                  101325
         
     | 
| 
       126 
     | 
    
         
            -
                end
         
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
              end
         
     | 
| 
       129 
     | 
    
         
            -
            end
         
     |