It runs on my PC. I imported additional modules: from sympy.physics.quantum import * from sympy.physics.quantum.qubit import * from sympy.physics.quantum.gate import * from sympy.physics.quantum.grover import * from sympy.physics.quantum.qft import QFT, IQFT, Fourier from sympy.physics.quantum.circuitplot import circuit_plot
Sorry about the confusion. The output of a single Y(0) is correct. But two Y(0) multiplying is not. represent(Y(0),nqubits=1) On Monday, November 21, 2022 at 11:56:14 AM UTC-5 Oscar wrote: > On Mon, 21 Nov 2022 at 16:51, Iman <iman.s...@gmail.com> wrote: > > > > I encountered a issue with the output of the following script: > > > > from sympy.physics.quantum import * > > represent(Y(0)*Y(0),nqubits=1) > > > > I am expecting the ouput being a 2 by 2 identity matrix. But instead, > > the output is a single number 1. > > > > I don't know if it is a bug in the Python code or I misused the python > function. > > It probably is a bug but the code shown does not run for another reason: > > In [1]: from sympy.physics.quantum import * > ...: represent(Y(0)*Y(0),nqubits=1) > --------------------------------------------------------------------------- > NameError Traceback (most recent call last) > <ipython-input-1-ba167e22823e> in <cell line: 2>() > 1 from sympy.physics.quantum import * > ----> 2 represent(Y(0)*Y(0),nqubits=1) > > NameError: name 'Y' is not defined > > -- > Oscar > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/ed61e2bc-b3ca-4209-b31f-fe35bfff0233n%40googlegroups.com.