67oi678y commited on
Commit
5978da9
·
verified ·
1 Parent(s): 4506dfb

make a website where I can find the quantum state of a particle

Browse files
Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +345 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Quantum State Explorer
3
- emoji:
4
- colorFrom: red
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Quantum State Explorer 🌀
3
+ colorFrom: green
4
+ colorTo: green
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
index.html CHANGED
@@ -1,19 +1,346 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Quantum State Explorer</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/feather-icons"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/three@0.121.1/build/three.min.js"></script>
11
+ <style>
12
+ .quantum-orb {
13
+ transition: all 0.5s ease;
14
+ }
15
+ .particle-path {
16
+ stroke-dasharray: 1000;
17
+ stroke-dashoffset: 1000;
18
+ animation: dash 5s linear forwards infinite;
19
+ }
20
+ @keyframes dash {
21
+ to {
22
+ stroke-dashoffset: 0;
23
+ }
24
+ }
25
+ .wave-function {
26
+ background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(124,58,237,0.5) 50%, rgba(255,255,255,0) 100%);
27
+ height: 2px;
28
+ width: 100%;
29
+ position: absolute;
30
+ bottom: 0;
31
+ animation: pulse 3s ease-in-out infinite;
32
+ }
33
+ @keyframes pulse {
34
+ 0%, 100% { opacity: 0.3; }
35
+ 50% { opacity: 1; }
36
+ }
37
+ </style>
38
+ </head>
39
+ <body class="bg-gray-900 text-white min-h-screen overflow-x-hidden" id="vanta-bg">
40
+ <div class="container mx-auto px-4 py-12">
41
+ <header class="text-center mb-16">
42
+ <h1 class="text-5xl md:text-6xl font-bold mb-4 bg-clip-text text-transparent bg-gradient-to-r from-purple-400 to-pink-600">
43
+ Quantum State Explorer
44
+ </h1>
45
+ <p class="text-xl md:text-2xl text-gray-300 max-w-3xl mx-auto">
46
+ Visualize and explore the mysterious quantum states of subatomic particles
47
+ </p>
48
+ </header>
49
+
50
+ <main class="grid grid-cols-1 lg:grid-cols-2 gap-12">
51
+ <div class="bg-gray-800 rounded-2xl p-8 shadow-2xl relative overflow-hidden">
52
+ <div class="wave-function"></div>
53
+ <h2 class="text-3xl font-bold mb-6 text-purple-300">Particle State Generator</h2>
54
+
55
+ <div class="mb-8">
56
+ <label class="block text-gray-300 mb-2">Select Particle Type</label>
57
+ <div class="grid grid-cols-3 gap-2 mb-4">
58
+ <button class="particle-btn bg-purple-900 hover:bg-purple-700 text-white py-3 px-4 rounded-lg transition" data-particle="electron">
59
+ <i data-feather="zap" class="inline mr-2"></i> Electron
60
+ </button>
61
+ <button class="particle-btn bg-blue-900 hover:bg-blue-700 text-white py-3 px-4 rounded-lg transition" data-particle="photon">
62
+ <i data-feather="sun" class="inline mr-2"></i> Photon
63
+ </button>
64
+ <button class="particle-btn bg-pink-900 hover:bg-pink-700 text-white py-3 px-4 rounded-lg transition" data-particle="quark">
65
+ <i data-feather="activity" class="inline mr-2"></i> Quark
66
+ </button>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="mb-8">
71
+ <label class="block text-gray-300 mb-2">Quantum State Parameters</label>
72
+ <div class="space-y-4">
73
+ <div>
74
+ <label class="text-gray-400">Superposition</label>
75
+ <input type="range" min="0" max="100" value="50" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer" id="superposition">
76
+ </div>
77
+ <div>
78
+ <label class="text-gray-400">Entanglement</label>
79
+ <input type="range" min="0" max="100" value="25" class="w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer" id="entanglement">
80
+ </div>
81
+ <div>
82
+ <label class="text-gray-400">Spin</label>
83
+ <div class="flex space-x-4">
84
+ <button class="spin-btn bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg transition" data-spin="up">↑ Up</button>
85
+ <button class="spin-btn bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg transition" data-spin="down">↓ Down</button>
86
+ <button class="spin-btn bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg transition" data-spin="super">🌀 Superposition</button>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </div>
91
+
92
+ <button id="generate-btn" class="w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white font-bold py-4 px-6 rounded-lg shadow-lg transition-all transform hover:scale-105">
93
+ Generate Quantum State
94
+ </button>
95
+ </div>
96
+
97
+ <div class="bg-gray-800 rounded-2xl p-8 shadow-2xl relative overflow-hidden min-h-[500px] flex items-center justify-center">
98
+ <div class="wave-function"></div>
99
+ <h2 class="text-3xl font-bold mb-6 text-purple-300 absolute top-8 left-8">Visualization</h2>
100
+
101
+ <div id="visualization-container" class="w-full h-full flex items-center justify-center">
102
+ <div class="text-center">
103
+ <svg width="300" height="300" viewBox="0 0 300 300" id="quantum-visualization">
104
+ <circle cx="150" cy="150" r="30" fill="url(#particle-gradient)" class="quantum-orb" opacity="0" />
105
+ <path d="M150,50 A100,100 0 0,1 250,150 A100,100 0 0,1 150,250 A100,100 0 0,1 50,150 A100,100 0 0,1 150,50"
106
+ fill="none" stroke="rgba(124, 58, 237, 0.2)" stroke-width="2" class="particle-path" />
107
+ <defs>
108
+ <radialGradient id="particle-gradient" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
109
+ <stop offset="0%" stop-color="#8B5CF6" />
110
+ <stop offset="100%" stop-color="#EC4899" />
111
+ </radialGradient>
112
+ </defs>
113
+ </svg>
114
+ <div id="state-description" class="mt-8 text-gray-300 text-lg">
115
+ <p>Select a particle and adjust parameters to see its quantum state</p>
116
+ </div>
117
+ <div id="state-equation" class="mt-4 text-xl font-mono bg-gray-900 p-4 rounded-lg hidden">
118
+ |ψ⟩ = <span id="equation-content"></span>
119
+ </div>
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </main>
124
+
125
+ <section class="mt-24 bg-gray-800 rounded-2xl p-8 shadow-2xl">
126
+ <h2 class="text-3xl font-bold mb-6 text-purple-300">Quantum Mechanics Basics</h2>
127
+ <div class="grid md:grid-cols-3 gap-8">
128
+ <div class="bg-gray-700 p-6 rounded-lg">
129
+ <i data-feather="box" class="text-purple-400 w-8 h-8 mb-4"></i>
130
+ <h3 class="text-xl font-bold mb-2">Wave-Particle Duality</h3>
131
+ <p class="text-gray-300">Quantum entities exhibit both particle-like and wave-like properties depending on how they're observed.</p>
132
+ </div>
133
+ <div class="bg-gray-700 p-6 rounded-lg">
134
+ <i data-feather="git-merge" class="text-purple-400 w-8 h-8 mb-4"></i>
135
+ <h3 class="text-xl font-bold mb-2">Superposition</h3>
136
+ <p class="text-gray-300">A quantum system can exist in multiple states simultaneously until measured or observed.</p>
137
+ </div>
138
+ <div class="bg-gray-700 p-6 rounded-lg">
139
+ <i data-feather="link" class="text-purple-400 w-8 h-8 mb-4"></i>
140
+ <h3 class="text-xl font-bold mb-2">Entanglement</h3>
141
+ <p class="text-gray-300">When particles become entangled, the state of one instantly influences the state of the other, regardless of distance.</p>
142
+ </div>
143
+ </div>
144
+ </section>
145
+
146
+ <footer class="mt-24 text-center text-gray-400 pb-12">
147
+ <p>Explore the quantum realm at your own risk! Schrödinger's cat not included.</p>
148
+ <p class="mt-2">© 2023 Quantum State Explorer | Built with quantum magic</p>
149
+ </footer>
150
+ </div>
151
+
152
+ <script>
153
+ // Initialize Vanta.js background
154
+ VANTA.GLOBE({
155
+ el: "#vanta-bg",
156
+ mouseControls: true,
157
+ touchControls: true,
158
+ gyroControls: false,
159
+ minHeight: 200.00,
160
+ minWidth: 200.00,
161
+ scale: 1.00,
162
+ scaleMobile: 1.00,
163
+ color: 0x7c3aed,
164
+ backgroundColor: 0x111827,
165
+ size: 0.8
166
+ });
167
+
168
+ // Particle data
169
+ const particles = {
170
+ electron: {
171
+ name: "Electron",
172
+ color: "#8B5CF6",
173
+ description: "A fundamental subatomic particle with negative charge.",
174
+ states: ["Spin Up", "Spin Down", "Superposition"]
175
+ },
176
+ photon: {
177
+ name: "Photon",
178
+ color: "#3B82F6",
179
+ description: "A quantum of electromagnetic radiation exhibiting wave-particle duality.",
180
+ states: ["Vertical Polarization", "Horizontal Polarization", "Circular Polarization"]
181
+ },
182
+ quark: {
183
+ name: "Quark",
184
+ color: "#EC4899",
185
+ description: "An elementary particle that combines to form hadrons like protons and neutrons.",
186
+ states: ["Up", "Down", "Strange", "Charm", "Bottom", "Top"]
187
+ }
188
+ };
189
+
190
+ // Current state
191
+ let currentParticle = null;
192
+ let currentSuperposition = 50;
193
+ let currentEntanglement = 25;
194
+ let currentSpin = "super";
195
+
196
+ // DOM elements
197
+ const particleBtns = document.querySelectorAll('.particle-btn');
198
+ const spinBtns = document.querySelectorAll('.spin-btn');
199
+ const generateBtn = document.getElementById('generate-btn');
200
+ const superpositionSlider = document.getElementById('superposition');
201
+ const entanglementSlider = document.getElementById('entanglement');
202
+ const visualizationContainer = document.getElementById('visualization-container');
203
+ const stateDescription = document.getElementById('state-description');
204
+ const stateEquation = document.getElementById('state-equation');
205
+ const equationContent = document.getElementById('equation-content');
206
+ const quantumOrb = document.querySelector('.quantum-orb');
207
+ const svg = document.getElementById('quantum-visualization');
208
+
209
+ // Event listeners
210
+ particleBtns.forEach(btn => {
211
+ btn.addEventListener('click', () => {
212
+ particleBtns.forEach(b => b.classList.remove('ring-2', 'ring-white'));
213
+ btn.classList.add('ring-2', 'ring-white');
214
+ currentParticle = btn.dataset.particle;
215
+ updateVisualization();
216
+ });
217
+ });
218
+
219
+ spinBtns.forEach(btn => {
220
+ btn.addEventListener('click', () => {
221
+ spinBtns.forEach(b => b.classList.remove('ring-2', 'ring-white'));
222
+ btn.classList.add('ring-2', 'ring-white');
223
+ currentSpin = btn.dataset.spin;
224
+ updateVisualization();
225
+ });
226
+ });
227
+
228
+ superpositionSlider.addEventListener('input', () => {
229
+ currentSuperposition = superpositionSlider.value;
230
+ updateVisualization();
231
+ });
232
+
233
+ entanglementSlider.addEventListener('input', () => {
234
+ currentEntanglement = entanglementSlider.value;
235
+ updateVisualization();
236
+ });
237
+
238
+ generateBtn.addEventListener('click', () => {
239
+ if (!currentParticle) {
240
+ alert("Please select a particle type first!");
241
+ return;
242
+ }
243
+ animateState();
244
+ });
245
+
246
+ // Update visualization
247
+ function updateVisualization() {
248
+ if (!currentParticle) return;
249
+
250
+ const particle = particles[currentParticle];
251
+
252
+ // Update particle color
253
+ document.querySelector('#particle-gradient stop:first-child').setAttribute('stop-color', particle.color);
254
+
255
+ // Update description
256
+ let description = `<strong class="text-${currentParticle === 'electron' ? 'purple' : currentParticle === 'photon' ? 'blue' : 'pink'}-400">${particle.name}</strong>: ${particle.description}<br><br>`;
257
+ description += `Superposition: ${currentSuperposition}%<br>`;
258
+ description += `Entanglement: ${currentEntanglement}%<br>`;
259
+ description += `Spin: ${currentSpin === 'up' ? '↑ Up' : currentSpin === 'down' ? '↓ Down' : '🌀 Superposition'}`;
260
+
261
+ stateDescription.innerHTML = description;
262
+ stateEquation.classList.add('hidden');
263
+ }
264
+
265
+ // Animate quantum state
266
+ function animateState() {
267
+ const particle = particles[currentParticle];
268
+
269
+ // Show quantum orb
270
+ quantumOrb.style.opacity = '1';
271
+
272
+ // Animation
273
+ anime({
274
+ targets: '.quantum-orb',
275
+ r: [10, 30, 10],
276
+ opacity: [0.5, 1, 0.8],
277
+ duration: 2000,
278
+ loop: true,
279
+ easing: 'easeInOutSine'
280
+ });
281
+
282
+ // Generate random path for particle
283
+ const paths = [];
284
+ for (let i = 0; i < 5; i++) {
285
+ const startX = 150;
286
+ const startY = 150;
287
+ const cp1x = Math.random() * 300;
288
+ const cp1y = Math.random() * 300;
289
+ const cp2x = Math.random() * 300;
290
+ const cp2y = Math.random() * 300;
291
+ const endX = 150;
292
+ const endY = 150;
293
+
294
+ paths.push(`M${startX},${startY} C${cp1x},${cp1y} ${cp2x},${cp2y} ${endX},${endY}`);
295
+ }
296
+
297
+ // Update SVG paths
298
+ const existingPaths = svg.querySelectorAll('.dynamic-path');
299
+ existingPaths.forEach(path => path.remove());
300
+
301
+ paths.forEach((path, i) => {
302
+ const newPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
303
+ newPath.setAttribute("d", path);
304
+ newPath.setAttribute("fill", "none");
305
+ newPath.setAttribute("stroke", `rgba(${hexToRgb(particle.color)}, ${0.3 + (i * 0.1)})`);
306
+ newPath.setAttribute("stroke-width", "2");
307
+ newPath.setAttribute("class", "dynamic-path particle-path");
308
+ newPath.style.animationDelay = `${i * 0.5}s`;
309
+ svg.appendChild(newPath);
310
+ });
311
+
312
+ // Generate quantum state equation
313
+ let equation = '';
314
+ if (currentSpin === 'super') {
315
+ const alpha = (currentSuperposition / 100).toFixed(2);
316
+ const beta = (1 - (currentSuperposition / 100)).toFixed(2);
317
+ equation = `${alpha}|↑⟩ + ${beta}|↓⟩`;
318
+ } else {
319
+ equation = currentSpin === 'up' ? '|↑⟩' : '|↓⟩';
320
+ }
321
+
322
+ if (currentEntanglement > 30) {
323
+ equation += ` ⊗ |Φ⁺⟩`;
324
+ }
325
+
326
+ equationContent.textContent = equation;
327
+ stateEquation.classList.remove('hidden');
328
+
329
+ // Update background color based on entanglement
330
+ const bgColor = `rgba(${hexToRgb(particle.color)}, ${currentEntanglement / 200})`;
331
+ visualizationContainer.style.backgroundColor = bgColor;
332
+ }
333
+
334
+ // Helper function to convert hex to rgb
335
+ function hexToRgb(hex) {
336
+ const r = parseInt(hex.slice(1, 3), 16);
337
+ const g = parseInt(hex.slice(3, 5), 16);
338
+ const b = parseInt(hex.slice(5, 7), 16);
339
+ return `${r}, ${g}, ${b}`;
340
+ }
341
+
342
+ // Initialize feather icons
343
+ feather.replace();
344
+ </script>
345
+ </body>
346
  </html>