Skip to content

Comment on Show HN: Play with real quantum physics in your browserparent

Comments

They already exist

    import numpy as np
    from qiskit import QuantumCircuit

    # 1. A quantum circuit for preparing the quantum state |000> + i |111> / √2
    qc = QuantumCircuit(3)
    # generate superposition
    qc.h(0)  
    # add quantum phase   
    qc.p(np.pi / 2, 0)  
    # 0th-qubit-Controlled-NOT gate on 1st qubit
    qc.cx(0, 1)   
    # 0th-qubit-Controlled-NOT gate on 2nd qubit 
    qc.cx(0, 2)

Thanks for the pointer to qiskit, I'm gonna go learn...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.