qiskit-tutorials
qiskit-tutorials copied to clipboard
Function to write the state as bra and ket
What is the expected behavior?
Is it possible to write the state using bra-ket notation rather than array?
@aburousan Do you mean to improve code readability by theorists? In that case, what about the usage of some specialized objects like in SymPy?
Yes. As @MartinBeseda said you can use SymPy to do exactly what you want. You can try
from sympy.physics.quantum import Bra,Ket
from sympy import symbols, I
Ket('00')+Ket('11')
or maybe...
Ket(symbols('psi'))
@aburousan Hope it helps. Please do close the issue if you got the answer to your questions. Thanks 🙂
I have asked about this in stack exchange ( https://quantumcomputing.stackexchange.com/questions/18372/how-to-convert-the-output-column-vector-or-matrix-into-bra-ket-notation-using-py ). The first answer is what I was looking for. I hope someone in the future, can see this and get some help. I am curious if the new function (mentioned in the answer) is added or not in qiskit?
Closing as not relevant to Qiskit tutorials and OP appears to have found a solution to their issue 😃