Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium-2505· Mistral AIHugging Face LMArena Human Preference 140K

Make a visual simulation wave function of schirondinger equation that show the colapse…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with chatgpt-4o-latest-20250326’s answer.
  1. User

    Make a visual simulation wave function of schirondinger equation that show the colapse of the wave when I touch my mobile screen, after that the wave will envolving smooth, make it using tree.js put all code in wave.html for I will run on my Brouser. When I touch the screen turn the peak even more high and narrowed.when the pick is increasing turn it more gradually from blue, red to yellow at the pick point. After touch the wave will smoothing spread again.

  2. Mistral Assistant

    Wave Function Simulation with Three.js

    Here's a complete wave.html file that simulates a Schrödinger wave function that collapses when you touch the screen and then smoothly evolves back. The wave peak becomes higher and narrower when touched, with color gradients from blue to red to yellow at the peak.

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Schrödinger Wave Function Simulation</title>
        <style>
            body {
                margin: 0;
                overflow: hidden;
                background-color: #000;
                touch-action: none;
            }
            canvas {
                display: block;
            }
        </style>
    </head>
    <body>
        <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js"></script>
        <script>
            // Scene setup
            const scene = new THREE.Scene();
            const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
            const renderer = new THREE.WebGLRenderer({ antialias: true });
            renderer.setSize(window.innerWidth, window.innerHeight);
            document.body.appendChild(renderer.domElement);
    
            // Wave parameters
            let waveWidth = 10;
            let waveHeight = 1;
            let waveSpeed = 0.5;
            let wavePoints = 100;
            let isCollapsed = false;
            let collapseFactor = 1;
            let collapseTarget = 1;
            let collapseSpeed = 0.05;
            let touchX = 0;
            let touchY = 0;
            let hasTouched = false;
    
            // Create wave geometry
            const waveGeometry = new THREE.BufferGeometry();
            const positions = new Float32Array(wavePoints * 3);
            const colors = new Float32Array(wavePoints * 3);
    
            for (let i = 0; i < wavePoints; i++) {
                const x = (i / wavePoints - 0.5) * waveWidth * 2;
                positions[i * 3] = x;
                positions[i * 3 + 1] = 0;
                positions[i * 3 + 2] = 0;
    
                // Initial color (blue)
                colors[i * 3] = 0.2;
                colors[i * 3 + 1] = 0.4;
                colors[i * 3 + 2] = 1.0;
            }
    
            waveGeometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
            waveGeometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
    
            const waveMaterial = new THREE.LineBasicMaterial({
                linewidth: 3,
                vertexColors: true
            });
    
            const wave = new THREE.Line(waveGeometry, waveMaterial);
            scene.add(wave);
    
            // Add axes helper
            const axesHelper = new THREE.AxesHelper(5);
            scene.add(axesHelper);
    
            // Camera position
            camera.position.z = 15;
    
            // Handle window resize
            window.addEventListener('resize', () => {
                camera.aspect = window.innerWidth / window.innerHeight;
                camera.updateProjectionMatrix();
                renderer.setSize(window.innerWidth, window.innerHeight);
            });
    
            // Touch/click event handlers
            function onTouchOrClick(event) {
                event.preventDefault();
    
                // Get touch/click position in normalized coordinates (-1 to 1)
                const rect = renderer.domElement.getBoundingClientRect();
                const x = ((event.clientX || event.touches[0].clientX) - rect.left) / rect.width * 2 - 1;
                const y = -((event.clientY || event.touches[0].clientY) - rect.top) / rect.height * 2 + 1;
    
                touchX = x * waveWidth;
                touchY = y * waveHeight * 5;
    
                isCollapsed = true;
                collapseTarget = 5; // Higher peak when touched
                hasTouched = true;
            }
    
            renderer.domElement.addEventListener('touchstart', onTouchOrClick, { passive: false });
            renderer.domElement.addEventListener('mousedown', onTouchOrClick);
    
            // Animation loop
            function animate() {
                requestAnimationFrame(animate);
    
                const positions = waveGeometry.attributes.position.array;
                const colors = waveGeometry.attributes.color.array;
    
                // Update wave function
                for (let i = 0; i < wavePoints; i++) {
                    const x = (i / wavePoints - 0.5) * waveWidth * 2;
    
                    // Calculate wave value
                    let waveValue;
                    if (isCollapsed) {
                        // Collapsed wave function (narrow peak)
                        const distance = Math.abs(x - touchX);
                        waveValue = Math.exp(-distance * distance * collapseFactor * 2) * waveHeight * collapseFactor * 2;
                    } else {
                        // Normal wave function (spread out)
                        waveValue = Math.exp(-x * x * collapseFactor) * waveHeight * collapseFactor;
                    }
    
                    // Apply some oscillation
                    waveValue *= Math.sin(Date.now() * 0.001 * waveSpeed + x * 0.5) * 0.5 + 1.5;
    
                    positions[i * 3 + 1] = waveValue;
    
                    // Update color based on height and position
                    const heightFactor = Math.min(1, waveValue / (waveHeight * collapseFactor * 2));
    
                    // Gradient from blue to red to yellow at peak
                    if (heightFactor < 0.5) {
                        // Blue to red
                        const t = heightFactor * 2;
                        colors[i * 3] = 0.2 + 0.8 * t; // R
                        colors[i * 3 + 1] = 0.4 - 0.4 * t; // G
                        colors[i * 3 + 2] = 1.0 - 0.8 * t; // B
                    } else {
                        // Red to yellow
                        const t = (heightFactor - 0.5) * 2;
                        colors[i * 3] = 1.0; // R
                        colors[i * 3 + 1] = 0.4 + 0.6 * t; // G
                        colors[i * 3 + 2] = 0.0; // B
                    }
                }
    
                // Update collapse factor
                if (isCollapsed) {
                    collapseFactor += (collapseTarget - collapseFactor) * collapseSpeed;
    
                    // If we've reached the target, start smoothing out
                    if (Math.abs(collapseTarget - collapseFactor) < 0.01) {
                        collapseTarget = 1;
                        collapseSpeed = 0.02;
                        isCollapsed = false;
                    }
                } else {
                    collapseFactor += (1 - collapseFactor) * collapseSpeed;
    
                    // If we're back to normal, reset
                    if (Math.abs(1 - collapseFactor) < 0.01) {
                        collapseFactor = 1;
                        hasTouched = false;
                    }
                }
    
                waveGeometry.attributes.position.needsUpdate = true;
                waveGeometry.attributes.color.needsUpdate = true;
    
                renderer.render(scene, camera);
            }
    
            animate();
        </script>
    </body>
    </html>
    

    How to Use This Simulation:

    1. Save the code above as wave.html on your device.
    2. Open the file in your mobile browser.
    3. Touch the screen to collapse the wave function:
      • The wave will become a narrow, high peak at the touch point
      • The color will change from blue to red to yellow at the peak
    4. After touching, the wave will smoothly spread out again
    5. The wave continues to oscillate naturally when not collapsed

    Features:

    • Real-time interaction with touch/click
    • Smooth wave function collapse and expansion
    • Color gradient that changes with wave height (blue → red → yellow)
    • Responsive design that works on mobile devices
    • Continuous wave oscillation even when not collapsed

    The simulation uses Three.js for 3D rendering and handles touch events to create the wave collapse effect you requested. The wave function is modeled with a Gaussian distribution that becomes narrower and taller when collapsed.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.