← QNeura.ai

Variational Quantum Eigensolver

Optimising a circuit toward the ground state.

A hardware-efficient ansatz prepares a trial state ψ(θ); a classical optimiser tunes the rotation angles by gradient descent to minimise the molecular energy ⟨ψ(θ)|Ĥ|ψ(θ)⟩. The circuit, the angles, and the descent are all live — a genuine state-vector simulation of H₂ in a minimal basis, converging to its exact ground-state energy.

q₀ , q₁  —  hardware-efficient ansatzoptimising…
|0⟩ |0⟩ Ryθ₀ 0.00 Ryθ₁ 0.00 Ryθ₂ 0.00 Ryθ₃ 0.00 ⟨Ĥ⟩ H₂ · minimal basis

Energy ⟨Ĥ⟩ vs optimiser iteration

Current energy ⟨Ĥ⟩Ha
Exact ground stateHa
Iteration0
optimising

Ansatz: Ry(θ₀)⊗Ry(θ₁) → CNOT → Ry(θ₂)⊗Ry(θ₃). Gradients by the parameter-shift rule; angles updated by gradient descent. The 4×4 Hamiltonian (Z, ZZ, XX, YY terms) is diagonalised exactly for the reference line. Pure JavaScript, no libraries.