3v324v23 commited on
Commit
a0589da
·
1 Parent(s): 25a5414
Files changed (35) hide show
  1. README.md +14 -13
  2. Wimp.py +176 -0
  3. Wimp1.py +279 -0
  4. Wimpc.py +200 -0
  5. Wimps.py +234 -0
  6. a.py +45 -0
  7. app.py +111 -265
  8. js.py +40 -0
  9. js1.py +49 -0
  10. js2.py +117 -0
  11. js3.py +79 -0
  12. pi.py +35 -0
  13. pi1.py +43 -0
  14. pi2.py +53 -0
  15. pi3.py +148 -0
  16. requirements.txt +9 -0
  17. sim.py +391 -0
  18. sim10.py +198 -0
  19. sim11.py +147 -0
  20. sim2.py +152 -0
  21. sim3.py +132 -0
  22. sim8.py +181 -0
  23. sim9.py +181 -0
  24. simA.py +146 -0
  25. simAI.py +0 -0
  26. simAZ.py +171 -0
  27. simB.py +132 -0
  28. simC.py +156 -0
  29. simD.py +163 -0
  30. simE.py +173 -0
  31. simZ.py +142 -0
  32. sting.py +48 -0
  33. str.py +48 -0
  34. test.py +125 -0
  35. wave_function_animation.gif +0 -0
README.md CHANGED
@@ -1,13 +1,14 @@
1
- ---
2
- title: Wimps
3
- emoji: 🔥
4
- colorFrom: red
5
- colorTo: indigo
6
- sdk: streamlit
7
- sdk_version: 1.40.0
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
+ ---
2
+ title: ToE
3
+ emoji: 🔥
4
+ colorFrom: gray
5
+ colorTo: gray
6
+ sdk: streamlit
7
+ sdk_version: 1.39.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ short_description: ToE
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Wimp.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ dark_matter_density_GeV = dark_matter_density / 1.60217662e-10
28
+
29
+ # Particle masses (in GeV)
30
+ particle_masses = {
31
+ "up": 2.3e-3,
32
+ "down": 4.8e-3,
33
+ "charm": 1.28,
34
+ "strange": 0.095,
35
+ "top": 173.0,
36
+ "bottom": 4.18,
37
+ "electron": 5.11e-4,
38
+ "muon": 1.05e-1,
39
+ "tau": 1.78,
40
+ "photon": 0,
41
+ "electron_neutrino": 0, # Neutrinos have very small masses
42
+ "muon_neutrino": 0,
43
+ "tau_neutrino": 0,
44
+ "W_boson": 80.379,
45
+ "Z_boson": 91.1876,
46
+ "Higgs_boson": 125.1,
47
+ "gluon": 0, # Massless
48
+ "proton": 0.938,
49
+ "neutron": 0.939,
50
+ "pion_plus": 0.140,
51
+ "pion_zero": 0.135,
52
+ "kaon_plus": 0.494,
53
+ "kaon_zero": 0.498,
54
+ "axion": np.sqrt(dark_matter_density) * 1e-5, # Estimated axion mass
55
+ "WIMP": 100 # Example WIMP mass
56
+ }
57
+
58
+ # Conversion factor from GeV to J
59
+ GeV_to_J = 1.60217662e-10
60
+
61
+ # Simulation setup
62
+ num_steps = int(t_simulation / t_planck)
63
+
64
+ # Tunneling probabilities to investigate
65
+ tunneling_probabilities = np.arange(0.1, 10.0, 0.1) # Exclude 1.0
66
+
67
+ # Create a directory to store the data
68
+ data_dir = "big_bang_simulation_data"
69
+ os.makedirs(data_dir, exist_ok=True)
70
+
71
+ # Functions to incorporate relativistic effects and collisions
72
+ def relativistic_energy(particle_speed, particle_mass):
73
+ epsilon = 1e-15 # A small value to avoid division by zero
74
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
75
+
76
+ def relativistic_momentum(particle_speed, particle_mass):
77
+ epsilon = 1e-15 # A small value to avoid division by zero
78
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
79
+
80
+ def update_speed(current_speed, current_temperature, particle_mass):
81
+ """Update the speed of a particle based on temperature and mass."""
82
+ return TSR * current_temperature # Update speed using TSR
83
+
84
+ def check_collision(particle_speeds, collision_distance, current_step):
85
+ for j in range(len(particle_speeds)):
86
+ for k in range(j+1, len(particle_speeds)):
87
+ if np.abs(particle_speeds[j][current_step] - particle_speeds[k][current_step]) < collision_distance:
88
+ return True, j, k
89
+ return False, -1, -1
90
+
91
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
92
+ """Handle a collision between two particles."""
93
+ p1 = relativistic_momentum(particle_speeds[idx1][current_step], particle_masses[idx1])
94
+ p2 = relativistic_momentum(particle_speeds[idx2][current_step], particle_masses[idx2])
95
+
96
+ # Calculate velocities after collision using conservation of momentum
97
+ total_momentum = p1 + p2
98
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
99
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
100
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
101
+
102
+ particle_speeds[idx1][current_step] = v1_new
103
+ particle_speeds[idx2][current_step] = v2_new
104
+
105
+ # Calculate the exact mass of the WIMP
106
+ def calculate_wimp_mass(dark_matter_density_GeV, redshift):
107
+ return np.sqrt(2 * dark_matter_density_GeV * (1 + redshift)**3)
108
+
109
+ # Calculate the exact mass of the axion
110
+ def calculate_axion_mass(dark_matter_density_GeV):
111
+ return np.sqrt(dark_matter_density_GeV) * 1e-5
112
+
113
+ # Calculate the redshift
114
+ def calculate_redshift(particle_speed):
115
+ return (1 + particle_speed / c)
116
+
117
+ # Calculate the temperature of the universe
118
+ def calculate_temperature(T_0, redshift):
119
+ return T_0 * (1 + redshift)**(-1)
120
+
121
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
122
+ for tunneling_probability in tunneling_probabilities:
123
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
124
+
125
+ # Initialize arrays for simulation
126
+ num_particles = len(particle_masses)
127
+ particle_speeds = [[particle_speed_initial] * num_steps for _ in range(num_particles)]
128
+ particle_temperatures = [[temperature_initial] * num_steps for _ in range(num_particles)]
129
+ particle_masses_evolution = [[mass * GeV_to_J] * num_steps for mass in particle_masses.values()]
130
+ tunneling_steps = [[False] * num_steps for _ in range(num_particles)]
131
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
132
+
133
+ for current_step in range(1, num_steps):
134
+ for j in range(num_particles):
135
+ # Update temperature based on expansion of the universe
136
+ particle_temperatures[j][current_step] = particle_temperatures[j][current_step-1] * (1 - Hubble_constant_SI * t_planck)
137
+
138
+ # Update speed using TSR
139
+ particle_speeds[j][current_step] = update_speed(particle_speeds[j][current_step-1], particle_temperatures[j][current_step], particle_masses_array[j])
140
+
141
+ # Apply tunneling effect
142
+ if np.random.rand() < tunneling_probability:
143
+ particle_speeds[j][current_step] = particle_speeds[j][0]
144
+ tunneling_steps[j][current_step] = True
145
+
146
+ # Check for collisions
147
+ collision_detected, idx1, idx2 = check_collision(particle_speeds, collision_distance, current_step)
148
+ if collision_detected:
149
+ handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
150
+
151
+ # Calculate entropy using von Neumann entropy
152
+ for j in range(num_particles):
153
+ if particle_masses_array[j] == 0:
154
+ entropy = 0
155
+ else:
156
+ entropy = -particle_masses_array[j] * np.log1p(particle_masses_array[j])
157
+
158
+ # Update mass based on entropy
159
+ particle_masses_evolution[j][current_step] = particle_masses_evolution[j][current_step-1] + entropy / c**2
160
+
161
+ # Print calculated masses at the end of the simulation
162
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
163
+ for j, particle in enumerate(particle_masses.keys()):
164
+ print(f"{particle}: {particle_masses_evolution[j][-1] / GeV_to_J:.4e} GeV")
165
+
166
+ # Calculate the exact mass of the WIMP
167
+ wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
168
+
169
+ # Calculate the exact mass of the axion
170
+ axion_mass = calculate_axion_mass(dark_matter_density_GeV)
171
+
172
+ # Print the exact masses of the WIMP and axion
173
+ print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
174
+ print(f"Exact mass of the axion: {axion_mass / GeV_to_J:.4e} GeV")
175
+
176
+
Wimp1.py ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Convert dark matter density to GeV/m³
19
+ dark_matter_density_GeV = dark_matter_density / 1.60217662e-10
20
+
21
+ # Initial conditions
22
+ temperature_initial = 1.0 # Planck temperature in K
23
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
24
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
25
+
26
+ # Simulation time
27
+ t_planck = 5.39e-44 # Planck time in s
28
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
29
+
30
+ # Updated particle masses (in GeV)
31
+ particle_masses = {
32
+ "up": 2.3e-3,
33
+ "down": 4.8e-3,
34
+ "charm": 1.28,
35
+ "strange": 0.095,
36
+ "top": 173.0,
37
+ "bottom": 4.18,
38
+ "electron": 5.11e-4,
39
+ "muon": 1.05e-1,
40
+ "tau": 1.78,
41
+ "photon": 0,
42
+ "electron_neutrino": 0, # Neutrinos have very small masses
43
+ "muon_neutrino": 0,
44
+ "tau_neutrino": 0,
45
+ "W_boson": 80.379,
46
+ "Z_boson": 91.1876,
47
+ "Higgs_boson": 125.1,
48
+ "gluon": 0, # Massless
49
+ "proton": 0.938,
50
+ "neutron": 0.939,
51
+ "pion_plus": 0.140,
52
+ "pion_zero": 0.135,
53
+ "kaon_plus": 0.494,
54
+ "kaon_zero": 0.498
55
+ }
56
+
57
+ # Conversion factor from GeV to J
58
+ GeV_to_J = 1.60217662e-10
59
+
60
+ # Simulation setup
61
+ num_steps = int(t_simulation / t_planck)
62
+
63
+ import numpy as np
64
+ def generate_combined_tunneling_probabilities(start, stop, step_odd, step_even):
65
+ """Generates a combined sequence of tunneling probabilities with alternating odd and even decimal places."""
66
+ odd_tp = np.arange(start, stop, step_odd)
67
+ even_tp = np.arange(start, stop, step_even)
68
+ combined_tp = np.concatenate((odd_tp, even_tp))
69
+ return combined_tp
70
+ # Example usage:
71
+ tunneling_probabilities = generate_combined_tunneling_probabilities(0.1, 1.5, 0.02, 0.01)
72
+ print(tunneling_probabilities)
73
+ # Create a directory to store the data
74
+ data_dir = "big_bang_simulation_data"
75
+ os.makedirs(data_dir, exist_ok=True)
76
+
77
+ # Functions to incorporate relativistic effects and collisions
78
+ def relativistic_energy(particle_speed, particle_mass):
79
+ epsilon = 1e-15 # A small value to avoid division by zero
80
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
81
+
82
+ def relativistic_momentum(particle_speed, particle_mass):
83
+ epsilon = 1e-15 # A small value to avoid division by zero
84
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
85
+
86
+ def update_speed(current_speed, current_temperature, particle_mass):
87
+ """Update the speed of a particle based on temperature and mass."""
88
+ return TSR * current_temperature # Update speed using TSR
89
+
90
+ def check_collision(particle_speeds, collision_distance):
91
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
92
+ for j in range(len(particle_speeds)):
93
+ for k in range(j+1, len(particle_speeds)):
94
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
95
+ return True, j, k
96
+ return False, -1, -1
97
+
98
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
99
+ """Handle a collision between two particles."""
100
+ if particle_masses[idx1] == 0 or particle_masses[idx2] == 0:
101
+ # Skip handling collisions involving massless particles
102
+ return
103
+
104
+ p1 = relativistic_momentum(particle_speeds[idx1, current_step], particle_masses[idx1])
105
+ p2 = relativistic_momentum(particle_speeds[idx2, current_step], particle_masses[idx2])
106
+
107
+ # Calculate velocities after collision using conservation of momentum
108
+ total_momentum = p1 + p2
109
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
110
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
111
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
112
+
113
+ particle_speeds[idx1, current_step], particle_speeds[idx2, current_step] = v1_new, v2_new
114
+
115
+
116
+ def calculate_redshift(particle_speed):
117
+ return (1 + particle_speed / c)
118
+ # Calculate the exact mass of the WIMP
119
+ def calculate_wimp_mass(dark_matter_density_GeV, redshift):
120
+ return np.sqrt(2 * dark_matter_density_GeV * (1 + redshift)**3)
121
+
122
+ # Calculate the exact mass of the axion
123
+ def calculate_axion_mass(dark_matter_density_GeV):
124
+ return np.sqrt(dark_matter_density_GeV) * 1e-5
125
+
126
+ # Calculate the exact mass of the graviton
127
+ def calculate_graviton_mass(dark_matter_density_GeV):
128
+ return 0 # Graviton is massless
129
+
130
+ # Calculate the exact mass of the muon g-2
131
+ def calculate_muon_g2_mass(dark_matter_density_GeV):
132
+ return 1.05e-1 # Muon mass
133
+
134
+ # Calculate the exact mass of the preon
135
+ def calculate_preon_mass(dark_matter_density_GeV):
136
+ return 1.0e-3 # Preon mass
137
+
138
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, Relativistic Effects, Redshift, and Entanglement
139
+ for tunneling_probability in tunneling_probabilities:
140
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
141
+
142
+ # Initialize arrays for simulation
143
+ num_particles = len(particle_masses)
144
+ particle_speeds = np.zeros((num_particles, num_steps)) # 2D array for speeds
145
+ particle_temperatures = np.zeros((num_particles, num_steps)) # 2D array for temperatures
146
+ particle_masses_evolution = np.zeros((num_particles, num_steps)) # 2D array for mass evolution
147
+ tunneling_steps = np.zeros((num_particles, num_steps), dtype=bool) # 2D array for tunneling steps
148
+ particle_momentum = np.zeros((num_particles, num_steps)) # 2D array for momentum
149
+ total_energy = np.zeros(num_steps) # 1D array for total energy of the system
150
+ redshifts = np.zeros((num_particles, num_steps)) # 2D array for redshift
151
+ entanglement_entropies = np.zeros((num_particles, num_steps)) # 2D array for entanglement entropy
152
+ particle_states = np.random.rand(num_particles, num_steps) # Placeholder for particle states
153
+
154
+ # Create an array of masses for each particle
155
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
156
+
157
+ for j, (particle, mass) in enumerate(particle_masses.items()):
158
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
159
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Initialize mass evolution
160
+
161
+ for current_step in range(1, num_steps):
162
+ for j in range(num_particles):
163
+ # Update temperature based on expansion of the universe
164
+ particle_temperatures[j, current_step] = particle_temperatures[j, current_step-1] * (1 - Hubble_constant_SI * t_planck)
165
+
166
+ # Update speed using TSR
167
+ particle_speeds[j, current_step] = update_speed(particle_speeds[j, current_step-1], particle_temperatures[j, current_step], particle_masses_array[j])
168
+
169
+ # Apply tunneling effect
170
+ if np.random.rand() < tunneling_probability:
171
+ particle_speeds[j, current_step] = particle_speeds[j, 0]
172
+ tunneling_steps[j, current_step] = True
173
+
174
+ # Calculate redshift
175
+ redshifts[j, current_step] = (1 + particle_speeds[j, current_step] / c)
176
+
177
+ # Calculate entanglement entropy
178
+ entanglement_entropies[j, current_step] = -np.sum(particle_states[j, current_step] * np.log(particle_states[j, current_step]))
179
+
180
+ # Update mass evolution
181
+ particle_masses_evolution[j, current_step] = particle_masses_evolution[j, current_step-1] * (1 - dark_energy_density * t_planck)
182
+
183
+ # Check for collisions
184
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, current_step], collision_distance)
185
+ if collision_detected:
186
+ handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
187
+
188
+ # Print calculated masses at the end of the simulation
189
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
190
+ for j, particle in enumerate(particle_masses.keys()):
191
+ print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
192
+
193
+ # Calculate the exact masses of the WIMP, axion, graviton, muon g-2, and preon
194
+ wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
195
+ axion_mass = calculate_axion_mass(dark_matter_density_GeV)
196
+ graviton_mass = calculate_graviton_mass(dark_matter_density_GeV)
197
+ muon_g2_mass = calculate_muon_g2_mass(dark_matter_density_GeV)
198
+ preon_mass = calculate_preon_mass(dark_matter_density_GeV)
199
+
200
+ # Print the exact masses of the WIMP and axion
201
+ print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
202
+ print(f"Exact mass of the axion: {axion_mass / GeV_to_J:.4e} GeV")
203
+ print(f"Exact mass of the graviton_mass: {graviton_mass/ GeV_to_J:.4e} GeV")
204
+ import numpy as np
205
+ import matplotlib.pyplot as plt
206
+
207
+ # Define the correlation matrix
208
+ correlation_matrix = np.array([
209
+ [1]
210
+ ])
211
+
212
+ # Print the correlation matrix
213
+ print("Correlation Matrix:")
214
+ print(correlation_matrix)
215
+
216
+ # Define the WIMP mass values
217
+ wimp_mass_odd = 9.3559e+01
218
+ wimp_mass_even = 3.3493e+48
219
+
220
+ # Print the WIMP mass values
221
+ print("\nWIMP Mass Values:")
222
+ print("Odd: ", wimp_mass_odd)
223
+ print("Even: ", wimp_mass_even)
224
+
225
+ # Check if the even value is physically meaningful
226
+ if wimp_mass_even < 1e+50:
227
+ print("\nThe even value is physically meaningful.")
228
+ else:
229
+ print("\nThe even value is not physically meaningful.")
230
+
231
+ # Create a Gaussian distribution for the WIMP mass
232
+ mean_mass = wimp_mass_odd
233
+ std_mass = 1e+01
234
+
235
+ # Create a Gaussian distribution for the WIMP mass
236
+ mass = np.random.normal(mean_mass, std_mass, 10000)
237
+
238
+ # Plot the probability density function (PDF)
239
+ plt.hist(mass, bins=50, density=True)
240
+ plt.xlabel('WIMP Mass (GeV)')
241
+ plt.ylabel('Probability Density')
242
+ plt.title('Gaussian Distribution for WIMP Mass')
243
+ plt.show()
244
+
245
+ # Calculate the correlation between the WIMP mass and itself
246
+ corr_mass_mass = 1
247
+
248
+ # Print the correlation between the WIMP mass and itself
249
+ print("\nCorrelation between WIMP Mass and itself: ", corr_mass_mass)
250
+
251
+ # Create a figure and axis object
252
+ fig, ax = plt.subplots()
253
+
254
+ # Plot the WIMP mass values
255
+ ax.scatter([wimp_mass_odd], [corr_mass_mass], c='r', label='Odd')
256
+ ax.scatter([wimp_mass_even], [corr_mass_mass], c='b', label='Even')
257
+
258
+ # Set the title and labels
259
+ ax.set_title('WIMP Mass Values')
260
+ ax.set_xlabel('WIMP Mass (GeV)')
261
+ ax.set_ylabel('Correlation')
262
+
263
+ # Show the legend
264
+ ax.legend()
265
+
266
+ # Show the plot
267
+ plt.show()
268
+
269
+ # Create a dictionary to store the trends
270
+ trends = {
271
+ 'Correlation Matrix': correlation_matrix,
272
+ 'WIMP Mass Values': [wimp_mass_odd, wimp_mass_even],
273
+ 'Correlation between WIMP Mass and itself': corr_mass_mass
274
+ }
275
+
276
+ # Print the trends
277
+ print("\nTrends:")
278
+ for key, value in trends.items():
279
+ print(key, ":", value)
Wimpc.py ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Convert dark matter density to GeV/m³
19
+ dark_matter_density_GeV = dark_matter_density / 1.60217662e-10
20
+
21
+ # Initial conditions
22
+ temperature_initial = 1.0 # Planck temperature in K
23
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
24
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
25
+
26
+ # Simulation time
27
+ t_planck = 5.39e-44 # Planck time in s
28
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
29
+
30
+ # Updated particle masses (in GeV)
31
+ particle_masses = {
32
+ "up": 2.3e-3,
33
+ "down": 4.8e-3,
34
+ "charm": 1.28,
35
+ "strange": 0.095,
36
+ "top": 173.0,
37
+ "bottom": 4.18,
38
+ "electron": 5.11e-4,
39
+ "muon": 1.05e-1,
40
+ "tau": 1.78,
41
+ "photon": 0,
42
+ "electron_neutrino": 0, # Neutrinos have very small masses
43
+ "muon_neutrino": 0,
44
+ "tau_neutrino": 0,
45
+ "W_boson": 80.379,
46
+ "Z_boson": 91.1876,
47
+ "Higgs_boson": 125.1,
48
+ "gluon": 0, # Massless
49
+ "proton": 0.938,
50
+ "neutron": 0.939,
51
+ "pion_plus": 0.140,
52
+ "pion_zero": 0.135,
53
+ "kaon_plus": 0.494,
54
+ "kaon_zero": 0.498
55
+ }
56
+
57
+ # Conversion factor from GeV to J
58
+ GeV_to_J = 1.60217662e-10
59
+
60
+ # Simulation setup
61
+ num_steps = int(t_simulation / t_planck)
62
+
63
+ # Tunneling probabilities to investigate
64
+ tunneling_probabilities = np.arange((0.1, 0.6, 0.15)) # Exclude 1.0
65
+
66
+ # Create a directory to store the data
67
+ data_dir = "big_bang_simulation_data"
68
+ os.makedirs(data_dir, exist_ok=True)
69
+
70
+ # Functions to incorporate relativistic effects and collisions
71
+ def relativistic_energy(particle_speed, particle_mass):
72
+ epsilon = 1e-15 # A small value to avoid division by zero
73
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
74
+
75
+ def relativistic_momentum(particle_speed, particle_mass):
76
+ epsilon = 1e-15 # A small value to avoid division by zero
77
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
78
+
79
+ def update_speed(current_speed, current_temperature, particle_mass):
80
+ """Update the speed of a particle based on temperature and mass."""
81
+ return TSR * current_temperature # Update speed using TSR
82
+
83
+ def check_collision(particle_speeds, collision_distance):
84
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
85
+ for j in range(len(particle_speeds)):
86
+ for k in range(j+1, len(particle_speeds)):
87
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
88
+ return True, j, k
89
+ return False, -1, -1
90
+
91
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
92
+ """Handle a collision between two particles."""
93
+ if particle_masses[idx1] == 0 or particle_masses[idx2] == 0:
94
+ # Skip handling collisions involving massless particles
95
+ return
96
+
97
+ p1 = relativistic_momentum(particle_speeds[idx1, current_step], particle_masses[idx1])
98
+ p2 = relativistic_momentum(particle_speeds[idx2, current_step], particle_masses[idx2])
99
+
100
+ # Calculate velocities after collision using conservation of momentum
101
+ total_momentum = p1 + p2
102
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
103
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
104
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
105
+
106
+ particle_speeds[idx1, current_step], particle_speeds[idx2, current_step] = v1_new, v2_new
107
+
108
+
109
+ def calculate_redshift(particle_speed):
110
+ return (1 + particle_speed / c)
111
+ # Calculate the exact mass of the WIMP
112
+ def calculate_wimp_mass(dark_matter_density_GeV, redshift):
113
+ return np.sqrt(2 * dark_matter_density_GeV * (1 + redshift)**3)
114
+
115
+ # Calculate the exact mass of the axion
116
+ def calculate_axion_mass(dark_matter_density_GeV):
117
+ return np.sqrt(dark_matter_density_GeV) * 1e-5
118
+
119
+ # Calculate the exact mass of the graviton
120
+ def calculate_graviton_mass(dark_matter_density_GeV):
121
+ return 0 # Graviton is massless
122
+
123
+ # Calculate the exact mass of the muon g-2
124
+ def calculate_muon_g2_mass(dark_matter_density_GeV):
125
+ return 1.05e-1 # Muon mass
126
+
127
+ # Calculate the exact mass of the preon
128
+ def calculate_preon_mass(dark_matter_density_GeV):
129
+ return 1.0e-3 # Preon mass
130
+
131
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, Relativistic Effects, Redshift, and Entanglement
132
+ for tunneling_probability in tunneling_probabilities:
133
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
134
+
135
+ # Initialize arrays for simulation
136
+ num_particles = len(particle_masses)
137
+ particle_speeds = np.zeros((num_particles, num_steps)) # 2D array for speeds
138
+ particle_temperatures = np.zeros((num_particles, num_steps)) # 2D array for temperatures
139
+ particle_masses_evolution = np.zeros((num_particles, num_steps)) # 2D array for mass evolution
140
+ tunneling_steps = np.zeros((num_particles, num_steps), dtype=bool) # 2D array for tunneling steps
141
+ particle_momentum = np.zeros((num_particles, num_steps)) # 2D array for momentum
142
+ total_energy = np.zeros(num_steps) # 1D array for total energy of the system
143
+ redshifts = np.zeros((num_particles, num_steps)) # 2D array for redshift
144
+ entanglement_entropies = np.zeros((num_particles, num_steps)) # 2D array for entanglement entropy
145
+ particle_states = np.random.rand(num_particles, num_steps) # Placeholder for particle states
146
+
147
+ # Create an array of masses for each particle
148
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
149
+
150
+ for j, (particle, mass) in enumerate(particle_masses.items()):
151
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
152
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Initialize mass evolution
153
+
154
+ for current_step in range(1, num_steps):
155
+ for j in range(num_particles):
156
+ # Update temperature based on expansion of the universe
157
+ particle_temperatures[j, current_step] = particle_temperatures[j, current_step-1] * (1 - Hubble_constant_SI * t_planck)
158
+
159
+ # Update speed using TSR
160
+ particle_speeds[j, current_step] = update_speed(particle_speeds[j, current_step-1], particle_temperatures[j, current_step], particle_masses_array[j])
161
+
162
+ # Apply tunneling effect
163
+ if np.random.rand() < tunneling_probability:
164
+ particle_speeds[j, current_step] = particle_speeds[j, 0]
165
+ tunneling_steps[j, current_step] = True
166
+
167
+ # Calculate redshift
168
+ redshifts[j, current_step] = (1 + particle_speeds[j, current_step] / c)
169
+
170
+ # Calculate entanglement entropy
171
+ entanglement_entropies[j, current_step] = -np.sum(particle_states[j, current_step] * np.log(particle_states[j, current_step]))
172
+
173
+ # Update mass evolution
174
+ particle_masses_evolution[j, current_step] = particle_masses_evolution[j, current_step-1] * (1 - dark_energy_density * t_planck)
175
+
176
+ # Check for collisions
177
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, current_step], collision_distance)
178
+ if collision_detected:
179
+ handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
180
+
181
+ # Print calculated masses at the end of the simulation
182
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
183
+ for j, particle in enumerate(particle_masses.keys()):
184
+ print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
185
+
186
+ # Calculate the exact masses of the WIMP, axion, graviton, muon g-2, and preon
187
+ wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
188
+ axion_mass = calculate_axion_mass(dark_matter_density_GeV)
189
+ graviton_mass = calculate_graviton_mass(dark_matter_density_GeV)
190
+ muon_g2_mass = calculate_muon_g2_mass(dark_matter_density_GeV)
191
+ preon_mass = calculate_preon_mass(dark_matter_density_GeV)
192
+
193
+ # Print the exact masses of the WIMP, axion, graviton, muon g-2, and preon
194
+ print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
195
+ print(f"Exact mass of the axion: {axion_mass / GeV_to_J:.4e} GeV")
196
+ print(f"Exact mass of the graviton: {graviton_mass / GeV_to_J:.4e} GeV")
197
+ print(f"Exact mass of the muon g-2: {muon_g2_mass / GeV_to_J:.4e} GeV")
198
+ print(f"Exact mass of the preon: {preon_mass / GeV_to_J:.4e} GeV")
199
+
200
+
Wimps.py ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Convert dark matter density to GeV/m³
19
+ dark_matter_density_GeV = dark_matter_density / 1.60217662e-10
20
+
21
+ # Initial conditions
22
+ temperature_initial = 1.0 # Planck temperature in K
23
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
24
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
25
+
26
+ # Simulation time
27
+ t_planck = 5.39e-44 # Planck time in s
28
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
29
+
30
+ # Updated particle masses (in GeV)
31
+ particle_masses = {
32
+ "up": 2.3e-3,
33
+ "down": 4.8e-3,
34
+ "charm": 1.28,
35
+ "strange": 0.095,
36
+ "top": 173.0,
37
+ "bottom": 4.18,
38
+ "electron": 5.11e-4,
39
+ "muon": 1.05e-1,
40
+ "tau": 1.78,
41
+ "photon": 0,
42
+ "electron_neutrino": 0, # Neutrinos have very small masses
43
+ "muon_neutrino": 0,
44
+ "tau_neutrino": 0,
45
+ "W_boson": 80.379,
46
+ "Z_boson": 91.1876,
47
+ "Higgs_boson": 125.1,
48
+ "gluon": 0, # Massless
49
+ "proton": 0.938,
50
+ "neutron": 0.939,
51
+ "pion_plus": 0.140,
52
+ "pion_zero": 0.135,
53
+ "kaon_plus": 0.494,
54
+ "kaon_zero": 0.498,
55
+ "axion": 1e-5, # Exact mass for axion based on theoretical models
56
+ "WIMP": 100, # Exact mass for WIMP based on theoretical models
57
+ "graviton": 0, # Gravitons are massless as per current understanding
58
+ "preon": 1e-3 # Exact mass for preon based on theoretical models
59
+ }
60
+
61
+ # Conversion factor from GeV to J
62
+ GeV_to_J = 1.60217662e-10
63
+
64
+ # Simulation setup
65
+ num_steps = int(t_simulation / t_planck)
66
+
67
+ # Tunneling probabilities to investigate
68
+ tunneling_probabilities = np.arange(0.1, 0.6, 0.02) # Ex
69
+
70
+ # Create a directory to store the data
71
+ data_dir = "big_bang_simulation_data"
72
+ os.makedirs(data_dir, exist_ok=True)
73
+
74
+ # Functions to incorporate relativistic effects and collisions
75
+ def relativistic_energy(particle_speed, particle_mass):
76
+ epsilon = 1e-15 # A small value to avoid division by zero
77
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
78
+
79
+ def relativistic_momentum(particle_speed, particle_mass):
80
+ epsilon = 1e-15 # A small value to avoid division by zero
81
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
82
+
83
+ def update_speed(current_speed, current_temperature, particle_mass):
84
+ """Update the speed of a particle based on temperature and mass."""
85
+ return TSR * current_temperature # Update speed using TSR
86
+
87
+ def check_collision(particle_speeds, collision_distance):
88
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
89
+ for j in range(len(particle_speeds)):
90
+ for k in range(j+1, len(particle_speeds)):
91
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
92
+ return True, j, k
93
+ return False, -1, -1
94
+
95
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
96
+ """Handle a collision between two particles."""
97
+ if particle_masses[idx1] == 0 or particle_masses[idx2] == 0:
98
+ # Skip handling collisions involving massless particles
99
+ return
100
+
101
+ p1 = relativistic_momentum(particle_speeds[idx1, current_step], particle_masses[idx1])
102
+ p2 = relativistic_momentum(particle_speeds[idx2, current_step], particle_masses[idx2])
103
+
104
+ # Calculate velocities after collision using conservation of momentum
105
+ total_momentum = p1 + p2
106
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
107
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
108
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
109
+
110
+ particle_speeds[idx1, current_step], particle_speeds[idx2, current_step] = v1_new, v2_new
111
+
112
+ # Calculate the exact mass of the WIMP
113
+ def calculate_wimp_mass(dark_matter_density, redshift):
114
+ return np.sqrt(2 * dark_matter_density * (1 + redshift)**3)
115
+
116
+ # Calculate the exact mass of the axion
117
+ def calculate_axion_mass(dark_matter_density_GeV):
118
+ return np.sqrt(dark_matter_density_GeV) * 1e-5
119
+
120
+
121
+ # Calculate the redshift
122
+ def calculate_redshift(particle_speed):
123
+ return (1 + particle_speed / c)
124
+
125
+
126
+
127
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, Relativistic Effects, Redshift, and Entanglement
128
+ for tunneling_probability in tunneling_probabilities:
129
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
130
+
131
+ # Initialize arrays for simulation
132
+ num_particles = len(particle_masses)
133
+ particle_speeds = np.zeros((num_particles, num_steps)) # 2D array for speeds
134
+ particle_temperatures = np.zeros((num_particles, num_steps)) # 2D array for temperatures
135
+ particle_masses_evolution = np.zeros((num_particles, num_steps)) # 2D array for mass evolution
136
+ tunneling_steps = np.zeros((num_particles, num_steps), dtype=bool) # 2D array for tunneling steps
137
+ particle_momentum = np.zeros((num_particles, num_steps)) # 2D array for momentum
138
+ total_energy = np.zeros(num_steps) # 1D array for total energy of the system
139
+ redshifts = np.zeros((num_particles, num_steps)) # 2D array for redshift
140
+ entanglement_entropies = np.zeros((num_particles, num_steps)) # 2D array for entanglement entropy
141
+ particle_states = np.random.rand(num_particles, num_steps) # Placeholder for particle states
142
+
143
+ # Create an array of masses for each particle
144
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
145
+
146
+ for j, (particle, mass) in enumerate(particle_masses.items()):
147
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
148
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Initialize mass evolution
149
+
150
+ for current_step in range(1, num_steps):
151
+ for j in range(num_particles):
152
+ # Update temperature based on expansion of the universe
153
+ particle_temperatures[j, current_step] = particle_temperatures[j, current_step-1] * (1 - Hubble_constant_SI * t_planck)
154
+
155
+ # Update speed using TSR
156
+ particle_speeds[j, current_step] = update_speed(particle_speeds[j, current_step-1], particle_temperatures[j, current_step], particle_masses_array[j])
157
+
158
+ # Apply tunneling effect
159
+ if np.random.rand() < tunneling_probability:
160
+ particle_speeds[j, current_step] = particle_speeds[j, 0]
161
+ tunneling_steps[j, current_step] = True
162
+
163
+ # Calculate redshift
164
+ redshifts[j, current_step] = (1 + particle_speeds[j, current_step] / c)
165
+
166
+ # Calculate entanglement entropy
167
+ entanglement_entropies[j, current_step] = -np.sum(particle_states[j, current_step] * np.log(particle_states[j, current_step]))
168
+
169
+ # Update mass evolution
170
+ particle_masses_evolution[j, current_step] = particle_masses_evolution[j, current_step-1] * (1 - dark_energy_density * t_planck)
171
+
172
+ # Check for collisions
173
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, current_step], collision_distance)
174
+ if collision_detected:
175
+ handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
176
+
177
+ # Print calculated masses at the end of the simulation
178
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
179
+ for j, particle in enumerate(particle_masses.keys()):
180
+ print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
181
+
182
+ # Calculate the exact mass of the WIMP
183
+ wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
184
+
185
+ # Calculate the exact mass of the axion
186
+ axion_mass = calculate_axion_mass(dark_matter_density_GeV)
187
+
188
+ # Print the exact masses of the WIMP and axion
189
+ print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
190
+ print(f"Exact mass of the axion: {axion_mass / GeV_to_J:.4e} GeV")# Initialize output dictionaries
191
+ outputs = {
192
+ "tunneling_probabilities": tunneling_probabilities.tolist(),
193
+ "speed_ranges": speed_ranges,
194
+ "results": []
195
+ }
196
+
197
+ for speed_range in speed_ranges:
198
+ for tunneling_probability in tunneling_probabilities:
199
+ print(f"Simulating for tunneling probability: {tunneling_probability}, Speed range: {speed_range}")
200
+
201
+ #... (rest of the simulation code remains the same until the WIMP mass calculation)
202
+
203
+ wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
204
+ print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
205
+
206
+ outputs["results"].append({
207
+ "tunneling_probability": tunneling_probability,
208
+ "speed_range": speed_range,
209
+ "wimp_mass_GeV": wimp_mass / GeV_to_J,
210
+ "wimp_mass_J": wimp_mass,
211
+ "particle_speeds": particle_speeds.tolist()
212
+ })
213
+
214
+ # Save outputs to JSON file
215
+ with open("comprehensive_outputs.json", "w") as f:
216
+ json.dump(outputs, f, indent=4)
217
+
218
+ # Generate correlation plots and statistics
219
+ for speed_range in speed_ranges:
220
+ speed_range_results = [result for result in outputs["results"] if result["speed_range"] == speed_range]
221
+ tunneling_probabilities_speed_range = [result["tunneling_probability"] for result in speed_range_results]
222
+ wimp_masses_speed_range = [result["wimp_mass_GeV"] for result in speed_range_results]
223
+
224
+ plt.figure(figsize=(8, 6))
225
+ plt.scatter(tunneling_probabilities_speed_range, wimp_masses_speed_range)
226
+ plt.xlabel("Tunneling Probability")
227
+ plt.ylabel("Exact Mass of WIMP (GeV)")
228
+ plt.title(f"Correlation between WIMP Mass and Tunneling Probability (Speed range: {speed_range})")
229
+ plt.savefig(f"wimp_mass_correlation_speed_range_{speed_range}.png")
230
+ plt.show()
231
+
232
+ pearson_corr, _ = pearsonr(tunneling_probabilities_speed_range, wimp_masses_speed_range)
233
+ print(f"Pearson correlation coefficient (Speed range: {speed_range}): {pearson_corr:.4f}")
234
+
a.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Initialize output dictionaries
2
+ outputs = {
3
+ "tunneling_probabilities": tunneling_probabilities.tolist(),
4
+ "speed_ranges": speed_ranges,
5
+ "results": []
6
+ }
7
+
8
+ for speed_range in speed_ranges:
9
+ for tunneling_probability in tunneling_probabilities:
10
+ print(f"Simulating for tunneling probability: {tunneling_probability}, Speed range: {speed_range}")
11
+
12
+ #... (rest of the simulation code remains the same until the WIMP mass calculation)
13
+
14
+ wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
15
+ print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
16
+
17
+ outputs["results"].append({
18
+ "tunneling_probability": tunneling_probability,
19
+ "speed_range": speed_range,
20
+ "wimp_mass_GeV": wimp_mass / GeV_to_J,
21
+ "wimp_mass_J": wimp_mass,
22
+ "particle_speeds": particle_speeds.tolist()
23
+ })
24
+
25
+ # Save outputs to JSON file
26
+ with open("comprehensive_outputs.json", "w") as f:
27
+ json.dump(outputs, f, indent=4)
28
+
29
+ # Generate correlation plots and statistics
30
+ for speed_range in speed_ranges:
31
+ speed_range_results = [result for result in outputs["results"] if result["speed_range"] == speed_range]
32
+ tunneling_probabilities_speed_range = [result["tunneling_probability"] for result in speed_range_results]
33
+ wimp_masses_speed_range = [result["wimp_mass_GeV"] for result in speed_range_results]
34
+
35
+ plt.figure(figsize=(8, 6))
36
+ plt.scatter(tunneling_probabilities_speed_range, wimp_masses_speed_range)
37
+ plt.xlabel("Tunneling Probability")
38
+ plt.ylabel("Exact Mass of WIMP (GeV)")
39
+ plt.title(f"Correlation between WIMP Mass and Tunneling Probability (Speed range: {speed_range})")
40
+ plt.savefig(f"wimp_mass_correlation_speed_range_{speed_range}.png")
41
+ plt.show()
42
+
43
+ pearson_corr, _ = pearsonr(tunneling_probabilities_speed_range, wimp_masses_speed_range)
44
+ print(f"Pearson correlation coefficient (Speed range: {speed_range}): {pearson_corr:.4f}")
45
+
app.py CHANGED
@@ -1,283 +1,129 @@
1
- import numpy as np
2
  import pandas as pd
3
- import json
4
- import os
 
 
 
 
 
 
5
  import streamlit as st
6
 
7
  x = st.slider('Select a value')
8
  st.write(x, 'squared is', x * x)
9
 
10
- # Constants
11
- c = 299792458 # Speed of light in m/s
12
- E_mc2 = c**2 # Mass-energy equivalence in J/kg
13
- TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
14
- alpha = 1.0 # Proportional constant for TSR
15
- Q = 2 ** (1 / 12) # Fractal structure parameter
16
- dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
17
- dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
18
- collision_distance = 1e-10 # Distance for collision detection
19
- Hubble_constant = 70.0 # km/s/Mpc (approximation)
20
- Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
21
-
22
- # Convert dark matter density to GeV/m³
23
- dark_matter_density_GeV = dark_matter_density / 1.60217662e-10
24
-
25
- # Initial conditions
26
- temperature_initial = 1.0 # Planck temperature in K
27
- particle_density_initial = 5.16e96 # Planck density in kg/m^3
28
- particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
29
-
30
- # Simulation time
31
- t_planck = 5.39e-44 # Planck time in s
32
- t_simulation = t_planck * 1e5 # Shorter timescale for simulation
33
-
34
- # Updated particle masses (in GeV)
35
- particle_masses = {
36
- "up": 2.3e-3,
37
- "down": 4.8e-3,
38
- "charm": 1.28,
39
- "strange": 0.095,
40
- "top": 173.0,
41
- "bottom": 4.18,
42
- "electron": 5.11e-4,
43
- "muon": 1.05e-1,
44
- "tau": 1.78,
45
- "photon": 0,
46
- "electron_neutrino": 0, # Neutrinos have very small masses
47
- "muon_neutrino": 0,
48
- "tau_neutrino": 0,
49
- "W_boson": 80.379,
50
- "Z_boson": 91.1876,
51
- "Higgs_boson": 125.1,
52
- "gluon": 0, # Massless
53
- "proton": 0.938,
54
- "neutron": 0.939,
55
- "pion_plus": 0.140,
56
- "pion_zero": 0.135,
57
- "kaon_plus": 0.494,
58
- "kaon_zero": 0.498
59
- }
60
-
61
- # Conversion factor from GeV to J
62
- GeV_to_J = 1.60217662e-10
63
-
64
- # Simulation setup
65
- num_steps = int(t_simulation / t_planck)
66
-
67
- import numpy as np
68
- def generate_combined_tunneling_probabilities(start, stop, step_odd, step_even):
69
- """Generates a combined sequence of tunneling probabilities with alternating odd and even decimal places."""
70
- odd_tp = np.arange(start, stop, step_odd)
71
- even_tp = np.arange(start, stop, step_even)
72
- combined_tp = np.concatenate((odd_tp, even_tp))
73
- return combined_tp
74
- # Example usage:
75
- tunneling_probabilities = generate_combined_tunneling_probabilities(0.1, 1.5, 0.02, 0.01)
76
- print(tunneling_probabilities)
77
- # Create a directory to store the data
78
- data_dir = "big_bang_simulation_data"
79
- os.makedirs(data_dir, exist_ok=True)
80
-
81
- # Functions to incorporate relativistic effects and collisions
82
- def relativistic_energy(particle_speed, particle_mass):
83
- epsilon = 1e-15 # A small value to avoid division by zero
84
- return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
85
-
86
- def relativistic_momentum(particle_speed, particle_mass):
87
- epsilon = 1e-15 # A small value to avoid division by zero
88
- return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
89
-
90
- def update_speed(current_speed, current_temperature, particle_mass):
91
- """Update the speed of a particle based on temperature and mass."""
92
- return TSR * current_temperature # Update speed using TSR
93
-
94
- def check_collision(particle_speeds, collision_distance):
95
- epsilon = 1e-15 # A small value to avoid invalid subtraction
96
- for j in range(len(particle_speeds)):
97
- for k in range(j+1, len(particle_speeds)):
98
- if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
99
- return True, j, k
100
- return False, -1, -1
101
-
102
- def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
103
- """Handle a collision between two particles."""
104
- if particle_masses[idx1] == 0 or particle_masses[idx2] == 0:
105
- # Skip handling collisions involving massless particles
106
- return
107
-
108
- p1 = relativistic_momentum(particle_speeds[idx1, current_step], particle_masses[idx1])
109
- p2 = relativistic_momentum(particle_speeds[idx2, current_step], particle_masses[idx2])
110
-
111
- # Calculate velocities after collision using conservation of momentum
112
- total_momentum = p1 + p2
113
- total_mass = particle_masses[idx1] + particle_masses[idx2]
114
- v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
115
- v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
116
-
117
- particle_speeds[idx1, current_step], particle_speeds[idx2, current_step] = v1_new, v2_new
118
-
119
-
120
- def calculate_redshift(particle_speed):
121
- return (1 + particle_speed / c)
122
- # Calculate the exact mass of the WIMP
123
- def calculate_wimp_mass(dark_matter_density_GeV, redshift):
124
- return np.sqrt(2 * dark_matter_density_GeV * (1 + redshift)**3)
125
-
126
- # Calculate the exact mass of the axion
127
- def calculate_axion_mass(dark_matter_density_GeV):
128
- return np.sqrt(dark_matter_density_GeV) * 1e-5
129
-
130
- # Calculate the exact mass of the graviton
131
- def calculate_graviton_mass(dark_matter_density_GeV):
132
- return 0 # Graviton is massless
133
-
134
- # Calculate the exact mass of the muon g-2
135
- def calculate_muon_g2_mass(dark_matter_density_GeV):
136
- return 1.05e-1 # Muon mass
137
 
138
- # Calculate the exact mass of the preon
139
- def calculate_preon_mass(dark_matter_density_GeV):
140
- return 1.0e-3 # Preon mass
 
141
 
142
- # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, Relativistic Effects, Redshift, and Entanglement
143
- for tunneling_probability in tunneling_probabilities:
144
- print(f"Simulating for tunneling probability: {tunneling_probability}")
 
145
 
146
- # Initialize arrays for simulation
147
- num_particles = len(particle_masses)
148
- particle_speeds = np.zeros((num_particles, num_steps)) # 2D array for speeds
149
- particle_temperatures = np.zeros((num_particles, num_steps)) # 2D array for temperatures
150
- particle_masses_evolution = np.zeros((num_particles, num_steps)) # 2D array for mass evolution
151
- tunneling_steps = np.zeros((num_particles, num_steps), dtype=bool) # 2D array for tunneling steps
152
- particle_momentum = np.zeros((num_particles, num_steps)) # 2D array for momentum
153
- total_energy = np.zeros(num_steps) # 1D array for total energy of the system
154
- redshifts = np.zeros((num_particles, num_steps)) # 2D array for redshift
155
- entanglement_entropies = np.zeros((num_particles, num_steps)) # 2D array for entanglement entropy
156
- particle_states = np.random.rand(num_particles, num_steps) # Placeholder for particle states
157
 
158
- # Create an array of masses for each particle
159
- particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
 
160
 
161
- for j, (particle, mass) in enumerate(particle_masses.items()):
162
- particle_speeds[j, 0] = particle_speed_initial # Initialize speed
163
- particle_masses_evolution[j, 0] = mass * GeV_to_J # Initialize mass evolution
164
 
165
- for current_step in range(1, num_steps):
166
- for j in range(num_particles):
167
- # Update temperature based on expansion of the universe
168
- particle_temperatures[j, current_step] = particle_temperatures[j, current_step-1] * (1 - Hubble_constant_SI * t_planck)
169
 
170
- # Update speed using TSR
171
- particle_speeds[j, current_step] = update_speed(particle_speeds[j, current_step-1], particle_temperatures[j, current_step], particle_masses_array[j])
172
 
173
- # Apply tunneling effect
174
- if np.random.rand() < tunneling_probability:
175
- particle_speeds[j, current_step] = particle_speeds[j, 0]
176
- tunneling_steps[j, current_step] = True
177
-
178
- # Calculate redshift
179
- redshifts[j, current_step] = (1 + particle_speeds[j, current_step] / c)
180
-
181
- # Calculate entanglement entropy
182
- entanglement_entropies[j, current_step] = -np.sum(particle_states[j, current_step] * np.log(particle_states[j, current_step]))
183
-
184
- # Update mass evolution
185
- particle_masses_evolution[j, current_step] = particle_masses_evolution[j, current_step-1] * (1 - dark_energy_density * t_planck)
186
-
187
- # Check for collisions
188
- collision_detected, idx1, idx2 = check_collision(particle_speeds[:, current_step], collision_distance)
189
- if collision_detected:
190
- handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
191
-
192
- # Print calculated masses at the end of the simulation
193
- print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
194
- for j, particle in enumerate(particle_masses.keys()):
195
- print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
196
-
197
- # Calculate the exact masses of the WIMP, axion, graviton, muon g-2, and preon
198
- wimp_mass = calculate_wimp_mass(dark_matter_density_GeV, calculate_redshift(particle_speeds[-1, -1]))
199
- axion_mass = calculate_axion_mass(dark_matter_density_GeV)
200
- graviton_mass = calculate_graviton_mass(dark_matter_density_GeV)
201
- muon_g2_mass = calculate_muon_g2_mass(dark_matter_density_GeV)
202
- preon_mass = calculate_preon_mass(dark_matter_density_GeV)
203
-
204
- # Print the exact masses of the WIMP and axion
205
- print(f"Exact mass of the WIMP: {wimp_mass / GeV_to_J:.4e} GeV")
206
- print(f"Exact mass of the axion: {axion_mass / GeV_to_J:.4e} GeV")
207
- print(f"Exact mass of the graviton_mass: {graviton_mass/ GeV_to_J:.4e} GeV")
208
- import numpy as np
209
- import matplotlib.pyplot as plt
210
-
211
- # Define the correlation matrix
212
- correlation_matrix = np.array([
213
- [1]
214
  ])
215
 
216
- # Print the correlation matrix
217
- print("Correlation Matrix:")
218
- print(correlation_matrix)
219
-
220
- # Define the WIMP mass values
221
- wimp_mass_odd = 9.3559e+01
222
- wimp_mass_even = 3.3493e+48
223
-
224
- # Print the WIMP mass values
225
- print("\nWIMP Mass Values:")
226
- print("Odd: ", wimp_mass_odd)
227
- print("Even: ", wimp_mass_even)
228
-
229
- # Check if the even value is physically meaningful
230
- if wimp_mass_even < 1e+50:
231
- print("\nThe even value is physically meaningful.")
232
- else:
233
- print("\nThe even value is not physically meaningful.")
234
-
235
- # Create a Gaussian distribution for the WIMP mass
236
- mean_mass = wimp_mass_odd
237
- std_mass = 1e+01
238
-
239
- # Create a Gaussian distribution for the WIMP mass
240
- mass = np.random.normal(mean_mass, std_mass, 10000)
241
-
242
- # Plot the probability density function (PDF)
243
- plt.hist(mass, bins=50, density=True)
244
- plt.xlabel('WIMP Mass (GeV)')
245
- plt.ylabel('Probability Density')
246
- plt.title('Gaussian Distribution for WIMP Mass')
247
- plt.show()
248
-
249
- # Calculate the correlation between the WIMP mass and itself
250
- corr_mass_mass = 1
251
-
252
- # Print the correlation between the WIMP mass and itself
253
- print("\nCorrelation between WIMP Mass and itself: ", corr_mass_mass)
254
-
255
- # Create a figure and axis object
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  fig, ax = plt.subplots()
257
-
258
- # Plot the WIMP mass values
259
- ax.scatter([wimp_mass_odd], [corr_mass_mass], c='r', label='Odd')
260
- ax.scatter([wimp_mass_even], [corr_mass_mass], c='b', label='Even')
261
-
262
- # Set the title and labels
263
- ax.set_title('WIMP Mass Values')
264
- ax.set_xlabel('WIMP Mass (GeV)')
265
- ax.set_ylabel('Correlation')
266
-
267
- # Show the legend
268
- ax.legend()
269
-
270
- # Show the plot
271
  plt.show()
272
-
273
- # Create a dictionary to store the trends
274
- trends = {
275
- 'Correlation Matrix': correlation_matrix,
276
- 'WIMP Mass Values': [wimp_mass_odd, wimp_mass_even],
277
- 'Correlation between WIMP Mass and itself': corr_mass_mass
278
- }
279
-
280
- # Print the trends
281
- print("\nTrends:")
282
- for key, value in trends.items():
283
- print(key, ":", value)
 
1
+ import streamlit as st
2
  import pandas as pd
3
+ import numpy as np
4
+ st.title('Quantum Convergence Theory - ToE')
5
+
6
+ import matplotlib.pyplot as plt
7
+ from matplotlib.animation import FuncAnimation
8
+ import cupy as cp
9
+ from tqdm import tqdm
10
+ import plotly.graph_objects as go
11
  import streamlit as st
12
 
13
  x = st.slider('Select a value')
14
  st.write(x, 'squared is', x * x)
15
 
16
+ # Define the twelfth root of two
17
+ Q = 2 ** (1/12)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ # Define the wave function of the universe with variants (using CuPy)
20
+ def wave_function_cupy(x, t, scale=1.0, phase_shift=0.0):
21
+ denominator = 2 * (t**2 + 1e-10) # Add a small value to avoid division by zero
22
+ return scale * Q * cp.exp(-x**2 / denominator) * cp.exp(-1j * (t + phase_shift))
23
 
24
+ # Simulation parameters
25
+ x = np.linspace(-10, 10, 100)
26
+ t = np.linspace(0, 10, 100)
27
+ X, T = np.meshgrid(x, t)
28
 
29
+ # Convert numpy arrays to CuPy arrays
30
+ X_cupy = cp.asarray(X)
31
+ T_cupy = cp.asarray(T)
 
 
 
 
 
 
 
 
32
 
33
+ # Variants parameters
34
+ scales = [0.5, 1.0, 1.5] # Different scaling factors
35
+ phase_shifts = [0, np.pi/4, np.pi/2] # Different phase shifts
36
 
37
+ # Initialize a 3D array to store results
38
+ wave_functions_3d = np.zeros((len(scales), len(phase_shifts), len(x), len(t)), dtype=complex)
 
39
 
40
+ # Simulate with variants and store results in the 3D array
41
+ for i, scale in enumerate(scales):
42
+ for j, phase_shift in enumerate(phase_shifts):
43
+ wave_functions_3d[i, j, :, :] = cp.asnumpy(wave_function_cupy(X_cupy, T_cupy, scale, phase_shift))
44
 
45
+ # --- Plotly Interactive Visualization ---
 
46
 
