##// END OF EJS Templates
Merge pull request #1083 from takluyver/prompts...
Merge pull request #1083 from takluyver/prompts Fixes that finish up the recent PromptManager work: * InteractiveShell.prompt_foo traits show deprecation warning, and map to new PromptManager traits * PromptManager properly added to IPython App, so it will show up in config * add helpstrings to PromptManager traits. * Docs / embed references to Shell.prompt_foo also updated * Prompt rewriting in autocall scenarios is now controlled by a boolean, `show_rewritten_input`, attribute of the InteractiveShell. Closes #1075.

File last commit:

r5279:4d707b82
r5556:4b8920a5 merge
Show More
dense_coding.ipynb
161 lines | 42.1 KiB | text/plain | TextLexer

Dense Coding

In [2]:
%load_ext sympyprinting
In [3]:
from sympy import sqrt, symbols, Rational
from sympy import expand, Eq, Symbol, simplify, exp, sin
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
In [4]:
psi = Qubit('00')/sqrt(2) + Qubit('11')/sqrt(2); psi
Out[4]:
$$\frac{1}{2} \sqrt{2} {\left|00\right\rangle } + \frac{1}{2} \sqrt{2} {\left|11\right\rangle }$$
In [5]:
circuits = [H(1)*CNOT(1,0), H(1)*CNOT(1,0)*X(1), H(1)*CNOT(1,0)*Z(1), H(1)*CNOT(1,0)*Z(1)*X(1)]
In [6]:
for circuit in circuits:
    circuit_plot(circuit, nqubits=2)
    display(Eq(circuit*psi,qapply(circuit*psi)))
$$H_{1} CNOT_{1,0} \left(\frac{1}{2} \sqrt{2} {\left|00\right\rangle } + \frac{1}{2} \sqrt{2} {\left|11\right\rangle }\right) = {\left|00\right\rangle }$$
$$H_{1} CNOT_{1,0} X_{1} \left(\frac{1}{2} \sqrt{2} {\left|00\right\rangle } + \frac{1}{2} \sqrt{2} {\left|11\right\rangle }\right) = {\left|01\right\rangle }$$
$$H_{1} CNOT_{1,0} Z_{1} \left(\frac{1}{2} \sqrt{2} {\left|00\right\rangle } + \frac{1}{2} \sqrt{2} {\left|11\right\rangle }\right) = {\left|10\right\rangle }$$
$$H_{1} CNOT_{1,0} Z_{1} X_{1} \left(\frac{1}{2} \sqrt{2} {\left|00\right\rangle } + \frac{1}{2} \sqrt{2} {\left|11\right\rangle }\right) = {\left|11\right\rangle }$$
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image