Skip to content

Add Bell test implementation for quantum entanglement demonstration#14

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-bell-test
Draft

Add Bell test implementation for quantum entanglement demonstration#14
Copilot wants to merge 4 commits intomainfrom
copilot/add-bell-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 13, 2025

Implements Bell's inequality (CHSH) test to demonstrate quantum entanglement and violation of local realism.

Implementation

  • Complex numbers (Complex.ts): Arithmetic operations for quantum state amplitudes
  • Quantum states (QuantumState.ts): Two-qubit representation with normalization, Bell state factory for all four maximally entangled states (|Φ±⟩, |Ψ±⟩)
  • Bell test (BellTest.ts): Quantum correlation calculation E(a,b) = cos(a-b), CHSH inequality S = |E(a,b) - E(a,b') + E(a',b) + E(a',b')|, optimal measurement angles for maximum violation

Usage

import { BellTest, QuantumState } from './src';

const bellState = QuantumState.createBellState('phi+');
const angles = BellTest.getOptimalCHSHAngles(); // [0, π/2, π/4, 3π/4]
const chshValue = BellTest.calculateCHSH(bellState, angles);

console.log(chshValue); // 2.828 > 2 (classical bound)

Results

  • All Bell states achieve S = 2√2 ≈ 2.828, violating classical bound of S ≤ 2
  • Product states correctly show S ≈ 0 (no violation)
  • 38 tests covering complex arithmetic, state normalization, and correlation calculations

Documentation

  • BELLTEST.md: Bell's theorem, CHSH formulation, optimal angles
  • demo.ts: Interactive demonstration with theoretical and empirical measurements
Original prompt

This section details on the original issue you should resolve

<issue_title>Lacking of Bell test.</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 13, 2025 17:39
Co-authored-by: ewdlop <25368970+ewdlop@users.noreply.github.com>
Co-authored-by: ewdlop <25368970+ewdlop@users.noreply.github.com>
Co-authored-by: ewdlop <25368970+ewdlop@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Bell test implementation Add Bell test implementation for quantum entanglement demonstration Dec 13, 2025
Copilot AI requested a review from ewdlop December 13, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lacking of Bell test.

2 participants