47
+ # Create the figure
48
+ fig = go.Figure(data=[
49
+ go.Surface(x=x, y=t, z=np.abs(wave_functions_3d[0, 0, :, :])**2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ])
51
 
52
+ fig.update_layout(
53
+ title="Wave Function of the Universe",
54
+ scene=dict(
55
+ xaxis_title="x",
56
+ yaxis_title="t",
57
+ zaxis_title="|ψ(x,t)|^2"
58
+ ),
59
+ )
60
+
61
+ # Add Scale Slider
62
+ fig.update_layout(
63
+ sliders=[
64
+ dict(
65
+ active=True,
66
+ currentvalue=dict(
67
+ prefix="Scale: ",
68
+ font=dict(size=12)
69
+ ),
70
+ steps=[
71
+ dict(
72
+ method="update",
73
+ args=[
74
+ {"z": [np.abs(wave_functions_3d[i, 0, :, :])**2]} # Update z data
75
+ ],
76
+ label=f"Scale: {scales[i]:.2f}" # Label for step values
77
+ ) for i in range(len(scales))
78
+ ],
79
+ pad=dict(t=50),
80
+ len=0.9, # Length of the slider
81
+ x=0.1, # X position of the slider
82
+ y=0.1, # Y position of the slider
83
+ ),
84
+ dict(
85
+ active=True,
86
+ currentvalue=dict(
87
+ prefix="Phase Shift: ",
88
+ font=dict(size=12)
89
+ ),
90
+ steps=[
91
+ dict(
92
+ method="update",
93
+ args=[
94
+ {"z": [np.abs(wave_functions_3d[0, j, :, :])**2]} # Update z data
95
+ ],
96
+ label=f"Phase Shift: {phase_shifts[j]:.2f}" # Label for step values
97
+ ) for j in range(len(phase_shifts))
98
+ ],
99
+ pad=dict(t=50),
100
+ len=0.9, # Length of the slider
101
+ x=0.1, # X position of the slider
102
+ y=0.3, # Y position of the slider
103
+ )
104
+ ]
105
+ )
106
+
107
+ fig.show()
108
+
109
+ # --- End of Plotly ---
110
+
111
+ # --- Matplotlib Animation ---
112
+
113
+ # Animation
114
  fig, ax = plt.subplots()
115
+ im = ax.imshow(np.abs(wave_functions_3d[0, 0, :, :]) ** 2, extent=[-10, 10, 0, 10], aspect='auto', cmap='viridis')
116
+ ax.set_xlabel('x')
117
+ ax.set_ylabel('t')
118
+ ax.set_title('Wave Function of the Universe')
119
+ cbar = fig.colorbar(im, ax=ax, label='|ψ(x,t)|^2')
120
+
121
+ def update(frame):
122
+ i, j = divmod(frame, len(phase_shifts)) # Get the index for the 3D array
123
+ im.set_array(np.abs(wave_functions_3d[i, j, :, :]) ** 2) # Update with the correct frame
124
+ ax.set_title(f'Wave Function at Scale: {scales[i]}, Phase Shift: {phase_shifts[j]:.2f}')
125
+ return im,
126
+
127
+ ani = FuncAnimation(fig, update, frames=len(scales) * len(phase_shifts), blit=True)
128
+ ani.save('wave_function_animation.gif', writer='pillow')
129
  plt.show()
 
 
 
 
 
 
 
 
 
 
 
 
js.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import seaborn as sns
5
+
6
+ # Function to load JSON data
7
+ def load_json_data(json_file):
8
+ with open(json_file, 'r') as file:
9
+ return json.load(file)
10
+
11
+ # Load multiple JSON files into a DataFrame
12
+ data_files = [
13
+ '.\\Downloads\\big_bang_simulation_data\\big_bang_simulation_data_0.01.json',
14
+ '.\\Downloads\\big_bang_simulation_data\\big_bang_simulation_data_0.02.json',
15
+ '.\\Downloads\\big_bang_simulation_data\\big_bang_simulation_data_0.03.json',
16
+ # Add more files as needed
17
+ ]
18
+
19
+ data_list = [load_json_data(f) for f in data_files]
20
+
21
+ # Extract relevant data into a DataFrame
22
+ df = pd.DataFrame([
23
+ {
24
+ 'tunneling_probability': data['tunneling_probability'],
25
+ 'particle_mass_up': data['particle_masses_evolution'][0][-1],
26
+ 'particle_mass_down': data['particle_masses_evolution'][1][-1],
27
+ # Add more particles as needed
28
+ 'particle_speed': data['particle_speeds'][0][-1], # Example particle speed
29
+ 'particle_temperature': data['particle_temperatures'][0][-1], # Example particle temperature
30
+ }
31
+ for data in data_list
32
+ ])
33
+
34
+ # Assume df is your DataFrame with simulation results
35
+ correlation_matrix = df.corr()
36
+
37
+ plt.figure(figsize=(10, 8))
38
+ sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm')
39
+ plt.title('Correlation Matrix')
40
+ plt.show()
js1.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+ import seaborn as sns
6
+
7
+ # Function to load JSON data
8
+ def load_json_data(json_file):
9
+ with open(json_file, 'r') as file:
10
+ return json.load(file)
11
+
12
+ # Directory containing the JSON files
13
+ data_dir = '.\\Documents\\big_bang_simulation_data\\'
14
+
15
+ # List all JSON files in the directory
16
+ data_files = [os.path.join(data_dir, f) for f in os.listdir(data_dir) if f.endswith('.json')]
17
+
18
+ # Load multiple JSON files into a DataFrame
19
+ data_list = [load_json_data(f) for f in data_files]
20
+
21
+ # Extract relevant data into a DataFrame
22
+ df = pd.DataFrame([
23
+ {
24
+ 'tunneling_probability': data['tunneling_probability'],
25
+ 'particle_mass_up': data['particle_masses_evolution'][0][-1],
26
+ 'particle_mass_down': data['particle_masses_evolution'][1][-1],
27
+ 'particle_mass_charm': data['particle_masses_evolution'][2][-1],
28
+ 'particle_mass_strange': data['particle_masses_evolution'][3][-1],
29
+ 'particle_mass_top': data['particle_masses_evolution'][4][-1],
30
+ 'particle_mass_bottom': data['particle_masses_evolution'][5][-1],
31
+ 'particle_mass_electron': data['particle_masses_evolution'][6][-1],
32
+ 'particle_mass_muon': data['particle_masses_evolution'][7][-1],
33
+ 'particle_mass_tau': data['particle_masses_evolution'][8][-1],
34
+ 'particle_mass_photon': data['particle_masses_evolution'][9][-1],
35
+ 'particle_speed': data['particle_speeds'][0][-1],
36
+ 'particle_temperature': data['particle_temperatures'][0][-1],
37
+ }
38
+ for data in data_list
39
+ ])
40
+
41
+ # Compute correlations
42
+ correlation_matrix = df.corr()
43
+
44
+ # Adjust figure size for better visibility
45
+ plt.figure(figsize=(12, 10))
46
+ sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm')
47
+ plt.title('Correlation Matrix')
48
+ plt.show()
49
+
js2.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+ import seaborn as sns
6
+ from sklearn.decomposition import PCA
7
+
8
+ # Function to load JSON data
9
+ def load_json_data(json_file):
10
+ with open(json_file, 'r') as file:
11
+ return json.load(file)
12
+
13
+ # Directory containing the JSON files
14
+ data_dir = '.\\Documents\\big_bang_simulation_data\\'
15
+
16
+ # List all JSON files in the directory
17
+ data_files = [os.path.join(data_dir, f) for f in os.listdir(data_dir) if f.endswith('.json')]
18
+
19
+ # Load multiple JSON files into a DataFrame
20
+ data_list = [load_json_data(f) for f in data_files]
21
+
22
+ # Extract relevant data into a DataFrame
23
+ df = pd.DataFrame([
24
+ {
25
+ 'tunneling_probability': data['tunneling_probability'],
26
+ 'particle_mass_up': data['particle_masses_evolution'][0][-1],
27
+ 'particle_mass_down': data['particle_masses_evolution'][1][-1],
28
+ 'particle_mass_charm': data['particle_masses_evolution'][2][-1],
29
+ 'particle_mass_strange': data['particle_masses_evolution'][3][-1],
30
+ 'particle_mass_top': data['particle_masses_evolution'][4][-1],
31
+ 'particle_mass_bottom': data['particle_masses_evolution'][5][-1],
32
+ 'particle_mass_electron': data['particle_masses_evolution'][6][-1],
33
+ 'particle_mass_muon': data['particle_masses_evolution'][7][-1],
34
+ 'particle_mass_tau': data['particle_masses_evolution'][8][-1],
35
+ 'particle_mass_photon': data['particle_masses_evolution'][9][-1],
36
+ 'particle_speed': data['particle_speeds'][0][-1],
37
+ 'particle_temperature': data['particle_temperatures'][0][-1],
38
+ }
39
+ for data in data_list
40
+ ])
41
+
42
+ # Scatter Plot: Tunneling Probability vs Up Quark Mass
43
+ plt.figure(figsize=(8, 6))
44
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_up', data=df)
45
+ plt.title('Tunneling Probability vs Up Quark Mass')
46
+ plt.xlabel('Tunneling Probability')
47
+ plt.ylabel('Up Quark Mass (GeV)')
48
+ plt.show()
49
+
50
+ # Scatter Plot: Particle Temperature vs Speed
51
+ plt.figure(figsize=(8, 6))
52
+ sns.scatterplot(x='particle_temperature', y='particle_speed', data=df)
53
+ plt.title('Particle Temperature vs Speed')
54
+ plt.xlabel('Temperature (K)')
55
+ plt.ylabel('Speed (m/s)')
56
+ plt.show()
57
+
58
+ # Line Graph: Evolution of Up Quark Mass Over Time
59
+ time_steps = range(len(data_list[0]['particle_masses_evolution'][0]))
60
+ plt.figure(figsize=(10, 6))
61
+ for data in data_list:
62
+ plt.plot(time_steps, data['particle_masses_evolution'][0], label=f"Tunneling Probability: {data['tunneling_probability']:.2f}")
63
+ plt.title('Evolution of Up Quark Mass Over Time')
64
+ plt.xlabel('Time Steps')
65
+ plt.ylabel('Up Quark Mass (GeV)')
66
+ plt.legend()
67
+ plt.show()
68
+
69
+ # Dimensionality Reduction: PCA
70
+ features = ['particle_mass_up', 'particle_mass_down', 'particle_mass_charm', 'particle_mass_strange', 'particle_mass_top', 'particle_mass_bottom', 'particle_mass_electron', 'particle_mass_muon', 'particle_mass_tau', 'particle_mass_photon', 'particle_speed', 'particle_temperature']
71
+ X = df[features]
72
+ pca = PCA(n_components=2)
73
+ principal_components = pca.fit_transform(X)
74
+ pca_df = pd.DataFrame(data=principal_components, columns=['PC1', 'PC2'])
75
+
76
+ # PCA Plot
77
+ plt.figure(figsize=(8, 6))
78
+ sns.scatterplot(x='PC1', y='PC2', data=pca_df, hue=df['tunneling_probability'], palette='viridis')
79
+ plt.title('PCA of Particle Properties')
80
+ plt.xlabel('Principal Component 1')
81
+ plt.ylabel('Principal Component 2')
82
+ plt.show()
83
+
84
+ # Investigate correlations in detail
85
+ correlation_matrix = df.corr()
86
+ plt.figure(figsize=(12, 10))
87
+ sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm')
88
+ plt.title('Detailed Correlation Matrix')
89
+ plt.show()
90
+
91
+ # Identify highly correlated pairs
92
+ correlated_pairs = correlation_matrix.unstack().sort_values(kind="quicksort")
93
+ highly_correlated_pairs = correlated_pairs[(abs(correlated_pairs) > 0.8) & (abs(correlated_pairs) < 1)]
94
+
95
+ # Print highly correlated pairs
96
+ print("Highly Correlated Pairs:")
97
+ print(highly_correlated_pairs)
98
+
99
+ # Considering additional variables if available
100
+ df['particle_momentum'] = [...] # Add momentum data if available
101
+ df['particle_energy'] = [...] # Add energy data if available
102
+
103
+ # Re-run PCA with additional variables
104
+ features = ['particle_mass_up', 'particle_mass_down', 'particle_mass_charm', 'particle_mass_strange', 'particle_mass_top', 'particle_mass_bottom', 'particle_mass_electron', 'particle_mass_muon', 'particle_mass_tau', 'particle_mass_photon', 'particle_speed', 'particle_temperature', 'particle_momentum', 'particle_energy']
105
+ X = df[features]
106
+ pca = PCA(n_components=2)
107
+ principal_components = pca.fit_transform(X)
108
+ pca_df = pd.DataFrame(data=principal_components, columns=['PC1', 'PC2'])
109
+
110
+ # Plot updated PCA results
111
+ plt.figure(figsize=(8, 6))
112
+ sns.scatterplot(x='PC1', y='PC2', data=pca_df, hue=df['tunneling_probability'], palette='viridis')
113
+ plt.title('PCA of Particle Properties with Additional Variables')
114
+ plt.xlabel('Principal Component 1')
115
+ plt.ylabel('Principal Component 2')
116
+ plt.show()
117
+
js3.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+ import seaborn as sns
6
+ from sklearn.decomposition import PCA
7
+
8
+ # Function to load JSON data
9
+ def load_json_data(json_file):
10
+ with open(json_file, 'r') as file:
11
+ return json.load(file)
12
+
13
+ # Directory containing the JSON files
14
+ data_dir = '.\\Documents\\big_bang_simulation_data\\'
15
+
16
+ # List all JSON files in the directory
17
+ data_files = [os.path.join(data_dir, f) for f in os.listdir(data_dir) if f.endswith('.json')]
18
+
19
+ # Load multiple JSON files into a DataFrame
20
+ data_list = []
21
+ for f in data_files:
22
+ data = load_json_data(f)
23
+ data_list.append({
24
+ 'tunneling_probability': data['tunneling_probability'],
25
+ 'particle_mass_up': data['particle_masses_evolution'][0][-1],
26
+ 'particle_mass_down': data['particle_masses_evolution'][1][-1],
27
+ 'particle_mass_charm': data['particle_masses_evolution'][2][-1],
28
+ 'particle_mass_strange': data['particle_masses_evolution'][3][-1],
29
+ 'particle_mass_top': data['particle_masses_evolution'][4][-1],
30
+ 'particle_mass_bottom': data['particle_masses_evolution'][5][-1],
31
+ 'particle_mass_electron': data['particle_masses_evolution'][6][-1],
32
+ 'particle_mass_muon': data['particle_masses_evolution'][7][-1],
33
+ 'particle_mass_tau': data['particle_masses_evolution'][8][-1],
34
+ 'particle_mass_photon': data['particle_masses_evolution'][9][-1],
35
+ 'particle_speed': data['particle_speeds'][0][-1],
36
+ 'particle_temperature': data['particle_temperatures'][0][-1],
37
+ })
38
+
39
+ df = pd.DataFrame(data_list)
40
+
41
+ # Scatter Plot: Tunneling Probability vs Various Particle Masses
42
+ plt.figure(figsize=(10, 8))
43
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_up', data=df, label='Up Quark')
44
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_down', data=df, label='Down Quark')
45
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_charm', data=df, label='Charm Quark')
46
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_strange', data=df, label='Strange Quark')
47
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_top', data=df, label='Top Quark')
48
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_bottom', data=df, label='Bottom Quark')
49
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_electron', data=df, label='Electron')
50
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_muon', data=df, label='Muon')
51
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_tau', data=df, label='Tau')
52
+ sns.scatterplot(x='tunneling_probability', y='particle_mass_photon', data=df, label='Photon')
53
+ plt.title('Tunneling Probability vs Particle Masses')
54
+ plt.xlabel('Tunneling Probability')
55
+ plt.ylabel('Particle Mass (GeV)')
56
+ plt.legend()
57
+ plt.show()
58
+
59
+ # Heatmap: Correlation between Particle Masses
60
+ corr_matrix = df[['particle_mass_up', 'particle_mass_down', 'particle_mass_charm', 'particle_mass_strange', 'particle_mass_top', 'particle_mass_bottom', 'particle_mass_electron', 'particle_mass_muon', 'particle_mass_tau', 'particle_mass_photon']].corr()
61
+ plt.figure(figsize=(10, 8))
62
+ sns.heatmap(corr_matrix, annot=True, cmap='coolwarm', square=True)
63
+ plt.title('Correlation between Particle Masses')
64
+ plt.show()
65
+
66
+ # PCA
67
+ features = ['particle_mass_up', 'particle_mass_down', 'particle_mass_charm', 'particle_mass_strange', 'particle_mass_top', 'particle_mass_bottom', 'particle_mass_electron', 'particle_mass_muon', 'particle_mass_tau', 'particle_mass_photon', 'particle_speed', 'particle_temperature']
68
+ X = df[features]
69
+ pca = PCA(n_components=2)
70
+ principal_components = pca.fit_transform(X)
71
+ pca_df = pd.DataFrame(data=principal_components, columns=['PC1', 'PC2'])
72
+
73
+ # PCA Plot
74
+ plt.figure(figsize=(8, 6))
75
+ sns.scatterplot(x='PC1', y='PC2', data=pca_df, hue=df['tunneling_probability'], palette='viridis')
76
+ plt.title('PCA of Particle Properties')
77
+ plt.xlabel('Principal Component 1')
78
+ plt.ylabel('Principal Component 2')
79
+ plt.show()
pi.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+
4
+ # Constants
5
+ num_samples = 1000000 # Number of random samples
6
+ radius = 1.0 # Radius of the circle
7
+
8
+ # Generate random points in the unit square [0, 1] x [0, 1]
9
+ x = np.random.uniform(-radius, radius, num_samples)
10
+ y = np.random.uniform(-radius, radius, num_samples)
11
+
12
+ # Count how many points fall inside the quarter circle
13
+ inside_circle = np.sum(x**2 + y**2 <= radius**2)
14
+
15
+ # Estimate pi using the ratio of points inside the circle to total points
16
+ pi_estimate = (inside_circle / num_samples) * 4
17
+ print(f"Estimated value of pi with {num_samples} samples: {pi_estimate}")
18
+
19
+ # Optional: Visualize the points
20
+ def plot_simulation(x, y):
21
+ plt.figure(figsize=(8, 8))
22
+ plt.scatter(x[x**2 + y**2 <= radius**2], y[x**2 + y**2 <= radius**2], color='blue', s=1) # Points inside the circle
23
+ plt.scatter(x[x**2 + y**2 > radius**2], y[x**2 + y**2 > radius**2], color='red', s=1) # Points outside the circle
24
+ plt.xlim(-1.5, 1.5)
25
+ plt.ylim(-1.5, 1.5)
26
+ plt.title('Monte Carlo Simulation of Pi')
27
+ plt.gca().set_aspect('equal', adjustable='box')
28
+ plt.axhline(0, color='black', lw=0.5)
29
+ plt.axvline(0, color='black', lw=0.5)
30
+ plt.grid()
31
+ plt.show()
32
+
33
+ # Uncomment the line below to visualize the simulation
34
+ # plot_simulation(x, y)
35
+
pi1.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+
4
+ # Constants
5
+ num_particles = 1000000 # Increase the number of particles for better accuracy
6
+ radius = 1.0 # Radius of the circle
7
+
8
+ # Generate random points in the unit square [-1, 1] x [-1, 1]
9
+ x_positions = np.random.uniform(-radius, radius, num_particles)
10
+ y_positions = np.random.uniform(-radius, radius, num_particles)
11
+
12
+ # Function to estimate pi based on particle positions
13
+ def estimate_pi_from_particles(x_positions, y_positions):
14
+ inside_circle = np.sum(x_positions**2 + y_positions**2 <= radius**2)
15
+ total_particles = len(x_positions)
16
+ pi_estimate = (inside_circle / total_particles) * 4 # Area ratio method
17
+ return pi_estimate
18
+
19
+ # Estimate pi
20
+ pi_estimate = estimate_pi_from_particles(x_positions, y_positions)
21
+ print(f"Estimated value of pi based on particle positions: {pi_estimate}")
22
+
23
+ # Optional: Visualize the particles
24
+ def plot_particles(x_positions, y_positions):
25
+ plt.figure(figsize=(8, 8))
26
+ plt.scatter(x_positions[x_positions**2 + y_positions**2 <= radius**2],
27
+ y_positions[x_positions**2 + y_positions**2 <= radius**2],
28
+ color='blue', s=1) # Points inside the circle
29
+ plt.scatter(x_positions[x_positions**2 + y_positions**2 > radius**2],
30
+ y_positions[x_positions**2 + y_positions**2 > radius**2],
31
+ color='red', s=1) # Points outside the circle
32
+ plt.xlim(-1.5, 1.5)
33
+ plt.ylim(-1.5, 1.5)
34
+ plt.title('Monte Carlo Simulation of Pi')
35
+ plt.gca().set_aspect('equal', adjustable='box')
36
+ plt.axhline(0, color='black', lw=0.5)
37
+ plt.axvline(0, color='black', lw=0.5)
38
+ plt.grid()
39
+ plt.show()
40
+
41
+ # Uncomment the line below to visualize the particles
42
+ # plot_particles(x_positions, y_positions)
43
+
pi2.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import decimal
2
+ from decimal import Decimal, getcontext
3
+
4
+ # Set the precision
5
+ getcontext().prec = 110
6
+
7
+ # Constants
8
+ c = 299792458 # Speed of light in m/s
9
+ h = Decimal('6.62607015e-34') # Planck constant in J*s
10
+ k_B = Decimal('1.38e-23') # Boltzmann constant in J/K
11
+ TSR = Decimal(c**2) / k_B # Temperature to Speed Ratio in K*m/s
12
+ Q = Decimal('2') ** (Decimal('1') / Decimal('12')) # Fractal structure parameter
13
+
14
+ def chudnovsky_pi(n_terms):
15
+ C = Decimal(426880) * Decimal(10005).sqrt()
16
+ K = Decimal(6)
17
+ M = Decimal(1)
18
+ X = Decimal(1)
19
+ L = Decimal(13591409)
20
+ S = Decimal(0) # Initialize S to 0
21
+ for i in range(1, n_terms + 1): # Change to n_terms + 1 to avoid i = 0
22
+ if i == 1: # Handle the first iteration separately
23
+ M = Decimal(1) # Set M to 1 for the first iteration
24
+ else:
25
+ divisor = Decimal((i-1)**3)
26
+ if divisor == Decimal(0): # Check for zero divisor
27
+ divisor = Decimal(1) # Set divisor to 1 to avoid division by zero
28
+ M = (K**3 - Decimal(16)*K) * M // divisor
29
+ L += Decimal(545140134)
30
+ X *= Decimal(-262537412640768000)
31
+ term = Decimal(M * L) / X
32
+ # Apply fractal Q to the term
33
+ term *= Q ** (Decimal(i) / Decimal(n_terms))
34
+ # Apply TSR and quantum fluctuations conservatively
35
+ if term < Decimal('1e-15'):
36
+ TSR_rel = TSR
37
+ ΔTSR_q = Decimal('0')
38
+ else:
39
+ TSR_rel = TSR / Decimal((1 - (term**2 / Decimal(c**2))).sqrt())
40
+ ΔTSR_q = h * term
41
+ S += term * TSR_rel + ΔTSR_q
42
+ K += Decimal(12)
43
+ pi = C / S
44
+ return +pi
45
+
46
+ # Example usage
47
+ pi = chudnovsky_pi(100)
48
+ print(f"π ≈ {pi}")
49
+
50
+ # Save results to a JSON file
51
+ import json
52
+ with open('pi_simulation_results.json', 'w') as f:
53
+ json.dump({"pi_approx": str(pi)}, f)
pi3.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Quark masses (in GeV) - used for initial mass values and comparison
28
+ quark_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ }
40
+
41
+ # Conversion factor from GeV to J
42
+ GeV_to_J = 1.60217662e-10
43
+
44
+ # Simulation setup
45
+ num_steps = int(t_simulation / t_planck)
46
+
47
+ # Tunneling probabilities to investigate
48
+ tunneling_probabilities = np.arange(0.00000000001, 0.00000000010, 0.00000000001 ) # Exclude 1.0
49
+
50
+ # Create a directory to store the data
51
+ data_dir = "big_bang_simulation_data"
52
+ os.makedirs(data_dir, exist_ok=True)
53
+
54
+ # Functions to incorporate relativistic effects and collisions
55
+ def relativistic_energy(particle_speed, particle_mass):
56
+ epsilon = 1e-15 # A small value to avoid division by zero
57
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
58
+
59
+ def relativistic_momentum(particle_speed, particle_mass):
60
+ epsilon = 1e-15 # A small value to avoid division by zero
61
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
62
+
63
+ def update_speed(current_speed, current_temperature, particle_mass):
64
+ """Update the speed of a particle based on temperature and mass."""
65
+ return TSR * current_temperature # Update speed using TSR
66
+
67
+ def check_collision(particle_speeds, collision_distance):
68
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
69
+ for j in range(len(particle_speeds)):
70
+ for k in range(j+1, len(particle_speeds)):
71
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
72
+ return True, j, k
73
+ return False, -1, -1
74
+
75
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2):
76
+ """Handle a collision between two particles."""
77
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
78
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
79
+
80
+ # Calculate velocities after collision using conservation of momentum
81
+ total_momentum = p1 + p2
82
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
83
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
84
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
85
+
86
+ particle_speeds[idx1], particle_speeds[idx2] = v1_new, v2_new
87
+
88
+ #...
89
+
90
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
91
+ for tunneling_probability in tunneling_probabilities:
92
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
93
+
94
+ # Initialize arrays for simulation
95
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
96
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
97
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
98
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
99
+
100
+ # Create an array of masses for each quark
101
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
102
+
103
+ for j, (quark, mass) in enumerate(quark_masses.items()):
104
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
105
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
106
+ particle_temperatures[j, 0] = temperature_initial # Initialize temperature
107
+
108
+ for i in range(1, num_steps):
109
+ # Update temperature based on expansion of the universe
110
+ particle_temperatures[j, i] = particle_temperatures[j, i-1] * (1 - Hubble_constant_SI * t_planck)
111
+
112
+ # Update speed using TSR
113
+ particle_speeds[j, i] = update_speed(particle_speeds[j, i-1], particle_temperatures[j, i], particle_masses[j])
114
+
115
+ # Apply tunneling effect
116
+ if np.random.rand() < tunneling_probability:
117
+ particle_speeds[j, i] = particle_speeds[j, 0]
118
+ tunneling_steps[j, i] = True
119
+
120
+ # Calculate entropy using von Neumann entropy formula
121
+ if particle_masses[j] == 0:
122
+ entropy = 0
123
+ else:
124
+ entropy = -particle_masses[j] * np.log1p(particle_masses[j])
125
+
126
+ # Update mass based on entropy
127
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i-1] + entropy / c**2
128
+
129
+ # Check for entanglement
130
+ if particle_speeds[j, i] == c and particle_temperatures[j, i] == 0:
131
+ print(f"Entanglement detected for particle {quark} at step {i}")
132
+
133
+ # Print calculated masses at the end of the simulation
134
+ print(f"Calculated masses at the end of the simulation using the von Neumann entropy (Tunneling Probability: {tunneling_probability}):")
135
+ for j, quark in enumerate(quark_masses.keys()):
136
+ print(f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
137
+
138
+ # Save data to JSON file
139
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
140
+ data = {
141
+ "tunneling_probability": tunneling_probability,
142
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
143
+ "particle_speeds": particle_speeds.tolist(),
144
+ "particle_temperatures": particle_temperatures.tolist(),
145
+ "tunneling_steps": tunneling_steps.tolist()
146
+ }
147
+ with open(data_filename, "w") as f:
148
+ json.dump(data, f)
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ streamlit==1.24.1
2
+ pandas>2.0
3
+ numpy<=1.25.1
4
+ plotly
5
+ cupy-cuda12x
6
+ matplotlib
7
+ scipy
8
+ tqdm
9
+ json
sim.py ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ from matplotlib.animation import FuncAnimation
4
+ from mpl_toolkits.mplot3d import Axes3D
5
+ import plotly.graph_objects as go
6
+ import pandas as pd
7
+ import json
8
+ import os
9
+
10
+ # Constants
11
+ c = 299792458 # Speed of light in m/s
12
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
13
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
14
+ alpha = 1.0 # Proportional constant for TSR
15
+ Q = 2 ** (1 / 12) # Fractal structure parameter
16
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
17
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
18
+ collision_distance = 1e-10 # Distance for collision detection
19
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
20
+ Hubble_constant_SI = (
21
+ Hubble_constant * 1000 / 3.086e22
22
+ ) # Hubble constant in SI units (s^-1)
23
+
24
+ # Initial conditions
25
+ temperature_initial = 1.42e32 # Planck temperature in K
26
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
27
+ particle_speed_initial = c # Initially at the speed of light
28
+
29
+ # Simulation time
30
+ t_planck = 5.39e-44 # Planck time in s
31
+ t_simulation = t_planck * 1e3 # Shorter timescale for simulation
32
+
33
+ # Quark masses (in GeV) - used for initial mass values and comparison
34
+ quark_masses = {
35
+ "up": 2.3e-3,
36
+ "down": 4.8e-3,
37
+ "charm": 1.28,
38
+ "strange": 0.095,
39
+ "top": 173.0,
40
+ "bottom": 4.18,
41
+ }
42
+
43
+ # Conversion factor from GeV to J
44
+ GeV_to_J = 1.60217662e-10
45
+
46
+ # Simulation setup
47
+ num_steps = int(t_simulation / t_planck)
48
+
49
+ # Tunneling probabilities to investigate
50
+ tunneling_probabilities = np.arange(0.1, 1.1, 0.1) # Exclude 1.0
51
+
52
+ # Create a directory to store the data
53
+ data_dir = "big_bang_simulation_data"
54
+ os.makedirs(data_dir, exist_ok=True)
55
+
56
+ # Functions to incorporate relativistic effects
57
+ def relativistic_energy(particle_speed, particle_mass):
58
+ if particle_speed >= c:
59
+ return np.inf
60
+ return particle_mass * c**2 / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
61
+
62
+
63
+ def relativistic_momentum(particle_speed, particle_mass):
64
+ if particle_speed >= c:
65
+ return np.inf
66
+ return (
67
+ particle_mass
68
+ * particle_speed
69
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
70
+ )
71
+
72
+
73
+ def update_speed(current_speed, current_temperature, particle_mass):
74
+ rel_momentum = relativistic_momentum(current_speed, particle_mass)
75
+ return c * np.sqrt(
76
+ max(1e-10, 1 - (rel_momentum / (rel_momentum + dark_energy_density)) ** 2)
77
+ )
78
+
79
+
80
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
81
+ correlation_matrices = [] # Initialize correlation_matrices list
82
+
83
+ for tunneling_probability in tunneling_probabilities:
84
+ print(f"Running simulation for tunneling probability: {tunneling_probability}")
85
+
86
+ # Initialize arrays for simulation
87
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
88
+ particle_temperatures = np.zeros(
89
+ (len(quark_masses), num_steps)
90
+ ) # 2D array for temperatures
91
+ particle_masses_evolution = np.zeros(
92
+ (len(quark_masses), num_steps)
93
+ ) # 2D array for mass evolution
94
+ particle_positions = np.zeros(
95
+ (len(quark_masses), num_steps)
96
+ ) # 2D array for positions
97
+ tunneling_steps = np.zeros(
98
+ (len(quark_masses), num_steps), dtype=bool
99
+ ) # 2D array for tunneling steps
100
+
101
+ # Create an array of masses for each quark
102
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
103
+
104
+ for j, (quark, mass) in enumerate(quark_masses.items()):
105
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
106
+ particle_positions[j, 0] = 0 # Initialize position
107
+
108
+ for i in range(1, num_steps):
109
+ particle_speeds[j, i] = update_speed(
110
+ particle_speeds[j, i - 1],
111
+ particle_temperatures[j, i - 1],
112
+ particle_masses[j],
113
+ )
114
+ particle_positions[j, i] = (
115
+ particle_positions[j, i - 1] + particle_speeds[j, i] * t_planck
116
+ ) # Update position
117
+
118
+ value = (
119
+ 1
120
+ - (particle_speeds[j, i] / (TSR * temperature_initial))
121
+ + dark_matter_density
122
+ )
123
+
124
+ if np.random.rand() < tunneling_probability:
125
+ particle_speeds[j, i] = particle_speeds[j, 0] # Tunneling effect
126
+ tunneling_steps[j, i] = True # Mark tunneling step
127
+
128
+ if value < 0:
129
+ value = 0
130
+
131
+ particle_temperatures[j, i] = (
132
+ alpha * particle_speeds[j, i] ** 2
133
+ ) # Apply TSR equation
134
+
135
+ # Update mass based on energy conversion
136
+ speed_squared_diff = (
137
+ particle_speeds[j, i] ** 2 - particle_speeds[j, i - 1] ** 2
138
+ )
139
+
140
+ # Avoid division by zero (if speed doesn't change, mass doesn't change)
141
+ if speed_squared_diff == 0:
142
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1]
143
+ else:
144
+ # Calculate the change in relativistic energy
145
+ energy_diff = relativistic_energy(
146
+ particle_speeds[j, i], particle_masses[j]
147
+ ) - relativistic_energy(particle_speeds[j, i - 1], particle_masses[j])
148
+
149
+ # Avoid NaN by checking if energy_diff is practically zero
150
+ if abs(energy_diff) < 1e-15: # Adjust the tolerance as needed
151
+ particle_masses_evolution[j, i] = particle_masses_evolution[
152
+ j, i - 1
153
+ ]
154
+ else:
155
+ # Update mass based on energy difference
156
+ new_mass = (
157
+ particle_masses_evolution[j, i - 1] + energy_diff / c**2
158
+ )
159
+ if np.isfinite(new_mass): # Check if the new mass is finite
160
+ particle_masses_evolution[j, i] = new_mass
161
+ else:
162
+ particle_masses_evolution[j, i] = particle_masses_evolution[
163
+ j, i - 1
164
+ ]
165
+
166
+ # Collision detection and resolution
167
+ for k in range(j + 1, len(quark_masses)):
168
+ if (
169
+ abs(particle_positions[j, i] - particle_positions[k, i])
170
+ < collision_distance
171
+ ):
172
+ # Resolve collision (simplified example)
173
+ # Calculate relative speed before the collision
174
+ v_rel = particle_speeds[j, i] - particle_speeds[k, i]
175
+
176
+ # Calculate the new speeds after the collision
177
+ particle_speeds[j, i] = (
178
+ particle_speeds[j, i]
179
+ * (particle_masses[j] - particle_masses[k])
180
+ + 2 * particle_masses[k] * particle_speeds[k, i]
181
+ ) / (particle_masses[j] + particle_masses[k])
182
+ particle_speeds[k, i] = (
183
+ particle_speeds[k, i]
184
+ * (particle_masses[k] - particle_masses[j])
185
+ + 2 * particle_masses[j] * particle_speeds[j, i]
186
+ ) / (particle_masses[j] + particle_masses[k])
187
+
188
+ # Limit speed after collision
189
+ max_speed = c * 0.99 # Adjust the maximum speed as needed
190
+ particle_speeds[j, i] = np.clip(particle_speeds[j, i], 0, max_speed)
191
+ particle_speeds[k, i] = np.clip(particle_speeds[k, i], 0, max_speed)
192
+
193
+ # Update temperatures based on TSR
194
+ particle_temperatures[j, i] = alpha * particle_speeds[j, i] ** 2
195
+ particle_temperatures[k, i] = alpha * particle_speeds[k, i] ** 2
196
+
197
+ # Apply expansion of the universe (redshift)
198
+ particle_speeds[j, i] *= 1 - Hubble_constant_SI * t_planck
199
+
200
+ # Apply expansion of the universe (cooling)
201
+ particle_temperatures[j, i] *= 1 - Hubble_constant_SI * t_planck
202
+
203
+ # Debugging output
204
+ if np.isnan(particle_speeds[j, i]) or np.isnan(particle_temperatures[j, i]):
205
+ print(f"NaN detected at step {i} for quark {quark}")
206
+ print(f"Previous speed: {particle_speeds[j, i - 1]}")
207
+ print(f"Previous temperature: {particle_temperatures[j, i - 1]}")
208
+ print(f"Current speed: {particle_speeds[j, i]}")
209
+ print(f"Current temperature: {particle_temperatures[j, i]}")
210
+ break
211
+
212
+ # Cap speed to avoid unphysical values
213
+ particle_speeds[j] = np.clip(particle_speeds[j], 0, c)
214
+
215
+ # --- Plotly Interactive Visualization (3D) ---
216
+ # Create the 3D scatter plot using Plotly
217
+ fig = go.Figure(
218
+ data=[
219
+ go.Scatter3d(
220
+ x=particle_speeds[j],
221
+ y=particle_temperatures[j],
222
+ z=np.arange(num_steps),
223
+ mode="lines+markers",
224
+ name=quark.capitalize(),
225
+ )
226
+ for j, quark in enumerate(quark_masses.keys())
227
+ ]
228
+ )
229
+ fig.update_layout(
230
+ title=f"Big Bang Simulation: Temperature vs. Speed (Tunneling Probability: {tunneling_probability})",
231
+ autosize=False,
232
+ width=800,
233
+ height=600,
234
+ margin=dict(l=65, r=50, b=65, t=90),
235
+ )
236
+ fig.show()
237
+
238
+ # --- Matplotlib Animation (3D) ---
239
+ fig = plt.figure()
240
+ ax = fig.add_subplot(111, projection="3d")
241
+ (line,) = ax.plot([], [], [], "b-")
242
+
243
+ # Set axis limits
244
+ ax.set_xlim(min(particle_speeds.flatten()), max(particle_speeds.flatten()))
245
+ ax.set_ylim(
246
+ min(particle_temperatures.flatten()), max(particle_temperatures.flatten())
247
+ )
248
+ ax.set_zlim(0, num_steps)
249
+
250
+ ax.set_xlabel("Particle Speed")
251
+ ax.set_ylabel("Particle Temperature")
252
+ ax.set_zlabel("Time")
253
+ ax.set_title(
254
+ f"Big Bang Simulation Animation (Tunneling Probability: {tunneling_probability})"
255
+ )
256
+
257
+ def init():
258
+ line.set_data([], [])
259
+ line.set_3d_properties([])
260
+ return (line,)
261
+
262
+ def update(frame):
263
+ line.set_data(
264
+ particle_speeds[:, :frame].flatten(),
265
+ particle_temperatures[:, :frame].flatten(),
266
+ )
267
+ line.set_3d_properties(np.tile(np.arange(frame), len(quark_masses)))
268
+ return (line,)
269
+
270
+ ani = FuncAnimation(fig, update, frames=num_steps, init_func=init, blit=True)
271
+ ani.save(f"big_bang_simulation_3d_{tunneling_probability}.gif", writer="pillow")
272
+ plt.show()
273
+
274
+ # --- Plotly Mass Evolution (3D) ---
275
+ X, Y = np.meshgrid(
276
+ particle_speeds[0], np.arange(num_steps)
277
+ ) # Create 2D meshgrid for x and y
278
+ fig = go.Figure(
279
+ data=[
280
+ go.Surface(
281
+ z=particle_masses_evolution[j],
282
+ x=X,
283
+ y=Y,
284
+ colorscale="Viridis",
285
+ name=quark.capitalize(),
286
+ )
287
+ for j, quark in enumerate(quark_masses.keys())
288
+ ]
289
+ )
290
+ fig.update_layout(
291
+ title=f"Big Bang Simulation: Mass Evolution (Tunneling Probability: {tunneling_probability})",
292
+ autosize=False,
293
+ width=800,
294
+ height=600,
295
+ margin=dict(l=65, r=50, b=65, t=90),
296
+ )
297
+ fig.show()
298
+
299
+ # --- Plotly Tunneling Effect (3D) ---
300
+ X, Y = np.meshgrid(
301
+ particle_speeds[0], np.arange(num_steps)
302
+ ) # Create 2D meshgrid for x and y
303
+ fig = go.Figure(
304
+ data=[
305
+ go.Surface(
306
+ z=tunneling_steps[j],
307
+ x=X,
308
+ y=Y,
309
+ colorscale="Blues",
310
+ name=quark.capitalize(),
311
+ )
312
+ for j, quark in enumerate(quark_masses.keys())
313
+ ]
314
+ )
315
+ fig.update_layout(
316
+ title=f"Big Bang Simulation: Tunneling Effect (Tunneling Probability: {tunneling_probability})",
317
+ autosize=False,
318
+ width=800,
319
+ height=600,
320
+ margin=dict(l=65, r=50, b=65, t=90),
321
+ )
322
+ fig.show()
323
+
324
+ # --- Correlation Analysis ---
325
+ df = pd.DataFrame(
326
+ {
327
+ "Speed": particle_speeds.flatten(),
328
+ "Temperature": particle_temperatures.flatten(),
329
+ "Mass": particle_masses_evolution.flatten(),
330
+ "Tunneling": tunneling_steps.flatten(),
331
+ }
332
+ )
333
+
334
+ correlation_matrix = df.corr()
335
+ correlation_matrices.append(correlation_matrix)
336
+
337
+ print("Correlation Matrix:")
338
+ print(correlation_matrix)
339
+
340
+ # Print calculated masses at the end of the simulation
341
+ print(
342
+ f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):"
343
+ )
344
+ for j, quark in enumerate(quark_masses.keys()):
345
+ print(f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
346
+ print("Real masses:")
347
+ for quark, mass in quark_masses.items():
348
+ print(f"{quark}: {mass:.4e} GeV")
349
+
350
+ # Save data to JSON file
351
+ data_filename = os.path.join(
352
+ data_dir, f"big_bang_simulation_data_{tunneling_probability:.1f}.json"
353
+ )
354
+ data = {
355
+ "tunneling_probability": tunneling_probability,
356
+ "particle_speeds": particle_speeds.tolist(),
357
+ "particle_temperatures": particle_temperatures.tolist(),
358
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
359
+ "tunneling_steps": tunneling_steps.tolist(),
360
+ "correlation_matrix": correlation_matrix.values.tolist(), # Use values.tolist() to convert DataFrame to list
361
+ }
362
+ with open(data_filename, "w") as f:
363
+ json.dump(data, f)
364
+
365
+ correlation_matrices = []
366
+ for tunneling_probability in tunneling_probabilities:
367
+ #... (rest of the code remains the same)
368
+ correlation_matrix = df.corr()
369
+ if correlation_matrix.shape[0] == correlation_matrix.shape[1]:
370
+ correlation_matrices.append(correlation_matrix)
371
+ else:
372
+ print(f"Skipping correlation matrix for tunneling probability {tunneling_probability} because it is not a square matrix.")
373
+
374
+ # Flatten the correlation matrices
375
+ flat_correlation_matrices = []
376
+ for i, matrix in enumerate(correlation_matrices):
377
+ flattened = matrix.values.flatten()
378
+ flat_correlation_matrices.append(flattened)
379
+
380
+ # Convert to 2D array
381
+ flat_correlation_matrices = np.array(flat_correlation_matrices)
382
+
383
+ # Create DataFrame with appropriate column names
384
+ columns = [f"Corr_{i}_{j}" for i in range(flat_correlation_matrices.shape[1] // 4) for j in range(4)]
385
+ correlation_matrices_df = pd.DataFrame(flat_correlation_matrices, columns=columns, index=tunneling_probabilities)
386
+
387
+ # Print or save DataFrame
388
+ print("Correlation Matrices for Different Tunneling Probabilities:")
389
+ print(correlation_matrices_df)
390
+
391
+
sim10.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.1056e-52 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = (
17
+ Hubble_constant * 1000 / 3.086e22
18
+ ) # Hubble constant in SI units (s^-1)
19
+
20
+ # Initial conditions
21
+ temperature_initial = 1.42e32 # Planck temperature in K
22
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
23
+ particle_speed_initial = c # Initially at the speed of light
24
+
25
+ # Simulation time
26
+ t_planck = 5.39e-44 # Planck time in s
27
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
28
+
29
+ # Quark masses (in GeV) - used for initial mass values and comparison
30
+ quark_masses = {
31
+ "up": 2.3e-3,
32
+ "down": 4.8e-3,
33
+ "charm": 1.28,
34
+ "strange": 0.095,
35
+ "top": 173.0,
36
+ "bottom": 4.18,
37
+ "electron": 5.11e-4,
38
+ "muon": 1.05e-1,
39
+ "tau": 1.78,
40
+ "photon": 0,
41
+ }
42
+
43
+ # Conversion factor from GeV to J
44
+ GeV_to_J = 1.60217662e-10
45
+
46
+ # Simulation setup
47
+ num_steps = int(t_simulation / t_planck)
48
+
49
+ # Tunneling probabilities to investigate
50
+ tunneling_probabilities = np.arange(0.1, 4.1, 0.1) # Exclude 1.0
51
+
52
+ # Create a directory to store the data
53
+ data_dir = "big_bang_simulation_data"
54
+ os.makedirs(data_dir, exist_ok=True)
55
+
56
+ # Functions to incorporate relativistic effects and collisions
57
+ def relativistic_energy(particle_speed, particle_mass):
58
+ if particle_speed >= c:
59
+ return np.inf
60
+ return particle_mass * c**2 / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
61
+
62
+
63
+ def relativistic_momentum(particle_speed, particle_mass):
64
+ if particle_speed >= c:
65
+ return np.inf
66
+ return (
67
+ particle_mass
68
+ * particle_speed
69
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
70
+ )
71
+
72
+
73
+ def update_speed(current_speed, current_temperature, particle_mass):
74
+ rel_momentum = relativistic_momentum(current_speed, particle_mass)
75
+ return c * np.sqrt(
76
+ max(1e-10, 1 - (rel_momentum / (rel_momentum + dark_energy_density)) ** 2)
77
+ )
78
+
79
+ def check_collision(particle_speeds, collision_distance):
80
+ # Assuming 1D for simplicity. Expand for 3D if needed.
81
+ for j in range(len(particle_speeds)):
82
+ for k in range(j+1, len(particle_speeds)):
83
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance:
84
+ return True, j, k
85
+ return False, -1, -1
86
+
87
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
88
+ for tunneling_probability in tunneling_probabilities:
89
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
90
+
91
+ # Initialize arrays for simulation
92
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
93
+ particle_temperatures = np.zeros(
94
+ (len(quark_masses), num_steps)
95
+ ) # 2D array for temperatures
96
+ particle_masses_evolution = np.zeros(
97
+ (len(quark_masses), num_steps)
98
+ ) # 2D array for mass evolution
99
+ tunneling_steps = np.zeros(
100
+ (len(quark_masses), num_steps), dtype=bool
101
+ ) # 2D array for tunneling steps
102
+
103
+ # Create an array of masses for each quark
104
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
105
+
106
+ for j, (quark, mass) in enumerate(quark_masses.items()):
107
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
108
+
109
+ for i in range(1, num_steps):
110
+ particle_speeds[j, i] = update_speed(
111
+ particle_speeds[j, i - 1],
112
+ particle_temperatures[j, i - 1],
113
+ particle_masses[j],
114
+ )
115
+
116
+ value = (
117
+ 1
118
+ - (particle_speeds[j, i] / (TSR * temperature_initial))
119
+ + dark_matter_density
120
+ )
121
+
122
+ if np.random.rand() < tunneling_probability:
123
+ particle_speeds[j, i] = particle_speeds[j, 0] # Tunneling effect
124
+ tunneling_steps[j, i] = True # Mark tunneling step
125
+
126
+ if value < 0:
127
+ value = 0
128
+
129
+ particle_temperatures[j, i] = (
130
+ alpha * particle_speeds[j, i] ** 2
131
+ ) # Apply TSR equation
132
+
133
+ # Update mass based on energy conversion
134
+ speed_squared_diff = (
135
+ particle_speeds[j, i] ** 2 - particle_speeds[j, i - 1] ** 2
136
+ )
137
+
138
+ # Avoid division by zero (if speed doesn't change, mass doesn't change)
139
+ if speed_squared_diff == 0:
140
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1]
141
+ else:
142
+ # Calculate the change in relativistic energy
143
+ energy_diff = relativistic_energy(
144
+ particle_speeds[j, i], particle_masses[j]
145
+ ) - relativistic_energy(particle_speeds[j, i - 1], particle_masses[j])
146
+
147
+ # Avoid NaN by checking if energy_diff is practically zero
148
+ if abs(energy_diff) < 1e-15: # Adjust the tolerance as needed
149
+ particle_masses_evolution[j, i] = particle_masses_evolution[
150
+ j, i - 1
151
+ ]
152
+ else:
153
+ # Update mass based on energy difference
154
+ new_mass = (
155
+ particle_masses_evolution[j, i - 1] + energy_diff / c**2
156
+ )
157
+ if np.isfinite(new_mass): # Check if the new mass is finite
158
+ particle_masses_evolution[j, i] = new_mass
159
+ else:
160
+ particle_masses_evolution[j, i] = particle_masses_evolution[
161
+ j, i - 1
162
+ ]
163
+
164
+ # Apply expansion of the universe (redshift)
165
+ particle_speeds[j, i] *= 1 - Hubble_constant_SI * t_planck
166
+
167
+ # Apply expansion of the universe (cooling)
168
+ particle_temperatures[j, i] *= 1 - Hubble_constant_SI * t_planck
169
+
170
+ # Check for collisions and handle them
171
+ collision, idx1, idx2 = check_collision(particle_speeds[:, i], collision_distance)
172
+ if collision:
173
+ # Simplified collision response: reverse speeds
174
+ particle_speeds[idx1, i], particle_speeds[idx2, i] = -particle_speeds[idx1, i], -particle_speeds[idx2, i]
175
+
176
+ # Print calculated masses at the end of the simulation
177
+ print(
178
+ f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):"
179
+ )
180
+ for j, quark in enumerate(quark_masses.keys()):
181
+ print(
182
+ f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV"
183
+ )
184
+
185
+ # Save data to JSON file
186
+ data_filename = os.path.join(
187
+ data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json"
188
+ )
189
+ data = {
190
+ "tunneling_probability": tunneling_probability,
191
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
192
+ "particle_speeds": particle_speeds.tolist(),
193
+ "particle_temperatures": particle_temperatures.tolist(),
194
+ "tunneling_steps": tunneling_steps.tolist()
195
+ }
196
+ with open(data_filename, "w") as f:
197
+ json.dump(data, f)
198
+
sim11.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = c # Initially at the speed of light
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Quark masses (in GeV) - used for initial mass values and comparison
28
+ quark_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ }
40
+
41
+ # Conversion factor from GeV to J
42
+ GeV_to_J = 1.60217662e-10
43
+
44
+ # Simulation setup
45
+ num_steps = int(t_simulation / t_planck)
46
+
47
+ # Tunneling probabilities to investigate
48
+ tunneling_probabilities = np.arange(99.1, 100.0, 0.1) # Exclude 1.0
49
+
50
+ # Create a directory to store the data
51
+ data_dir = "big_bang_simulation_data"
52
+ os.makedirs(data_dir, exist_ok=True)
53
+
54
+ # Functions to incorporate relativistic effects and collisions
55
+ def relativistic_energy(particle_speed, particle_mass):
56
+ epsilon = 1e-15 # A small value to avoid division by zero
57
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
58
+
59
+ def relativistic_momentum(particle_speed, particle_mass):
60
+ epsilon = 1e-15 # A small value to avoid division by zero
61
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
62
+
63
+ def update_speed(current_speed, current_temperature, particle_mass):
64
+ """Update the speed of a particle based on temperature and mass."""
65
+ rel_momentum = relativistic_momentum(current_speed, particle_mass)
66
+ epsilon = 1e-15 # A small value to avoid division by zero
67
+ return c * np.sqrt(1 - (rel_momentum / (rel_momentum + dark_energy_density + epsilon)) ** 2)
68
+
69
+ def check_collision(particle_speeds, collision_distance):
70
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
71
+ for j in range(len(particle_speeds)):
72
+ for k in range(j+1, len(particle_speeds)):
73
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
74
+ return True, j, k
75
+ return False, -1, -1
76
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2):
77
+ """Handle a collision between two particles."""
78
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
79
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
80
+
81
+ # Calculate velocities after collision using conservation of momentum
82
+ total_momentum = p1 + p2
83
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
84
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
85
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
86
+
87
+ particle_speeds[idx1], particle_speeds[idx2] = v1_new, v2_new
88
+
89
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
90
+ for tunneling_probability in tunneling_probabilities:
91
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
92
+
93
+ # Initialize arrays for simulation
94
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
95
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
96
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
97
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
98
+
99
+ # Create an array of masses for each quark
100
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
101
+
102
+ for j, (quark, mass) in enumerate(quark_masses.items()):
103
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
104
+
105
+ for i in range(1, num_steps):
106
+ particle_speeds[j, i] = update_speed(
107
+ particle_speeds[j, i - 1],
108
+ particle_temperatures[j, i - 1],
109
+ particle_masses[j]
110
+ )
111
+
112
+ # Apply tunneling effect
113
+ if np.random.rand() < tunneling_probability:
114
+ particle_speeds[j, i] = particle_speeds[j, 0]
115
+ tunneling_steps[j, i] = True
116
+
117
+ particle_temperatures[j, i] = alpha * particle_speeds[j, i] ** 2 # Apply TSR equation
118
+
119
+ # Update mass based on energy conversion
120
+ energy_diff = relativistic_energy(particle_speeds[j, i], particle_masses[j]) - relativistic_energy(particle_speeds[j, i - 1], particle_masses[j])
121
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1] + energy_diff / c**2
122
+
123
+ # Apply expansion of the universe
124
+ particle_speeds[j, i] *= 1 - Hubble_constant_SI * t_planck
125
+ particle_temperatures[j, i] *= 1 - Hubble_constant_SI * t_planck
126
+
127
+ # Check for collisions and handle them
128
+ collision, idx1, idx2 = check_collision(particle_speeds[:, i], collision_distance)
129
+ if collision:
130
+ handle_collision(particle_speeds[:, i], particle_masses, idx1, idx2)
131
+
132
+ # Print calculated masses at the end of the simulation
133
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
134
+ for j, quark in enumerate(quark_masses.keys()):
135
+ print(f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
136
+
137
+ # Save data to JSON file
138
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
139
+ data = {
140
+ "tunneling_probability": tunneling_probability,
141
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
142
+ "particle_speeds": particle_speeds.tolist(),
143
+ "particle_temperatures": particle_temperatures.tolist(),
144
+ "tunneling_steps": tunneling_steps.tolist()
145
+ }
146
+ with open(data_filename, "w") as f:
147
+ json.dump(data, f)
sim2.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = (
17
+ Hubble_constant * 1000 / 3.086e22
18
+ ) # Hubble constant in SI units (s^-1)
19
+
20
+ # Initial conditions
21
+ temperature_initial = 1.42e32 # Planck temperature in K
22
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
23
+ particle_speed_initial = c # Initially at the speed of light
24
+
25
+ # Simulation time
26
+ t_planck = 5.39e-44 # Planck time in s
27
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
28
+
29
+ # Quark masses (in GeV) - used for initial mass values and comparison
30
+ quark_masses = {
31
+ "up": 2.3e-3,
32
+ "down": 4.8e-3,
33
+ "charm": 1.28,
34
+ "strange": 0.095,
35
+ "top": 173.0,
36
+ "bottom": 4.18,
37
+ "electron": 5.11e-4,
38
+ "muon": 1.05e-1,
39
+ "tau": 1.78,
40
+ "photon": 0,
41
+ }
42
+
43
+ # Conversion factor from GeV to J
44
+ GeV_to_J = 1.60217662e-10
45
+
46
+ # Simulation setup
47
+ num_steps = int(t_simulation / t_planck)
48
+
49
+ # Tunneling probabilities to investigate
50
+ tunneling_probabilities = np.arange(0.01, 2.5, 0.1) # Adjust range as needed
51
+
52
+ # Create a directory to store the data
53
+ data_dir = "big_bang_simulation_data"
54
+ os.makedirs(data_dir, exist_ok=True)
55
+
56
+ # Functions to incorporate relativistic effects and collisions
57
+ def relativistic_energy(particle_speed, particle_mass):
58
+ if particle_speed >= c:
59
+ return np.inf
60
+ return particle_mass * c**2 / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
61
+
62
+ def relativistic_momentum(particle_speed, particle_mass):
63
+ if particle_speed >= c:
64
+ return np.inf
65
+ return (
66
+ particle_mass
67
+ * particle_speed
68
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
69
+ )
70
+
71
+ def update_speed(current_speed, current_temperature, particle_mass):
72
+ rel_momentum = relativistic_momentum(current_speed, particle_mass)
73
+ return c * np.sqrt(
74
+ max(1e-10, 1 - (rel_momentum / (rel_momentum + dark_energy_density)) ** 2)
75
+ )
76
+
77
+ def check_collision(particle_speeds, collision_distance):
78
+ # Assuming 1D for simplicity. Expand for 3D if needed.
79
+ for j in range(len(particle_speeds)):
80
+ for k in range(j + 1, len(particle_speeds)):
81
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance:
82
+ return True, j, k
83
+ return False, -1, -1
84
+
85
+ def handle_collision(particle_speeds, idx1, idx2):
86
+ # Exchange momentum for a simplified collision response
87
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
88
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
89
+
90
+ # Simplified exchange
91
+ particle_speeds[idx1], particle_speeds[idx2] = p2 / particle_masses
92
+ [idx1], p1 / particle_masses[idx2]
93
+
94
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
95
+ for tunneling_probability in tunneling_probabilities:
96
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
97
+
98
+ # Initialize arrays for simulation
99
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
100
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
101
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
102
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
103
+
104
+ # Create an array of masses for each quark
105
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
106
+
107
+ for j, (quark, mass) in enumerate(quark_masses.items()):
108
+ # Initialize particle speeds and temperatures
109
+ particle_speeds[j, 0] = particle_speed_initial
110
+ particle_temperatures[j, 0] = temperature_initial
111
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Convert to Joules
112
+
113
+ # Time evolution loop
114
+ for step in range(1, num_steps):
115
+ for j in range(len(quark_masses)):
116
+ # Update temperature based on some model (placeholder)
117
+ particle_temperatures[j, step] = particle_temperatures[j, step - 1] * 0.99 # Cooling down
118
+
119
+ # Update speed based on temperature and mass
120
+ particle_speeds[j, step] = update_speed(
121
+ particle_speeds[j, step - 1],
122
+ particle_temperatures[j, step],
123
+ particle_masses[j]
124
+ )
125
+
126
+ # Check for collisions
127
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, step], collision_distance)
128
+ if collision_detected:
129
+ handle_collision(particle_speeds[:, step], idx1, idx2)
130
+
131
+ # Tunneling effect (placeholder for actual physics)
132
+ if np.random.rand() < tunneling_probability:
133
+ tunneling_steps[j, step] = True
134
+ # Modify mass or speed based on tunneling (placeholder)
135
+ particle_masses[j] *= 1.1 # Increase mass as an example
136
+
137
+ # Store mass evolution
138
+ particle_masses_evolution[:, step] = particle_masses
139
+
140
+ # Save the simulation data for this tunneling probability
141
+ simulation_data = {
142
+ "particle_speeds": particle_speeds.tolist(), # Convert to list for JSON serialization
143
+ "particle_temperatures": particle_temperatures.tolist(), # Convert to list for JSON serialization
144
+ "particle_masses_evolution": particle_masses_evolution.tolist(), # Convert to list for JSON serialization
145
+ "tunneling_steps": tunneling_steps.tolist(), # Convert to list for JSON serialization
146
+ }
147
+
148
+ with open(os.path.join(data_dir, f"simulation_tunneling_{tunneling_probability:.2f}.json"), "w") as f:
149
+ json.dump(simulation_data, f)
150
+
151
+ print("Simulation completed and data saved.")
152
+
sim3.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import json
3
+ import os
4
+
5
+ # Constants
6
+ c = 299792458 # Speed of light in m/s
7
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
8
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
9
+ collision_distance = 1e-10 # Distance for collision detection
10
+
11
+ # Initial conditions
12
+ temperature_initial = 1.42e32 # Planck temperature in K
13
+ particle_speed_initial = c # Initially at the speed of light
14
+
15
+ # Simulation time
16
+ t_planck = 5.39e-44 # Planck time in s
17
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
18
+
19
+ # Quark masses (in GeV)
20
+ quark_masses = {
21
+ "up": 2.3e-3,
22
+ "down": 4.8e-3,
23
+ "charm": 1.28,
24
+ "strange": 0.095,
25
+ "top": 173.0,
26
+ "bottom": 4.18,
27
+ "electron": 5.11e-4,
28
+ "muon": 1.05e-1,
29
+ "tau": 1.78,
30
+ "photon": 0,
31
+ }
32
+
33
+ # Conversion factor from GeV to J
34
+ GeV_to_J = 1.60217662e-10
35
+
36
+ # Simulation setup
37
+ num_steps = int(t_simulation / t_planck)
38
+
39
+ # Create a directory to store the data
40
+ data_dir = "big_bang_simulation_data"
41
+ os.makedirs(data_dir, exist_ok=True)
42
+
43
+ # Functions to incorporate relativistic effects and collisions
44
+ def relativistic_momentum(particle_speed, particle_mass):
45
+ if particle_speed >= c:
46
+ return np.inf
47
+ return (
48
+ particle_mass
49
+ * particle_speed
50
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
51
+ )
52
+
53
+ def update_speed(current_speed, current_temperature, particle_mass):
54
+ # Placeholder for speed update logic
55
+ return current_speed # This should be replaced with actual logic
56
+
57
+ def check_collision(particle_speeds, collision_distance):
58
+ for j in range(len(particle_speeds)):
59
+ for k in range(j + 1, len(particle_speeds)):
60
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance:
61
+ return True, j, k
62
+ return False, -1, -1
63
+
64
+ def handle_collision(particle_speeds, idx1, idx2):
65
+ # Exchange momentum for a simplified collision response
66
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
67
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
68
+
69
+ # Simplified exchange of speeds based on momentum
70
+ particle_speeds[idx1] = p2 / particle_masses[idx1] # Update speed of particle 1
71
+ particle_speeds[idx2] = p1 / particle_masses[idx2] # Update speed of particle 2
72
+
73
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
74
+ for tunneling_probability in np.arange(0.01, 2.5, 0.1):
75
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
76
+
77
+ # Initialize arrays for simulation
78
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
79
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
80
+ np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
81
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
82
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
83
+
84
+ # Create an array of masses for each quark
85
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
86
+
87
+ for j, (quark, mass) in enumerate(quark_masses.items()):
88
+ # Initialize particle speeds and temperatures
89
+ particle_speeds[j, 0] = particle_speed_initial
90
+ particle_temperatures[j, 0] = temperature_initial
91
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Convert to Joules
92
+
93
+ # Time evolution loop
94
+ for step in range(1, num_steps):
95
+ for j in range(len(quark_masses)):
96
+ # Update temperature based on some model (placeholder)
97
+ particle_temperatures[j, step] = particle_temperatures[j, step - 1] * 0.99 # Cooling down
98
+
99
+ # Update speed based on temperature and mass
100
+ particle_speeds[j, step] = update_speed(
101
+ particle_speeds[j, step - 1],
102
+ particle_temperatures[j, step],
103
+ particle_masses[j]
104
+ )
105
+
106
+ # Check for collisions
107
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, step], collision_distance)
108
+ if collision_detected:
109
+ handle_collision(particle_speeds[:, step], idx1, idx2)
110
+
111
+ # Tunneling effect (placeholder for actual physics)
112
+ if np.random.rand() < tunneling_probability:
113
+ tunneling_steps[j, step] = True
114
+ # Modify mass or speed based on tunneling (placeholder)
115
+ particle_masses[j] *= 1.1 # Increase mass as an example
116
+
117
+ # Store mass evolution
118
+ particle_masses_evolution[:, step] = particle_masses
119
+
120
+ # Save the simulation data for this tunneling probability
121
+ simulation_data = {
122
+ "particle_speeds": particle_speeds.tolist(), # Convert to list for JSON serialization
123
+ "particle_temperatures": particle_temperatures.tolist(), # Convert to list for JSON serialization
124
+ "particle_masses_evolution": particle_masses_evolution.tolist(), # Convert to list for JSON serialization
125
+ "tunneling_steps": tunneling_steps.tolist(), # Convert to list for JSON serialization
126
+ }
127
+
128
+ with open(os.path.join(data_dir, f"simulation_tunneling_{tunneling_probability:.2f}.json"), "w") as f:
129
+ json.dump(simulation_data, f)
130
+
131
+ print("Simulation completed and data saved.")
132
+
sim8.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numba
3
+ from numba import cuda
4
+ import dask
5
+ from dask import delayed
6
+ from dask.diagnostics import ProgressBar
7
+ import time
8
+ from scipy.stats import norm
9
+
10
+ # Constants
11
+ c = 299792458 # Speed of light in m/s
12
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
13
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
14
+ alpha = 1.0 # Proportional constant for TSR
15
+ Q = 2 ** (1 / 12) # Fractal structure parameter
16
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
17
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
18
+ collision_distance = 1e-10 # Distance for collision detection
19
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
20
+ Hubble_constant_SI = (
21
+ Hubble_constant * 1000 / 3.086e22
22
+ ) # Hubble constant in SI units (s^-1)
23
+
24
+ # Initial conditions
25
+ temperature_initial = 1.42e32 # Planck temperature in K
26
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
27
+ particle_speed_initial = c # Initially at the speed of light
28
+
29
+ # Simulation time
30
+ t_planck = 5.39e-44 # Planck time in s
31
+ t_simulation = t_planck * 1e3 # Shorter timescale for simulation
32
+
33
+ # Quark masses (in GeV) - used for initial mass values and comparison
34
+ quark_masses = {
35
+ "up": 2.3e-3,
36
+ "down": 4.8e-3,
37
+ "charm": 1.28,
38
+ "strange": 0.095,
39
+ "top": 173.0,
40
+ "bottom": 4.18,
41
+ }
42
+
43
+ # **ASK FOR NUMBER OF PARTICLES**
44
+ while True:
45
+ try:
46
+ num_particles = int(input("Enter the number of particles (integer): "))
47
+ if num_particles <= 0:
48
+ print("Please enter a positive integer.")
49
+ else:
50
+ break
51
+ except ValueError:
52
+ print("Invalid input. Please enter an integer.")
53
+
54
+ # **ASK FOR TUNNELING PROBABILITY**
55
+ while True:
56
+ try:
57
+ tunneling_probability = float(input("Enter the tunneling probability (float, 0-1): "))
58
+ if 0 <= tunneling_probability <= 1:
59
+ break
60
+ else:
61
+ print("Please enter a value between 0 and 1.")
62
+ except ValueError:
63
+ print("Invalid input. Please enter a float.")
64
+
65
+ # Generate additional particles based on user input
66
+ additional_particles = {
67
+ f"new_quark_{i}": np.random.uniform(1e-3, 1e-1) for i in range(num_particles - len(quark_masses))
68
+ }
69
+
70
+ all_particles = {**quark_masses, **additional_particles}
71
+
72
+ # Conversion factor from GeV to J
73
+ GeV_to_J = 1.60217662e-10
74
+
75
+ # Simulation setup
76
+ num_steps = int(t_simulation / t_planck)
77
+
78
+ # CUDA kernel for simulation step
79
+ @cuda.jit
80
+ def simulation_step(particle_speeds, particle_temperatures, particle_masses, step, tunneling_probability):
81
+ tx = cuda.threadIdx.x
82
+ bx = cuda.blockIdx.x
83
+ bw = cuda.blockDim.x
84
+ i = tx + bx * bw
85
+
86
+ if i < num_particles:
87
+ # Update speed
88
+ particle_speeds[i] = update_speed(
89
+ particle_speeds[i], particle_temperatures[i], particle_masses[i]
90
+ )
91
+
92
+ # Apply tunneling probability
93
+ if np.random.rand() < tunneling_probability:
94
+ particle_speeds[i] = particle_speed_initial
95
+
96
+ # Update temperature
97
+ particle_temperatures[i] = alpha * particle_speeds[i] ** 2
98
+
99
+ # Simple collision detection (for demonstration; enhance as needed)
100
+ for j in range(num_particles):
101
+ if i != j:
102
+ # Collision logic here (omitted for brevity)
103
+ pass # Placeholder for collision logic
104
+
105
+ # CPU function for updating speed (example; optimize as necessary)
106
+ def update_speed(current_speed, current_temperature, particle_mass):
107
+ rel_momentum = relativistic_momentum(current_speed, particle_mass)
108
+ return c * np.sqrt(
109
+ max(1e-10, 1 - (rel_momentum / (rel_momentum + dark_energy_density)) ** 2)
110
+ )
111
+
112
+ # CPU function for relativistic momentum (example; optimize as necessary)
113
+ def relativistic_momentum(particle_speed, particle_mass):
114
+ if particle_speed >= c:
115
+ return np.inf
116
+ return (
117
+ particle_mass
118
+ * particle_speed
119
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
120
+ )
121
+
122
+ # Generate additional particles based on user input
123
+ additional_particles = {
124
+ f"new_quark_{i}": np.random.uniform(1e-3, 1e-1) for i in range(num_particles - len(quark_masses))
125
+ }
126
+
127
+ # Ensure that the number of particles is at least the number of quark masses
128
+ if num_particles < len(quark_masses):
129
+ print(f"Warning: Reducing the number of particles to {len(quark_masses)} to match quark masses.")
130
+ num_particles = len(quark_masses)
131
+
132
+ all_particles = {**quark_masses, **additional_particles}
133
+
134
+ # Initialize particle properties
135
+ initial_speeds = np.full(num_particles, particle_speed_initial, dtype=np.float64)
136
+ initial_temperatures = np.full(num_particles, temperature_initial, dtype=np.float64)
137
+
138
+ # Create an array of masses based on the number of particles
139
+ initial_masses = np.zeros(num_particles, dtype=np.float64)
140
+
141
+ # Fill initial_masses with quark masses and additional particles
142
+ for i, (key, mass) in enumerate(all_particles.items()):
143
+ if i < num_particles:
144
+ initial_masses[i] = mass
145
+
146
+ # Main simulation loop
147
+ def main_simulation(tunneling_probability):
148
+ # Memory allocation for simulation arrays
149
+ d_particle_speeds = cuda.device_array(num_particles, dtype=np.float64)
150
+ d_particle_temperatures = cuda.device_array(num_particles, dtype=np.float64)
151
+ d_particle_masses = cuda.device_array(num_particles, dtype=np.float64)
152
+
153
+ # Copy initial values to device
154
+ d_particle_speeds.copy_to_device(initial_speeds)
155
+ d_particle_temperatures.copy_to_device(initial_temperatures)
156
+ d_particle_masses.copy_to_device(initial_masses)
157
+
158
+ # Simulation loop
159
+ for step in range(num_steps):
160
+ simulation_step[1, num_particles](d_particle_speeds, d_particle_temperatures, d_particle_masses, step, tunneling_probability)
161
+
162
+ # Copy results back to host
163
+ h_particle_speeds = d_particle_speeds.copy_to_host()
164
+ h_particle_temperatures = d_particle_temperatures.copy_to_host()
165
+ h_particle_masses = d_particle_masses.copy_to_host()
166
+
167
+ return h_particle_speeds, h_particle_temperatures, h_particle_masses
168
+
169
+ if __name__ == "__main__":
170
+ start_time = time.time()
171
+ with ProgressBar():
172
+ task = delayed(main_simulation)(tunneling_probability)
173
+ result = task.compute()
174
+ end_time = time.time()
175
+ print(f"Simulation completed in {end_time - start_time} seconds")
176
+
177
+ # Process and visualize results as needed
178
+ particle_speeds, particle_temperatures, particle_masses = result
179
+ print("Final Particle Speeds:", particle_speeds)
180
+ print("Final Particle Temperatures:", particle_temperatures)
181
+ print("Final Particle Masses:", particle_masses)
sim9.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = (
17
+ Hubble_constant * 1000 / 3.086e22
18
+ ) # Hubble constant in SI units (s^-1)
19
+
20
+ # Initial conditions
21
+ temperature_initial = 1.42e32 # Planck temperature in K
22
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
23
+ particle_speed_initial = c # Initially at the speed of light
24
+
25
+ # Simulation time
26
+ t_planck = 5.39e-44 # Planck time in s
27
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
28
+
29
+ # Quark masses (in GeV) - used for initial mass values and comparison
30
+ quark_masses = {
31
+ "up": 2.3e-3,
32
+ "down": 4.8e-3,
33
+ "charm": 1.28,
34
+ "strange": 0.095,
35
+ "top": 173.0,
36
+ "bottom": 4.18,
37
+ "electron": 5.11e-4,
38
+ "muon": 1.05e-1,
39
+ "tau": 1.78,
40
+ "photon": 0,
41
+ }
42
+
43
+ # Conversion factor from GeV to J
44
+ GeV_to_J = 1.60217662e-10
45
+
46
+ # Simulation setup
47
+ num_steps = int(t_simulation / t_planck)
48
+
49
+ # Tunneling probabilities to investigate
50
+ tunneling_probabilities = np.arange(0.1, 1.1, 0.1) # Exclude 1.0
51
+
52
+ # Create a directory to store the data
53
+ data_dir = "big_bang_simulation_data"
54
+ os.makedirs(data_dir, exist_ok=True)
55
+
56
+ # Functions to incorporate relativistic effects
57
+ def relativistic_energy(particle_speed, particle_mass):
58
+ if particle_speed >= c:
59
+ return np.inf
60
+ return particle_mass * c**2 / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
61
+
62
+
63
+ def relativistic_momentum(particle_speed, particle_mass):
64
+ if particle_speed >= c:
65
+ return np.inf
66
+ return (
67
+ particle_mass
68
+ * particle_speed
69
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
70
+ )
71
+
72
+
73
+ def update_speed(current_speed, current_temperature, particle_mass):
74
+ rel_momentum = relativistic_momentum(current_speed, particle_mass)
75
+ return c * np.sqrt(
76
+ max(1e-10, 1 - (rel_momentum / (rel_momentum + dark_energy_density)) ** 2)
77
+ )
78
+
79
+
80
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
81
+ for tunneling_probability in tunneling_probabilities:
82
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
83
+
84
+ # Initialize arrays for simulation
85
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
86
+ particle_temperatures = np.zeros(
87
+ (len(quark_masses), num_steps)
88
+ ) # 2D array for temperatures
89
+ particle_masses_evolution = np.zeros(
90
+ (len(quark_masses), num_steps)
91
+ ) # 2D array for mass evolution
92
+ tunneling_steps = np.zeros(
93
+ (len(quark_masses), num_steps), dtype=bool
94
+ ) # 2D array for tunneling steps
95
+
96
+ # Create an array of masses for each quark
97
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
98
+
99
+ for j, (quark, mass) in enumerate(quark_masses.items()):
100
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
101
+
102
+ for i in range(1, num_steps):
103
+ particle_speeds[j, i] = update_speed(
104
+ particle_speeds[j, i - 1],
105
+ particle_temperatures[j, i - 1],
106
+ particle_masses[j],
107
+ )
108
+
109
+ value = (
110
+ 1
111
+ - (particle_speeds[j, i] / (TSR * temperature_initial))
112
+ + dark_matter_density
113
+ )
114
+
115
+ if np.random.rand() < tunneling_probability:
116
+ particle_speeds[j, i] = particle_speeds[j, 0] # Tunneling effect
117
+ tunneling_steps[j, i] = True # Mark tunneling step
118
+
119
+ if value < 0:
120
+ value = 0
121
+
122
+ particle_temperatures[j, i] = (
123
+ alpha * particle_speeds[j, i] ** 2
124
+ ) # Apply TSR equation
125
+
126
+ # Update mass based on energy conversion
127
+ speed_squared_diff = (
128
+ particle_speeds[j, i] ** 2 - particle_speeds[j, i - 1] ** 2
129
+ )
130
+
131
+ # Avoid division by zero (if speed doesn't change, mass doesn't change)
132
+ if speed_squared_diff == 0:
133
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1]
134
+ else:
135
+ # Calculate the change in relativistic energy
136
+ energy_diff = relativistic_energy(
137
+ particle_speeds[j, i], particle_masses[j]
138
+ ) - relativistic_energy(particle_speeds[j, i - 1], particle_masses[j])
139
+
140
+ # Avoid NaN by checking if energy_diff is practically zero
141
+ if abs(energy_diff) < 1e-15: # Adjust the tolerance as needed
142
+ particle_masses_evolution[j, i] = particle_masses_evolution[
143
+ j, i - 1
144
+ ]
145
+ else:
146
+ # Update mass based on energy difference
147
+ new_mass = (
148
+ particle_masses_evolution[j, i - 1] + energy_diff / c**2
149
+ )
150
+ if np.isfinite(new_mass): # Check if the new mass is finite
151
+ particle_masses_evolution[j, i] = new_mass
152
+ else:
153
+ particle_masses_evolution[j, i] = particle_masses_evolution[
154
+ j, i - 1
155
+ ]
156
+
157
+ # Apply expansion of the universe (redshift)
158
+ particle_speeds[j, i] *= 1 - Hubble_constant_SI * t_planck
159
+
160
+ # Apply expansion of the universe (cooling)
161
+ particle_temperatures[j, i] *= 1 - Hubble_constant_SI * t_planck
162
+
163
+ # Print calculated masses at the end of the simulation
164
+ print(
165
+ f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):"
166
+ )
167
+ for j, quark in enumerate(quark_masses.keys()):
168
+ print(
169
+ f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV"
170
+ )
171
+
172
+ # Save data to JSON file
173
+ data_filename = os.path.join(
174
+ data_dir, f"big_bang_simulation_data_{tunneling_probability:.1f}.json"
175
+ )
176
+ data = {
177
+ "tunneling_probability": tunneling_probability,
178
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
179
+ }
180
+ with open(data_filename, "w") as f:
181
+ json.dump(data, f)
simA.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ x = st.slider('Select a value')
4
+ st.write(x, 'squared is', x * x)
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+ import json
9
+ import os
10
+
11
+ # Constants
12
+ c = 299792458 # Speed of light in m/s
13
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
14
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
15
+ alpha = 1.0 # Proportional constant for TSR
16
+ Q = 2 ** (1 / 12) # Fractal structure parameter
17
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
18
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
19
+ collision_distance = 1e-10 # Distance for collision detection
20
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
21
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
22
+
23
+ # Initial conditions
24
+ temperature_initial = 1.0 # Planck temperature in K
25
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
26
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
27
+
28
+ # Simulation time
29
+ t_planck = 5.39e-44 # Planck time in s
30
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
31
+
32
+ # Quark masses (in GeV) - used for initial mass values and comparison
33
+ quark_masses = {
34
+ "up": 2.3e-3,
35
+ "down": 4.8e-3,
36
+ "charm": 1.28,
37
+ "strange": 0.095,
38
+ "top": 173.0,
39
+ "bottom": 4.18,
40
+ "electron": 5.11e-4,
41
+ "muon": 1.05e-1,
42
+ "tau": 1.78,
43
+ "photon": 0,
44
+ }
45
+
46
+ # Conversion factor from GeV to J
47
+ GeV_to_J = 1.60217662e-10
48
+
49
+ # Simulation setup
50
+ num_steps = int(t_simulation / t_planck)
51
+
52
+ # Tunneling probabilities to investigate
53
+ tunneling_probabilities = np.arange(0.000001, 150, 10)
54
+ # Create a directory to store the data
55
+ data_dir = "big_bang_simulation_data"
56
+ os.makedirs(data_dir, exist_ok=True)
57
+
58
+ # Functions to incorporate relativistic effects and collisions
59
+ def relativistic_energy(particle_speed, particle_mass):
60
+ epsilon = 1e-15 # A small value to avoid division by zero
61
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
62
+
63
+ def relativistic_momentum(particle_speed, particle_mass):
64
+ epsilon = 1e-15 # A small value to avoid division by zero
65
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
66
+
67
+ def update_speed(current_speed, current_temperature, particle_mass):
68
+ """Update the speed of a particle based on temperature and mass."""
69
+ return TSR * current_temperature # Update speed using TSR
70
+
71
+ def check_collision(particle_speeds, collision_distance):
72
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
73
+ for j in range(len(particle_speeds)):
74
+ for k in range(j+1, len(particle_speeds)):
75
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
76
+ return True, j, k
77
+ return False, -1, -1
78
+
79
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2):
80
+ """Handle a collision between two particles."""
81
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
82
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
83
+
84
+ # Calculate velocities after collision using conservation of momentum
85
+ total_momentum = p1 + p2
86
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
87
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
88
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
89
+
90
+ particle_speeds[idx1], particle_speeds[idx2] = v1_new, v2_new
91
+
92
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
93
+ for tunneling_probability in tunneling_probabilities:
94
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
95
+
96
+ # Initialize arrays for simulation
97
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
98
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
99
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
100
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
101
+
102
+ # Create an array of masses for each quark
103
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
104
+
105
+ for j, (quark, mass) in enumerate(quark_masses.items()):
106
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
107
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
108
+ particle_temperatures[j, 0] = temperature_initial # Initialize temperature
109
+
110
+ for i in range(1, num_steps):
111
+ # Update temperature based on expansion of the universe
112
+ particle_temperatures[j, i] = particle_temperatures[j, i-1] * (1 - Hubble_constant_SI * t_planck)
113
+
114
+ # Update speed using TSR
115
+ particle_speeds[j, i] = update_speed(particle_speeds[j, i-1], particle_temperatures[j, i], particle_masses[j])
116
+
117
+ # Apply tunneling effect
118
+ if np.random.rand() < tunneling_probability:
119
+ particle_speeds[j, i] = particle_speeds[j, 0]
120
+ tunneling_steps[j, i] = True
121
+
122
+ # Update mass based on energy conversion
123
+ energy_diff = relativistic_energy(particle_speeds[j, i], particle_masses[j]) - relativistic_energy(particle_speeds[j, i - 1], particle_masses[j])
124
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1] + energy_diff / c**2
125
+
126
+ # Check for collisions and handle them
127
+ collision, idx1, idx2 = check_collision(particle_speeds[:, i], collision_distance)
128
+ if collision:
129
+ handle_collision(particle_speeds[:, i], particle_masses, idx1, idx2)
130
+
131
+ # Print calculated masses at the end of the simulation
132
+ print(f"Calculated masses at the end of the simulation at the colision (Tunneling Probability: {tunneling_probability}):")
133
+ for j, quark in enumerate(quark_masses.keys()):
134
+ print(f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
135
+
136
+ # Save data to JSON file
137
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
138
+ data = {
139
+ "tunneling_probability": tunneling_probability,
140
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
141
+ "particle_speeds": particle_speeds.tolist(),
142
+ "particle_temperatures": particle_temperatures.tolist(),
143
+ "tunneling_steps": tunneling_steps.tolist()
144
+ }
145
+ with open(data_filename, "w") as f:
146
+ json.dump(data, f)
simAI.py ADDED
File without changes
simAZ.py ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Updated particle masses (in GeV)
28
+ particle_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ "electron_neutrino": 0, # Neutrinos have very small masses
40
+ "muon_neutrino": 0,
41
+ "tau_neutrino": 0,
42
+ "W_boson": 80.379,
43
+ "Z_boson": 91.1876,
44
+ "Higgs_boson": 125.1,
45
+ "gluon": 0, # Massless
46
+ "proton": 0.938,
47
+ "neutron": 0.939,
48
+ "pion_plus": 0.140,
49
+ "pion_zero": 0.135,
50
+ "kaon_plus": 0.494,
51
+ "kaon_zero": 0.498
52
+ }
53
+
54
+ # Conversion factor from GeV to J
55
+ GeV_to_J = 1.60217662e-10
56
+
57
+ # Simulation setup
58
+ num_steps = int(t_simulation / t_planck)
59
+
60
+ # Tunneling probabilities to investigate
61
+ tunneling_probabilities = np.arange(0.1, 1.5, 0.1) # Exclude 1.0
62
+
63
+ # Create a directory to store the data
64
+ data_dir = "big_bang_simulation_data"
65
+ os.makedirs(data_dir, exist_ok=True)
66
+
67
+ # Functions to incorporate relativistic effects and collisions
68
+ def relativistic_energy(particle_speed, particle_mass):
69
+ epsilon = 1e-15 # A small value to avoid division by zero
70
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
71
+
72
+ def relativistic_momentum(particle_speed, particle_mass):
73
+ epsilon = 1e-15 # A small value to avoid division by zero
74
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
75
+
76
+ def update_speed(current_speed, current_temperature, particle_mass):
77
+ """Update the speed of a particle based on temperature and mass."""
78
+ return TSR * current_temperature # Update speed using TSR
79
+
80
+ def check_collision(particle_speeds, collision_distance):
81
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
82
+ for j in range(len(particle_speeds)):
83
+ for k in range(j+1, len(particle_speeds)):
84
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
85
+ return True, j, k
86
+ return False, -1, -1
87
+
88
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2):
89
+ """Handle a collision between two particles."""
90
+ if particle_masses[idx1] == 0 or particle_masses[idx2] == 0:
91
+ # Skip handling collisions involving massless particles
92
+ return
93
+
94
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
95
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
96
+
97
+ # Calculate velocities after collision using conservation of momentum
98
+ total_momentum = p1 + p2
99
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
100
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
101
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
102
+
103
+ particle_speeds[idx1], particle_speeds[idx2] = v1_new, v2_new
104
+
105
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
106
+ for tunneling_probability in tunneling_probabilities:
107
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
108
+
109
+ # Initialize arrays for simulation
110
+ particle_speeds = np.zeros((len(particle_masses), num_steps)) # 2D array for speeds
111
+ particle_temperatures = np.zeros((len(particle_masses), num_steps)) # 2D array for temperatures
112
+ particle_masses_evolution = np.zeros((len(particle_masses), num_steps)) # 2D array for mass evolution
113
+ tunneling_steps = np.zeros((len(particle_masses), num_steps), dtype=bool) # 2D array for tunneling steps
114
+ particle_momentum = np.zeros((len(particle_masses), num_steps)) # 2D array for momentum
115
+ total_energy = np.zeros(num_steps) # 1D array for total energy of the system
116
+
117
+ # Create an array of masses for each particle
118
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
119
+
120
+ for j, (particle, mass) in enumerate(particle_masses.items()):
121
+ particle_masses_evolution[j, 0] = particle_masses_array[j] # Initialize mass
122
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
123
+ particle_temperatures[j, 0] = temperature_initial # Initialize temperature
124
+ particle_momentum[j, 0] = relativistic_momentum(particle_speeds[j, 0], particle_masses_array[j]) # Initialize momentum
125
+
126
+ for i in range(1, num_steps):
127
+ # Update temperature based on expansion of the universe
128
+ particle_temperatures[j, i] = particle_temperatures[j, i-1] * (1 - Hubble_constant_SI * t_planck)
129
+
130
+ # Update speed using TSR
131
+ particle_speeds[j, i] = update_speed(particle_speeds[j, i-1], particle_temperatures[j, i], particle_masses_array[j])
132
+
133
+ # Apply tunneling effect
134
+ if np.random.rand() < tunneling_probability:
135
+ particle_speeds[j, i] = particle_speeds[j, 0]
136
+ tunneling_steps[j, i] = True
137
+
138
+ # Update mass based on energy conversion
139
+ energy_diff = relativistic_energy(particle_speeds[j, i], particle_masses_array[j]) - relativistic_energy(particle_speeds[j, i - 1], particle_masses_array[j])
140
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1] + energy_diff / c**2
141
+
142
+ # Check for collisions and handle them
143
+ collision, idx1, idx2 = check_collision(particle_speeds[:, i], collision_distance)
144
+ if collision:
145
+ handle_collision(particle_speeds[:, i], particle_masses_array, idx1, idx2)
146
+
147
+ # Update momentum
148
+ particle_momentum[j, i] = relativistic_momentum(particle_speeds[j, i], particle_masses_array[j])
149
+
150
+ # Update total energy
151
+ total_energy[i] = np.sum([relativistic_energy(particle_speeds[k, i], particle_masses_array[k]) for k in range(len(particle_masses))])
152
+
153
+ # Print calculated masses at the end of the simulation
154
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
155
+ for j, particle in enumerate(particle_masses.keys()):
156
+ print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
157
+
158
+ # Save data to JSON file
159
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
160
+ data = {
161
+ "tunneling_probability": tunneling_probability,
162
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
163
+ "particle_speeds": particle_speeds.tolist(),
164
+ "particle_temperatures": particle_temperatures.tolist(),
165
+ "tunneling_steps": tunneling_steps.tolist(),
166
+ "particle_momentum": particle_momentum.tolist(),
167
+ "total_energy": total_energy.tolist()
168
+ }
169
+ with open(data_filename, "w") as f:
170
+ json.dump(data, f)
171
+
simB.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import json
3
+ import os
4
+
5
+ # Constants
6
+ c = 299792458 # Speed of light in m/s
7
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
8
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
9
+ collision_distance = 1e-10 # Distance for collision detection
10
+
11
+ # Initial conditions
12
+ temperature_initial = 1.42e32 # Planck temperature in K
13
+ particle_speed_initial = c # Initially at the speed of light
14
+
15
+ # Simulation time
16
+ t_planck = 5.39e-44 # Planck time in s
17
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
18
+
19
+ # Quark masses (in GeV)
20
+ quark_masses = {
21
+ "up": 2.3e-3,
22
+ "down": 4.8e-3,
23
+ "charm": 1.28,
24
+ "strange": 0.095,
25
+ "top": 173.0,
26
+ "bottom": 4.18,
27
+ "electron": 5.11e-4,
28
+ "muon": 1.05e-1,
29
+ "tau": 1.78,
30
+ "photon": 0,
31
+ }
32
+
33
+ # Conversion factor from GeV to J
34
+ GeV_to_J = 1.60217662e-10
35
+
36
+ # Simulation setup
37
+ num_steps = int(t_simulation / t_planck)
38
+
39
+ # Create a directory to store the data
40
+ data_dir = "big_bang_simulation_data"
41
+ os.makedirs(data_dir, exist_ok=True)
42
+
43
+ # Functions to incorporate relativistic effects and collisions
44
+ def relativistic_momentum(particle_speed, particle_mass):
45
+ if particle_speed >= c:
46
+ return np.inf
47
+ return (
48
+ particle_mass
49
+ * particle_speed
50
+ / np.sqrt(max(1e-10, 1 - (particle_speed / c) ** 2))
51
+ )
52
+
53
+ def update_speed(current_speed, current_temperature, particle_mass):
54
+ # Placeholder for speed update logic
55
+ return current_speed # This should be replaced with actual logic
56
+
57
+ def check_collision(particle_speeds, collision_distance):
58
+ for j in range(len(particle_speeds)):
59
+ for k in range(j + 1, len(particle_speeds)):
60
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance:
61
+ return True, j, k
62
+ return False, -1, -1
63
+
64
+ def handle_collision(particle_speeds, idx1, idx2):
65
+ # Exchange momentum for a simplified collision response
66
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
67
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
68
+
69
+ # Simplified exchange of speeds based on momentum
70
+ particle_speeds[idx1] = p2 / particle_masses[idx1] # Update speed of particle 1
71
+ particle_speeds[idx2] = p1 / particle_masses[idx2] # Update speed of particle 2
72
+
73
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
74
+ for tunneling_probability in np.arange(0.01, 2.5, 0.1):
75
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
76
+
77
+ # Initialize arrays for simulation
78
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
79
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
80
+ np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
81
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
82
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
83
+
84
+ # Create an array of masses for each quark
85
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
86
+
87
+ for j, (quark, mass) in enumerate(quark_masses.items()):
88
+ # Initialize particle speeds and temperatures
89
+ particle_speeds[j, 0] = particle_speed_initial
90
+ particle_temperatures[j, 0] = temperature_initial
91
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Convert to Joules
92
+
93
+ # Time evolution loop
94
+ for step in range(1, num_steps):
95
+ for j in range(len(quark_masses)):
96
+ # Update temperature based on some model (placeholder)
97
+ particle_temperatures[j, step] = particle_temperatures[j, step - 1] * 0.99 # Cooling down
98
+
99
+ # Update speed based on temperature and mass
100
+ particle_speeds[j, step] = update_speed(
101
+ particle_speeds[j, step - 1],
102
+ particle_temperatures[j, step],
103
+ particle_masses[j]
104
+ )
105
+
106
+ # Check for collisions
107
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, step], collision_distance)
108
+ if collision_detected:
109
+ handle_collision(particle_speeds[:, step], idx1, idx2)
110
+
111
+ # Tunneling effect (placeholder for actual physics)
112
+ if np.random.rand() < tunneling_probability:
113
+ tunneling_steps[j, step] = True
114
+ # Modify mass or speed based on tunneling (placeholder)
115
+ particle_masses[j] *= 1.1 # Increase mass as an example
116
+
117
+ # Store mass evolution
118
+ particle_masses_evolution[:, step] = particle_masses
119
+
120
+ # Save the simulation data for this tunneling probability
121
+ simulation_data = {
122
+ "particle_speeds": particle_speeds.tolist(), # Convert to list for JSON serialization
123
+ "particle_temperatures": particle_temperatures.tolist(), # Convert to list for JSON serialization
124
+ "particle_masses_evolution": particle_masses_evolution.tolist(), # Convert to list for JSON serialization
125
+ "tunneling_steps": tunneling_steps.tolist(), # Convert to list for JSON serialization
126
+ }
127
+
128
+ with open(os.path.join(data_dir, f"simulation_tunneling_{tunneling_probability:.2f}.json"), "w") as f:
129
+ json.dump(simulation_data, f)
130
+
131
+ print("Simulation completed and data saved.")
132
+
simC.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Particle masses (in GeV)
28
+ particle_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ "electron_neutrino": 0, # Neutrinos have very small masses
40
+ "muon_neutrino": 0,
41
+ "tau_neutrino": 0,
42
+ "W_boson": 80.379,
43
+ "Z_boson": 91.1876,
44
+ "Higgs_boson": 125.1,
45
+ "gluon": 0, # Massless
46
+ "proton": 0.938,
47
+ "neutron": 0.939,
48
+ "pion_plus": 0.140,
49
+ "pion_zero": 0.135,
50
+ "kaon_plus": 0.494,
51
+ "kaon_zero": 0.498
52
+ }
53
+
54
+ # Conversion factor from GeV to J
55
+ GeV_to_J = 1.60217662e-10
56
+
57
+ # Simulation setup
58
+ num_steps = int(t_simulation / t_planck)
59
+
60
+ # Tunneling probabilities to investigate
61
+ tunneling_probabilities = np.arange(0.001, 1.5, 0.001) # Exclude 1.0
62
+
63
+ # Create a directory to store the data
64
+ data_dir = "big_bang_simulation_data"
65
+ os.makedirs(data_dir, exist_ok=True)
66
+
67
+ # Functions to incorporate relativistic effects and collisions
68
+ def relativistic_energy(particle_speed, particle_mass):
69
+ epsilon = 1e-15 # A small value to avoid division by zero
70
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
71
+
72
+ def relativistic_momentum(particle_speed, particle_mass):
73
+ epsilon = 1e-15 # A small value to avoid division by zero
74
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
75
+
76
+ def update_speed(current_speed, current_temperature, particle_mass):
77
+ """Update the speed of a particle based on temperature and mass."""
78
+ return TSR * current_temperature # Update speed using TSR
79
+
80
+ def check_collision(particle_speeds, collision_distance, current_step):
81
+ for j in range(len(particle_speeds)):
82
+ for k in range(j+1, len(particle_speeds)):
83
+ if np.abs(particle_speeds[j][current_step] - particle_speeds[k][current_step]) < collision_distance:
84
+ return True, j, k
85
+ return False, -1, -1
86
+
87
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
88
+ """Handle a collision between two particles."""
89
+ p1 = relativistic_momentum(particle_speeds[idx1][current_step], particle_masses[idx1])
90
+ p2 = relativistic_momentum(particle_speeds[idx2][current_step], particle_masses[idx2])
91
+
92
+ # Calculate velocities after collision using conservation of momentum
93
+ total_momentum = p1 + p2
94
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
95
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
96
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
97
+
98
+ particle_speeds[idx1][current_step] = v1_new
99
+ particle_speeds[idx2][current_step] = v2_new
100
+
101
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
102
+ for tunneling_probability in tunneling_probabilities:
103
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
104
+
105
+ # Initialize arrays for simulation
106
+ num_particles = len(particle_masses)
107
+ particle_speeds = [[particle_speed_initial] * num_steps for _ in range(num_particles)]
108
+ particle_temperatures = [[temperature_initial] * num_steps for _ in range(num_particles)]
109
+ particle_masses_evolution = [[mass * GeV_to_J] * num_steps for mass in particle_masses.values()]
110
+ tunneling_steps = [[False] * num_steps for _ in range(num_particles)]
111
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
112
+
113
+ for current_step in range(1, num_steps):
114
+ for j in range(num_particles):
115
+ # Update temperature based on expansion of the universe
116
+ particle_temperatures[j][current_step] = particle_temperatures[j][current_step-1] * (1 - Hubble_constant_SI * t_planck)
117
+
118
+ # Update speed using TSR
119
+ particle_speeds[j][current_step] = update_speed(particle_speeds[j][current_step-1], particle_temperatures[j][current_step], particle_masses_array[j])
120
+
121
+ # Apply tunneling effect
122
+ if np.random.rand() < tunneling_probability:
123
+ particle_speeds[j][current_step] = particle_speeds[j][0]
124
+ tunneling_steps[j][current_step] = True
125
+
126
+ # Check for collisions
127
+ collision_detected, idx1, idx2 = check_collision(particle_speeds, collision_distance, current_step)
128
+ if collision_detected:
129
+ handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
130
+
131
+ # Calculate entropy using von Neumann entropy formula
132
+ for j in range(num_particles):
133
+ if particle_masses_array[j] == 0:
134
+ entropy = 0
135
+ else:
136
+ entropy = -particle_masses_array[j] * np.log1p(particle_masses_array[j])
137
+
138
+ # Update mass based on entropy
139
+ particle_masses_evolution[j][current_step] = particle_masses_evolution[j][current_step-1] + entropy / c**2
140
+
141
+ # Print calculated masses at the end of the simulation
142
+ print(f"Calculated masses at the end of the simulation using the von Neumann entropy (Tunneling Probability: {tunneling_probability}):")
143
+ for j, particle in enumerate(particle_masses.keys()):
144
+ print(f"{particle}: {particle_masses_evolution[j][-1] / GeV_to_J:.4e} GeV")
145
+
146
+ # Save data to JSON file
147
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
148
+ data = {
149
+ "tunneling_probability": tunneling_probability,
150
+ "particle_masses_evolution": particle_masses_evolution, # No need for tolist()
151
+ "particle_speeds": particle_speeds,
152
+ "particle_temperatures": particle_temperatures,
153
+ "tunneling_steps": tunneling_steps
154
+ }
155
+ with open(data_filename, "w") as f:
156
+ json.dump(data, f)
simD.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Updated particle masses (in GeV)
28
+ particle_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ "electron_neutrino": 0, # Neutrinos have very small masses
40
+ "muon_neutrino": 0,
41
+ "tau_neutrino": 0,
42
+ "W_boson": 80.379,
43
+ "Z_boson": 91.1876,
44
+ "Higgs_boson": 125.1,
45
+ "gluon": 0, # Massless
46
+ "proton": 0.938,
47
+ "neutron": 0.939,
48
+ "pion_plus": 0.140,
49
+ "pion_zero": 0.135,
50
+ "kaon_plus": 0.494,
51
+ "kaon_zero": 0.498
52
+ }
53
+
54
+ # Conversion factor from GeV to J
55
+ GeV_to_J = 1.60217662e-10
56
+
57
+ # Simulation setup
58
+ num_steps = int(t_simulation / t_planck)
59
+
60
+ # Tunneling probabilities to investigate
61
+ tunneling_probabilities = np.arange(0.1, 1.5, 0.1) # Exclude 1.0
62
+
63
+ # Create a directory to store the data
64
+ data_dir = "big_bang_simulation_data"
65
+ os.makedirs(data_dir, exist_ok=True)
66
+
67
+ # Functions to incorporate relativistic effects and collisions
68
+ def relativistic_energy(particle_speed, particle_mass):
69
+ epsilon = 1e-15 # A small value to avoid division by zero
70
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
71
+
72
+ def relativistic_momentum(particle_speed, particle_mass):
73
+ epsilon = 1e-15 # A small value to avoid division by zero
74
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
75
+
76
+ def update_speed(current_speed, current_temperature, particle_mass):
77
+ """Update the speed of a particle based on temperature and mass."""
78
+ return TSR * current_temperature # Update speed using TSR
79
+
80
+ def check_collision(particle_speeds, collision_distance):
81
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
82
+ for j in range(len(particle_speeds)):
83
+ for k in range(j+1, len(particle_speeds)):
84
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
85
+ return True, j, k
86
+ return False, -1, -1
87
+
88
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2):
89
+ """Handle a collision between two particles."""
90
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
91
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
92
+
93
+ # Calculate velocities after collision using conservation of momentum
94
+ total_momentum = p1 + p2
95
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
96
+
97
+ # Check for division by zero
98
+ if total_mass == 0:
99
+ # If total_mass is zero, set the velocities to zero
100
+ particle_speeds[idx1] = 0
101
+ particle_speeds[idx2] = 0
102
+ return
103
+
104
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
105
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
106
+
107
+ particle_speeds[idx1], particle_speeds[idx2] = v1_new, v2_new
108
+
109
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
110
+ for tunneling_probability in tunneling_probabilities:
111
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
112
+
113
+ # Initialize arrays for simulation
114
+ particle_speeds = np.zeros((len(particle_masses), num_steps)) # 2D array for speeds
115
+ particle_temperatures = np.zeros((len(particle_masses), num_steps)) # 2D array for temperatures
116
+ particle_masses_evolution = np.zeros((len(particle_masses), num_steps)) # 2D array for mass evolution
117
+ tunneling_steps = np.zeros((len(particle_masses), num_steps), dtype=bool) # 2D array for tunneling steps
118
+
119
+ # Create an array of masses for each particle
120
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
121
+
122
+ for j, (particle, mass) in enumerate(particle_masses.items()):
123
+ particle_masses_evolution[j, 0] = particle_masses_array[j] # Initialize mass
124
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
125
+ particle_temperatures[j, 0] = temperature_initial # Initialize temperature
126
+
127
+ for i in range(1, num_steps):
128
+ # Update temperature based on expansion of the universe
129
+ particle_temperatures[j, i] = particle_temperatures[j, i-1] * (1 - Hubble_constant_SI * t_planck)
130
+
131
+ # Update speed using TSR
132
+ particle_speeds[j, i] = update_speed(particle_speeds[j, i-1], particle_temperatures[j, i], particle_masses_array[j])
133
+
134
+ # Apply tunneling effect
135
+ if np.random.rand() < tunneling_probability:
136
+ particle_speeds[j, i] = particle_speeds[j, 0]
137
+ tunneling_steps[j, i] = True
138
+
139
+ # Update mass based on energy conversion
140
+ energy_diff = relativistic_energy(particle_speeds[j, i], particle_masses_array[j]) - relativistic_energy(particle_speeds[j, i - 1], particle_masses_array[j])
141
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1] + energy_diff / c**2
142
+
143
+ # Check for collisions and handle them
144
+ collision, idx1, idx2 = check_collision(particle_speeds[:, i], collision_distance)
145
+ if collision:
146
+ handle_collision(particle_speeds[:, i], particle_masses_array, idx1, idx2)
147
+
148
+ # Print calculated masses at the end of the simulation
149
+ print(f"Calculated masses at the end of the simulation at the colision (Tunneling Probability: {tunneling_probability}):")
150
+ for j, particle in enumerate(particle_masses.keys()):
151
+ print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
152
+
153
+ # Save data to JSON file
154
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
155
+ data = {
156
+ "tunneling_probability": tunneling_probability,
157
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
158
+ "particle_speeds": particle_speeds.tolist(),
159
+ "particle_temperatures": particle_temperatures.tolist(),
160
+ "tunneling_steps": tunneling_steps.tolist()
161
+ }
162
+ with open(data_filename, "w") as f:
163
+ json.dump(data, f)
simE.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Updated particle masses (in GeV)
28
+ particle_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ "electron_neutrino": 0, # Neutrinos have very small masses
40
+ "muon_neutrino": 0,
41
+ "tau_neutrino": 0,
42
+ "W_boson": 80.379,
43
+ "Z_boson": 91.1876,
44
+ "Higgs_boson": 125.1,
45
+ "gluon": 0, # Massless
46
+ "proton": 0.938,
47
+ "neutron": 0.939,
48
+ "pion_plus": 0.140,
49
+ "pion_zero": 0.135,
50
+ "kaon_plus": 0.494,
51
+ "kaon_zero": 0.498
52
+ }
53
+
54
+ # Conversion factor from GeV to J
55
+ GeV_to_J = 1.60217662e-10
56
+
57
+ # Simulation setup
58
+ num_steps = int(t_simulation / t_planck)
59
+
60
+ # Tunneling probabilities to investigate
61
+ tunneling_probabilities = np.arange(0.1, 1.5, 0.1) # Exclude 1.0
62
+
63
+ # Create a directory to store the data
64
+ data_dir = "big_bang_simulation_data"
65
+ os.makedirs(data_dir, exist_ok=True)
66
+
67
+ # Functions to incorporate relativistic effects and collisions
68
+ def relativistic_energy(particle_speed, particle_mass):
69
+ epsilon = 1e-15 # A small value to avoid division by zero
70
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
71
+
72
+ def relativistic_momentum(particle_speed, particle_mass):
73
+ epsilon = 1e-15 # A small value to avoid division by zero
74
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
75
+
76
+ def update_speed(current_speed, current_temperature, particle_mass):
77
+ """Update the speed of a particle based on temperature and mass."""
78
+ return TSR * current_temperature # Update speed using TSR
79
+
80
+ def check_collision(particle_speeds, collision_distance):
81
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
82
+ for j in range(len(particle_speeds)):
83
+ for k in range(j+1, len(particle_speeds)):
84
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
85
+ return True, j, k
86
+ return False, -1, -1
87
+
88
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2, current_step):
89
+ """Handle a collision between two particles."""
90
+ if particle_masses[idx1] == 0 or particle_masses[idx2] == 0:
91
+ # Skip handling collisions involving massless particles
92
+ return
93
+
94
+ p1 = relativistic_momentum(particle_speeds[idx1, current_step], particle_masses[idx1])
95
+ p2 = relativistic_momentum(particle_speeds[idx2, current_step], particle_masses[idx2])
96
+
97
+ # Calculate velocities after collision using conservation of momentum
98
+ total_momentum = p1 + p2
99
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
100
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
101
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
102
+
103
+ particle_speeds[idx1, current_step], particle_speeds[idx2, current_step] = v1_new, v2_new
104
+
105
+
106
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, Relativistic Effects, Redshift, and Entanglement
107
+ for tunneling_probability in tunneling_probabilities:
108
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
109
+
110
+ # Initialize arrays for simulation
111
+ num_particles = len(particle_masses)
112
+ particle_speeds = np.zeros((num_particles, num_steps)) # 2D array for speeds
113
+ particle_temperatures = np.zeros((num_particles, num_steps)) # 2D array for temperatures
114
+ particle_masses_evolution = np.zeros((num_particles, num_steps)) # 2D array for mass evolution
115
+ tunneling_steps = np.zeros((num_particles, num_steps), dtype=bool) # 2D array for tunneling steps
116
+ particle_momentum = np.zeros((num_particles, num_steps)) # 2D array for momentum
117
+ total_energy = np.zeros(num_steps) # 1D array for total energy of the system
118
+ redshifts = np.zeros((num_particles, num_steps)) # 2D array for redshift
119
+ entanglement_entropies = np.zeros((num_particles, num_steps)) # 2D array for entanglement entropy
120
+ particle_states = np.random.rand(num_particles, num_steps) # Placeholder for particle states
121
+
122
+ # Create an array of masses for each particle
123
+ particle_masses_array = np.array([mass * GeV_to_J for mass in particle_masses.values()])
124
+
125
+ for j, (particle, mass) in enumerate(particle_masses.items()):
126
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
127
+ particle_masses_evolution[j, 0] = mass * GeV_to_J # Initialize mass evolution
128
+
129
+ for current_step in range(1, num_steps):
130
+ for j in range(num_particles):
131
+ # Update temperature based on expansion of the universe
132
+ particle_temperatures[j, current_step] = particle_temperatures[j, current_step-1] * (1 - Hubble_constant_SI * t_planck)
133
+
134
+ # Update speed using TSR
135
+ particle_speeds[j, current_step] = update_speed(particle_speeds[j, current_step-1], particle_temperatures[j, current_step], particle_masses_array[j])
136
+
137
+ # Apply tunneling effect
138
+ if np.random.rand() < tunneling_probability:
139
+ particle_speeds[j, current_step] = particle_speeds[j, 0]
140
+ tunneling_steps[j, current_step] = True
141
+
142
+ # Calculate redshift
143
+ redshifts[j, current_step] = (1 + particle_speeds[j, current_step] / c)
144
+
145
+ # Calculate entanglement entropy
146
+ entanglement_entropies[j, current_step] = -np.sum(particle_states[j, current_step] * np.log(particle_states[j, current_step]))
147
+
148
+ # Update mass evolution
149
+ particle_masses_evolution[j, current_step] = particle_masses_evolution[j, current_step-1] * (1 - dark_energy_density * t_planck)
150
+
151
+ # Check for collisions
152
+ collision_detected, idx1, idx2 = check_collision(particle_speeds[:, current_step], collision_distance)
153
+ if collision_detected:
154
+ handle_collision(particle_speeds, particle_masses_array, idx1, idx2, current_step)
155
+
156
+ # Print calculated masses at the end of the simulation
157
+ print(f"Calculated masses at the end of the simulation (Tunneling Probability: {tunneling_probability}):")
158
+ for j, particle in enumerate(particle_masses.keys()):
159
+ print(f"{particle}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
160
+
161
+ # Save data to JSON file
162
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
163
+ data = {
164
+ "tunneling_probability": tunneling_probability,
165
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
166
+ "particle_speeds": particle_speeds.tolist(),
167
+ "particle_temperatures": particle_temperatures.tolist(),
168
+ "tunneling_steps": tunneling_steps.tolist(),
169
+ "redshifts": redshifts.tolist(),
170
+ "entanglement_entropies": entanglement_entropies.tolist()
171
+ }
172
+ with open(data_filename, "w") as f:
173
+ json.dump(data, f)
simZ.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import json
4
+ import os
5
+
6
+ # Constants
7
+ c = 299792458 # Speed of light in m/s
8
+ E_mc2 = c**2 # Mass-energy equivalence in J/kg
9
+ TSR = E_mc2 / (1.38e-23) # Temperature to Speed Ratio in K/m/s
10
+ alpha = 1.0 # Proportional constant for TSR
11
+ Q = 2 ** (1 / 12) # Fractal structure parameter
12
+ dark_energy_density = 5.96e-27 # Density of dark energy in kg/m^3
13
+ dark_matter_density = 2.25e-27 # Density of dark matter in kg/m^3
14
+ collision_distance = 1e-10 # Distance for collision detection
15
+ Hubble_constant = 70.0 # km/s/Mpc (approximation)
16
+ Hubble_constant_SI = Hubble_constant * 1000 / 3.086e22 # Convert to SI units (s^-1)
17
+
18
+ # Initial conditions
19
+ temperature_initial = 1.0 # Planck temperature in K
20
+ particle_density_initial = 5.16e96 # Planck density in kg/m^3
21
+ particle_speed_initial = TSR * temperature_initial # Initial speed based on TSR
22
+
23
+ # Simulation time
24
+ t_planck = 5.39e-44 # Planck time in s
25
+ t_simulation = t_planck * 1e5 # Shorter timescale for simulation
26
+
27
+ # Quark masses (in GeV) - used for initial mass values and comparison
28
+ quark_masses = {
29
+ "up": 2.3e-3,
30
+ "down": 4.8e-3,
31
+ "charm": 1.28,
32
+ "strange": 0.095,
33
+ "top": 173.0,
34
+ "bottom": 4.18,
35
+ "electron": 5.11e-4,
36
+ "muon": 1.05e-1,
37
+ "tau": 1.78,
38
+ "photon": 0,
39
+ }
40
+
41
+ # Conversion factor from GeV to J
42
+ GeV_to_J = 1.60217662e-10
43
+
44
+ # Simulation setup
45
+ num_steps = int(t_simulation / t_planck)
46
+
47
+ # Tunneling probabilities to investigate
48
+ tunneling_probabilities = np.arange(0.1, 1.5, 0.1) # Exclude 1.0
49
+
50
+ # Create a directory to store the data
51
+ data_dir = "big_bang_simulation_data"
52
+ os.makedirs(data_dir, exist_ok=True)
53
+
54
+ # Functions to incorporate relativistic effects and collisions
55
+ def relativistic_energy(particle_speed, particle_mass):
56
+ epsilon = 1e-15 # A small value to avoid division by zero
57
+ return particle_mass * c**2 / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
58
+
59
+ def relativistic_momentum(particle_speed, particle_mass):
60
+ epsilon = 1e-15 # A small value to avoid division by zero
61
+ return particle_mass * particle_speed / np.sqrt(max(1e-15, 1 - (particle_speed / c) ** 2 + epsilon))
62
+
63
+ def update_speed(current_speed, current_temperature, particle_mass):
64
+ """Update the speed of a particle based on temperature and mass."""
65
+ return TSR * current_temperature # Update speed using TSR
66
+
67
+ def check_collision(particle_speeds, collision_distance):
68
+ epsilon = 1e-15 # A small value to avoid invalid subtraction
69
+ for j in range(len(particle_speeds)):
70
+ for k in range(j+1, len(particle_speeds)):
71
+ if np.abs(particle_speeds[j] - particle_speeds[k]) < collision_distance + epsilon:
72
+ return True, j, k
73
+ return False, -1, -1
74
+
75
+ def handle_collision(particle_speeds, particle_masses, idx1, idx2):
76
+ """Handle a collision between two particles."""
77
+ p1 = relativistic_momentum(particle_speeds[idx1], particle_masses[idx1])
78
+ p2 = relativistic_momentum(particle_speeds[idx2], particle_masses[idx2])
79
+
80
+ # Calculate velocities after collision using conservation of momentum
81
+ total_momentum = p1 + p2
82
+ total_mass = particle_masses[idx1] + particle_masses[idx2]
83
+ v1_new = (total_momentum / total_mass) * (particle_masses[idx1] / total_mass)
84
+ v2_new = (total_momentum / total_mass) * (particle_masses[idx2] / total_mass)
85
+
86
+ particle_speeds[idx1], particle_speeds[idx2] = v1_new, v2_new
87
+
88
+ # Simulate the Big Bang with Dark Energy, Dark Matter, Tunneling, and Relativistic Effects
89
+ for tunneling_probability in tunneling_probabilities:
90
+ print(f"Simulating for tunneling probability: {tunneling_probability}")
91
+
92
+ # Initialize arrays for simulation
93
+ particle_speeds = np.zeros((len(quark_masses), num_steps)) # 2D array for speeds
94
+ particle_temperatures = np.zeros((len(quark_masses), num_steps)) # 2D array for temperatures
95
+ particle_masses_evolution = np.zeros((len(quark_masses), num_steps)) # 2D array for mass evolution
96
+ tunneling_steps = np.zeros((len(quark_masses), num_steps), dtype=bool) # 2D array for tunneling steps
97
+
98
+ # Create an array of masses for each quark
99
+ particle_masses = np.array([mass * GeV_to_J for mass in quark_masses.values()])
100
+
101
+ for j, (quark, mass) in enumerate(quark_masses.items()):
102
+ particle_masses_evolution[j, 0] = particle_masses[j] # Initialize mass
103
+ particle_speeds[j, 0] = particle_speed_initial # Initialize speed
104
+ particle_temperatures[j, 0] = temperature_initial # Initialize temperature
105
+
106
+ for i in range(1, num_steps):
107
+ # Update temperature based on expansion of the universe
108
+ particle_temperatures[j, i] = particle_temperatures[j, i-1] * (1 - Hubble_constant_SI * t_planck)
109
+
110
+ # Update speed using TSR
111
+ particle_speeds[j, i] = update_speed(particle_speeds[j, i-1], particle_temperatures[j, i], particle_masses[j])
112
+
113
+ # Apply tunneling effect
114
+ if np.random.rand() < tunneling_probability:
115
+ particle_speeds[j, i] = particle_speeds[j, 0]
116
+ tunneling_steps[j, i] = True
117
+
118
+ # Update mass based on energy conversion
119
+ energy_diff = relativistic_energy(particle_speeds[j, i], particle_masses[j]) - relativistic_energy(particle_speeds[j, i - 1], particle_masses[j])
120
+ particle_masses_evolution[j, i] = particle_masses_evolution[j, i - 1] + energy_diff / c**2
121
+
122
+ # Check for collisions and handle them
123
+ collision, idx1, idx2 = check_collision(particle_speeds[:, i], collision_distance)
124
+ if collision:
125
+ handle_collision(particle_speeds[:, i], particle_masses, idx1, idx2)
126
+
127
+ # Print calculated masses at the end of the simulation
128
+ print(f"Calculated masses at the end of the simulation at the colision (Tunneling Probability: {tunneling_probability}):")
129
+ for j, quark in enumerate(quark_masses.keys()):
130
+ print(f"{quark}: {particle_masses_evolution[j, -1] / GeV_to_J:.4e} GeV")
131
+
132
+ # Save data to JSON file
133
+ data_filename = os.path.join(data_dir, f"big_bang_simulation_data_{tunneling_probability:.2f}.json")
134
+ data = {
135
+ "tunneling_probability": tunneling_probability,
136
+ "particle_masses_evolution": particle_masses_evolution.tolist(),
137
+ "particle_speeds": particle_speeds.tolist(),
138
+ "particle_temperatures": particle_temperatures.tolist(),
139
+ "tunneling_steps": tunneling_steps.tolist()
140
+ }
141
+ with open(data_filename, "w") as f:
142
+ json.dump(data, f)
sting.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+
4
+ # Constants
5
+ c = 299792458 # Speed of light in m/s
6
+ hbar = 1.0545718e-34 # Reduced Planck constant in J·s
7
+ alpha = 1.0 # Fine-structure constant
8
+
9
+ # Define string properties
10
+ string_length = 1e-35 # Length of the string in meters
11
+ string_tension = 1e30 # Tension of the string in N
12
+
13
+ # Define initial conditions
14
+ initial_position = 0.0 # Initial position of the string
15
+ initial_velocity = 1e6 # Initial velocity of the string
16
+
17
+ # Simulation parameters
18
+ time_step = 5.39e-44 * 1e3 # Time step for the simulation
19
+ total_time = 5.39e-44 # Total simulation time
20
+
21
+ # Initialize arrays to store position and velocity data
22
+ num_steps = int(total_time / time_step) + 1
23
+ position = np.zeros(num_steps)
24
+ velocity = np.zeros(num_steps)
25
+
26
+ # Set initial conditions
27
+ position[0] = initial_position
28
+ velocity[0] = initial_velocity
29
+
30
+ # Main simulation loop
31
+ for i in range(1, num_steps):
32
+ # Calculate acceleration using string equation of motion
33
+ acceleration = -(string_tension / hbar) * position[i - 1]
34
+
35
+ # Update velocity and position
36
+ velocity[i] = velocity[i - 1] + acceleration * time_step
37
+ position[i] = position[i - 1] + velocity[i] * time_step
38
+
39
+ # Plot the results
40
+ plt.figure(figsize=(10, 6))
41
+ plt.plot(np.arange(num_steps) * time_step, position, label="String Position")
42
+ plt.xlabel("Time (s)")
43
+ plt.ylabel("Position (m)")
44
+ plt.title("String Evolution in Time")
45
+ plt.grid(True)
46
+ plt.legend()
47
+ plt.show()
48
+
str.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+
4
+ # Constants
5
+ c = 299792458 # Speed of light in m/s
6
+ hbar = 1.0545718e-34 # Reduced Planck constant in J·s
7
+ alpha = 1.0 # Fine-structure constant
8
+
9
+ # Define string properties
10
+ string_length = 1e-35 # Length of the string in meters
11
+ string_tension = 1e30 # Tension of the string in N
12
+
13
+ # Define initial conditions
14
+ initial_position = 0.0 # Initial position of the string
15
+ initial_velocity = 1e6 # Initial velocity of the string
16
+
17
+ # Simulation parameters
18
+ time_step = 5.39e-44 * 1e3 # Time step for the simulation
19
+ total_time = 1e-40 # Extended total simulation time
20
+
21
+ # Initialize arrays to store position and velocity data
22
+ num_steps = int(total_time / time_step) + 1
23
+ position = np.zeros(num_steps)
24
+ velocity = np.zeros(num_steps)
25
+
26
+ # Set initial conditions
27
+ position[0] = initial_position
28
+ velocity[0] = initial_velocity
29
+
30
+ # Main simulation loop
31
+ for i in range(1, num_steps):
32
+ # Calculate acceleration using string equation of motion
33
+ acceleration = -(string_tension / hbar) * position[i - 1]
34
+
35
+ # Update velocity and position
36
+ velocity[i] = velocity[i - 1] + acceleration * time_step
37
+ position[i] = position[i - 1] + velocity[i] * time_step
38
+
39
+ # Plot the results
40
+ plt.figure(figsize=(10, 6))
41
+ plt.plot(np.arange(num_steps) * time_step, position, label="String Position")
42
+ plt.xlabel("Time (s)")
43
+ plt.ylabel("Position (m)")
44
+ plt.title("String Evolution in Time")
45
+ plt.grid(True)
46
+ plt.legend()
47
+ plt.show()
48
+
test.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ from matplotlib.animation import FuncAnimation
4
+ import cupy as cp
5
+ from tqdm import tqdm
6
+ import plotly.graph_objects as go
7
+ import streamlit as st
8
+
9
+ x = st.slider('Select a value')
10
+ st.write(x, 'squared is', x * x)
11
+
12
+ # Define the twelfth root of two
13
+ Q = 2 ** (1/12)
14
+
15
+ # Define the wave function of the universe with variants (using CuPy)
16
+ def wave_function_cupy(x, t, scale=1.0, phase_shift=0.0):
17
+ denominator = 2 * (t**2 + 1e-10) # Add a small value to avoid division by zero
18
+ return scale * Q * cp.exp(-x**2 / denominator) * cp.exp(-1j * (t + phase_shift))
19
+
20
+ # Simulation parameters
21
+ x = np.linspace(-10, 10, 100)
22
+ t = np.linspace(0, 10, 100)
23
+ X, T = np.meshgrid(x, t)
24
+
25
+ # Convert numpy arrays to CuPy arrays
26
+ X_cupy = cp.asarray(X)
27
+ T_cupy = cp.asarray(T)
28
+
29
+ # Variants parameters
30
+ scales = [0.5, 1.0, 1.5] # Different scaling factors
31
+ phase_shifts = [0, np.pi/4, np.pi/2] # Different phase shifts
32
+
33
+ # Initialize a 3D array to store results
34
+ wave_functions_3d = np.zeros((len(scales), len(phase_shifts), len(x), len(t)), dtype=complex)
35
+
36
+ # Simulate with variants and store results in the 3D array
37
+ for i, scale in enumerate(scales):
38
+ for j, phase_shift in enumerate(phase_shifts):
39
+ wave_functions_3d[i, j, :, :] = cp.asnumpy(wave_function_cupy(X_cupy, T_cupy, scale, phase_shift))
40
+
41
+ # --- Plotly Interactive Visualization ---
42
+
43
+ # Create the figure
44
+ fig = go.Figure(data=[
45
+ go.Surface(x=x, y=t, z=np.abs(wave_functions_3d[0, 0, :, :])**2)
46
+ ])
47
+
48
+ fig.update_layout(
49
+ title="Wave Function of the Universe",
50
+ scene=dict(
51
+ xaxis_title="x",
52
+ yaxis_title="t",
53
+ zaxis_title="|ψ(x,t)|^2"
54
+ ),
55
+ )
56
+
57
+ # Add Scale Slider
58
+ fig.update_layout(
59
+ sliders=[
60
+ dict(
61
+ active=True,
62
+ currentvalue=dict(
63
+ prefix="Scale: ",
64
+ font=dict(size=12)
65
+ ),
66
+ steps=[
67
+ dict(
68
+ method="update",
69
+ args=[
70
+ {"z": [np.abs(wave_functions_3d[i, 0, :, :])**2]} # Update z data
71
+ ],
72
+ label=f"Scale: {scales[i]:.2f}" # Label for step values
73
+ ) for i in range(len(scales))
74
+ ],
75
+ pad=dict(t=50),
76
+ len=0.9, # Length of the slider
77
+ x=0.1, # X position of the slider
78
+ y=0.1, # Y position of the slider
79
+ ),
80
+ dict(
81
+ active=True,
82
+ currentvalue=dict(
83
+ prefix="Phase Shift: ",
84
+ font=dict(size=12)
85
+ ),
86
+ steps=[
87
+ dict(
88
+ method="update",
89
+ args=[
90
+ {"z": [np.abs(wave_functions_3d[0, j, :, :])**2]} # Update z data
91
+ ],
92
+ label=f"Phase Shift: {phase_shifts[j]:.2f}" # Label for step values
93
+ ) for j in range(len(phase_shifts))
94
+ ],
95
+ pad=dict(t=50),
96
+ len=0.9, # Length of the slider
97
+ x=0.1, # X position of the slider
98
+ y=0.3, # Y position of the slider
99
+ )
100
+ ]
101
+ )
102
+
103
+ fig.show()
104
+
105
+ # --- End of Plotly ---
106
+
107
+ # --- Matplotlib Animation ---
108
+
109
+ # Animation
110
+ fig, ax = plt.subplots()
111
+ im = ax.imshow(np.abs(wave_functions_3d[0, 0, :, :]) ** 2, extent=[-10, 10, 0, 10], aspect='auto', cmap='viridis')
112
+ ax.set_xlabel('x')
113
+ ax.set_ylabel('t')
114
+ ax.set_title('Wave Function of the Universe')
115
+ cbar = fig.colorbar(im, ax=ax, label='|ψ(x,t)|^2')
116
+
117
+ def update(frame):
118
+ i, j = divmod(frame, len(phase_shifts)) # Get the index for the 3D array
119
+ im.set_array(np.abs(wave_functions_3d[i, j, :, :]) ** 2) # Update with the correct frame
120
+ ax.set_title(f'Wave Function at Scale: {scales[i]}, Phase Shift: {phase_shifts[j]:.2f}')
121
+ return im,
122
+
123
+ ani = FuncAnimation(fig, update, frames=len(scales) * len(phase_shifts), blit=True)
124
+ ani.save('wave_function_animation.gif', writer='pillow')
125
+ plt.show()
wave_function_animation.gif ADDED