{"id":44937168,"url":"https://github.com/space-cadet/ts-quantum","last_synced_at":"2026-02-18T07:33:18.128Z","repository":{"id":303226260,"uuid":"1014787896","full_name":"space-cadet/ts-quantum","owner":"space-cadet","description":"Quantum mechanics library implemented in typescript","archived":false,"fork":false,"pushed_at":"2025-07-07T14:50:02.000Z","size":21436,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-17T21:30:07.962Z","etag":null,"topics":["numerical-methods","physics","quantum-mechanics","simulation","typescript"],"latest_commit_sha":null,"homepage":"https://space-cadet.github.io/ts-quantum/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/space-cadet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-06T12:20:35.000Z","updated_at":"2025-07-07T14:50:06.000Z","dependencies_parsed_at":"2025-07-06T13:47:14.110Z","dependency_job_id":null,"html_url":"https://github.com/space-cadet/ts-quantum","commit_stats":null,"previous_names":["space-cadet/ts-quantum"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/space-cadet/ts-quantum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-cadet%2Fts-quantum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-cadet%2Fts-quantum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-cadet%2Fts-quantum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-cadet%2Fts-quantum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/space-cadet","download_url":"https://codeload.github.com/space-cadet/ts-quantum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-cadet%2Fts-quantum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29572428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T06:19:27.422Z","status":"ssl_error","status_checked_at":"2026-02-18T06:18:44.348Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["numerical-methods","physics","quantum-mechanics","simulation","typescript"],"created_at":"2026-02-18T07:33:17.627Z","updated_at":"2026-02-18T07:33:18.123Z","avatar_url":"https://github.com/space-cadet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-quantum\n\nA comprehensive TypeScript library for quantum mechanics calculations and simulations. Built for both educational purposes and practical quantum computing applications.\n\n## 🚀 Features\n\n### Core Quantum Mechanics\n- **Quantum State Vectors** - Complete state vector operations with complex amplitudes\n- **Quantum Gates** - Standard gates (Pauli, Hadamard, CNOT, Phase, etc.)\n- **Density Matrices** - Mixed state operations and quantum channels\n- **Quantum Measurements** - Projective measurements and Born rule calculations\n- **Hilbert Space Operations** - Tensor products, direct sums, and basis transformations\n\n### Advanced Features\n- **Hamiltonian Evolution** - Time evolution with matrix exponentiation\n- **Angular Momentum Algebra** - Complete SU(2) representation theory\n- **Wigner Symbols** - 3j, 6j, and 9j symbols for angular momentum coupling\n- **Clebsch-Gordan Coefficients** - Angular momentum composition\n- **Quantum Information** - Entanglement measures, fidelity, and distances\n- **Geometric Quantum Mechanics** - Fubini-Study metric and quantum distances\n\n### Numerical Methods\n- **Eigendecomposition** - Robust eigenvalue/eigenvector computation\n- **Matrix Functions** - Matrix exponentials, logarithms, and arbitrary functions\n- **Sparse Matrix Support** - Efficient operations for large quantum systems\n- **Optimization** - Performance-optimized for multi-qubit systems\n\n## 📦 Installation\n\n```bash\nnpm install ts-quantum\n```\n\n## 🎯 Quick Start\n\n```typescript\nimport { \n  StateVector,\n  PauliX,\n  Hadamard,\n  CNOT,\n  measure,\n  DensityMatrix\n} from 'ts-quantum';\n\n// Create a qubit in |0⟩ state\nconst qubit = StateVector.computationalBasis(2, 0);\n\n// Apply Hadamard gate to create superposition\nconst superposition = Hadamard.apply(qubit);\n\n// Measure the state\nconst result = measure(superposition);\nconsole.log(`Measured: ${result.value} with probability ${result.probability}`);\n\n// Create Bell state\nconst twoQubits = StateVector.computationalBasis(4, 0); // |00⟩\nconst bellState = CNOT.apply(Hadamard.extend(2).apply(twoQubits));\n\n// Work with density matrices\nconst rho = DensityMatrix.fromStateVector(bellState);\nconsole.log(`Purity: ${rho.purity()}`);\nconsole.log(`Entropy: ${rho.vonNeumannEntropy()}`);\n```\n\n## 🧮 Requirements\n\n- **Node.js** \u003e= 14.0.0\n- **TypeScript** \u003e= 4.5.0 (optional, works with JavaScript too)\n- **mathjs** \u003e= 10.0.0 (automatically installed)\n\n## 📚 Core API\n\n### StateVector\n```typescript\n// Create and manipulate quantum states\nconst state = new StateVector(dimension);\nconst |0⟩ = StateVector.computationalBasis(2, 0);\nconst |+⟩ = StateVector.superposition(2, [0, 1]);\n\n// State operations\nconst normalized = state.normalize();\nconst probability = state.measurementProbability(index);\nconst overlap = state1.innerProduct(state2);\n```\n\n### Quantum Gates\n```typescript\n// Single-qubit gates\nconst X = PauliX;           // NOT gate\nconst Y = PauliY;           // Y rotation\nconst Z = PauliZ;           // Phase flip\nconst H = Hadamard;         // Superposition gate\nconst S = PhaseGate;        // Phase gate\nconst T = TGate;           // π/8 gate\n\n// Multi-qubit gates\nconst cx = CNOT;           // Controlled-X\nconst cy = ControlledY;    // Controlled-Y\nconst cz = ControlledZ;    // Controlled-Z\n\n// Apply gates\nconst result = H.apply(state);\nconst extended = X.extend(2).apply(twoQubitState);\n```\n\n### Measurements\n```typescript\n// Computational basis measurement\nconst outcome = measure(state);\n\n// Projective measurement with custom operator\nconst projection = projectiveMeasurement(state, operator);\n\n// Measurement probabilities\nconst probs = state.measurementProbabilities();\n```\n\n### Advanced Operations\n```typescript\n// Angular momentum\nimport { createAngularState, clebschGordan, wigner3j } from 'ts-quantum';\n\nconst |j,m⟩ = createAngularState(1, 0);  // |1,0⟩ state\nconst cg = clebschGordan(0.5, 0.5, 0.5, -0.5, 0, 0);  // Singlet coefficient\nconst w3j = wigner3j(1, 1, 2, 0, 0, 0);  // 3j symbol\n\n// Quantum distances\nimport { quantumDistance, fidelity } from 'ts-quantum';\n\nconst distance = quantumDistance(state1, state2);\nconst overlap = fidelity(rho1, rho2);\n```\n\n## 🔬 Examples\n\n### Creating Bell States\n```typescript\nimport { StateVector, Hadamard, CNOT } from 'ts-quantum';\n\n// |Φ⁺⟩ = (|00⟩ + |11⟩)/√2\nconst phi_plus = CNOT.apply(\n  Hadamard.extend(2).apply(\n    StateVector.computationalBasis(4, 0)\n  )\n);\n\n// Verify maximum entanglement\nconst rho = DensityMatrix.fromStateVector(phi_plus);\nconsole.log(`Entanglement entropy: ${rho.vonNeumannEntropy()}`); // ≈ 0.693\n```\n\n### Quantum Random Walk\n```typescript\nimport { StateVector, hadamardWalk } from 'ts-quantum';\n\n// 1D quantum random walk\nconst walker = hadamardWalk(position: 0, steps: 10);\nconst finalState = walker.evolve();\n```\n\n### Angular Momentum Coupling\n```typescript\nimport { createAngularState, coupleAngularMomenta } from 'ts-quantum';\n\n// Couple two spin-1/2 particles\nconst spin1 = createAngularState(0.5, 0.5);   // |↑⟩\nconst spin2 = createAngularState(0.5, -0.5);  // |↓⟩\n\n// Create coupled states in both singlet and triplet channels\nconst { singlet, triplet } = coupleAngularMomenta(spin1, spin2);\n```\n\n## 📖 Documentation\n\n- **[API Reference](./docs/)** - Complete API documentation\n- **[Examples](./examples/)** - Practical usage examples\n- **[Theory Guide](./docs/theory.md)** - Mathematical background\n\n## 🧪 Testing\n\nThe library includes comprehensive tests with 94% pass rate (422/451 tests passing). All core functionality and examples work correctly.\n\n```bash\nnpm test                 # Run all tests\nnpm run test:coverage    # Run with coverage report\nnpm run test:watch       # Watch mode for development\n```\n\n## 🏗️ Development\n\n```bash\n# Clone and setup\ngit clone https://github.com/space-cadet/ts-quantum.git\ncd ts-quantum\nnpm install\n\n# Build\nnpm run build\n\n# Generate documentation\nnpm run docs\n```\n\n## 🎓 Educational Use\n\nThis library is designed to be educational while remaining computationally robust. Each operation includes:\n- Clear mathematical definitions\n- Physical interpretations\n- Worked examples\n- Performance characteristics\n\nPerfect for:\n- Quantum mechanics courses\n- Quantum computing education\n- Research prototyping\n- Algorithm development\n\n## ⚡ Performance\n\n- Optimized for systems up to ~15 qubits\n- Sparse matrix support for larger systems\n- Efficient eigendecomposition algorithms\n- Memory-conscious implementations\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.\n\n## 📄 License\n\nMIT License - see [LICENSE](./LICENSE) file for details.\n\n## 🔗 Related Projects\n\n- **[Qiskit](https://qiskit.org/)** - IBM's quantum computing framework\n- **[Cirq](https://quantumai.google/cirq)** - Google's quantum computing library\n- **[PennyLane](https://pennylane.ai/)** - Quantum machine learning\n\n## 📞 Support\n\n- **Issues**: [GitHub Issues](https://github.com/space-cadet/ts-quantum/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/space-cadet/ts-quantum/discussions)\n- **Documentation**: [Online Docs](https://space-cadet.github.io/ts-quantum/)\n\n---\n\n**ts-quantum** - Bringing quantum mechanics to TypeScript with mathematical rigor and computational efficiency.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-cadet%2Fts-quantum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspace-cadet%2Fts-quantum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-cadet%2Fts-quantum/lists"}