Returns the dimension of the Hilbert space for this quantum system.
For pure qubit states: dimension = 2^numQubits For qudits: dimension = levels^numQudits For mixed states: same as underlying pure state dimension
The total number of basis states in the system
Creates a deep copy of this quantum system.
The cloned system is completely independent and can be modified without affecting the original. All internal state representations (state vectors, density matrices, etc.) are copied.
New quantum system with identical quantum state
Computes the tensor product with another quantum system.
Creates a composite quantum system by combining this system with another. The resulting system has dimension equal to the product of individual system dimensions.
For pure states: |ψ₁⟩ ⊗ |ψ₂⟩ For mixed states: ρ₁ ⊗ ρ₂
Quantum system to tensor with this one
New quantum system representing the composite system
Returns a string representation of the quantum state.
The format depends on the specific quantum system type:
Optional
precision: numberNumber of decimal places for amplitude display (default: 3)
Optional
threshold: numberMinimum amplitude magnitude to display (default: 1e-10)
Human-readable representation of the quantum state
Calculates the purity of the quantum state.
Purity is defined as Tr(ρ²) where ρ is the density matrix.
Purity value between 1/dimension and 1
Checks if this quantum system represents a pure state.
A quantum state is pure if it can be written as |ψ⟩⟨ψ| for some state vector |ψ⟩. Mathematically, this is equivalent to purity = 1.
True if the state is pure, false if mixed
Computes the von Neumann entropy of the quantum state.
Entropy is defined as S = -Tr(ρ log₂ ρ) where ρ is the density matrix.
Von Neumann entropy in bits
Computes the fidelity between this and another quantum system.
Fidelity is a measure of similarity between two quantum states:
Fidelity ranges from 0 (orthogonal states) to 1 (identical states).
The other quantum system to compare with
Fidelity value between 0 and 1
Base interface for all quantum systems in q5m.js.
This interface defines the fundamental contract that all quantum systems must implement, providing a unified interface for quantum state manipulation regardless of the underlying representation (pure states, mixed states, qudits, etc.).
Design Principles:
Quantum System Types: