<h1>Teleportation</h1>


```
%load_ext sympyprinting
```


```
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
```


```
a,b = symbols('a b', real=True)
state = Qubit('000')*a + Qubit('001')*b; state
```


```
entangle1_2 = CNOT(1,2)*HadamardGate(1); entangle1_2

```


```
state = qapply(entangle1_2*state); state

```


```
entangle0_1 = HadamardGate(0)*CNOT(0,1); entangle0_1

```


```
circuit_plot(entangle0_1*entangle1_2, nqubits=3)

```


```
state = qapply(entangle0_1*state); state

```


```
result = measure_partial(state, (0,1))

```


```
state = (result[2][0]*2).expand(); state
```




$$\frac{a {\left|110\right\rangle }}{\sqrt{a^{2} + b^{2}} \sqrt{\frac{1}{4} \lvert{\frac{a}{\sqrt{a^{2} + b^{2}}}}\rvert^{2} + \frac{1}{4} \lvert{\frac{b}{\sqrt{a^{2} + b^{2}}}}\rvert^{2}}} + \frac{b {\left|010\right\rangle }}{\sqrt{a^{2} + b^{2}} \sqrt{\frac{1}{4} \lvert{\frac{a}{\sqrt{a^{2} + b^{2}}}}\rvert^{2} + \frac{1}{4} \lvert{\frac{b}{\sqrt{a^{2} + b^{2}}}}\rvert^{2}}}$$




```
state = qapply(XGate(2)*state); state

```




$$\frac{a {\left|010\right\rangle }}{\sqrt{a^{2} + b^{2}} \sqrt{\frac{1}{4} \lvert{\frac{a}{\sqrt{a^{2} + b^{2}}}}\rvert^{2} + \frac{1}{4} \lvert{\frac{b}{\sqrt{a^{2} + b^{2}}}}\rvert^{2}}} + \frac{b {\left|110\right\rangle }}{\sqrt{a^{2} + b^{2}} \sqrt{\frac{1}{4} \lvert{\frac{a}{\sqrt{a^{2} + b^{2}}}}\rvert^{2} + \frac{1}{4} \lvert{\frac{b}{\sqrt{a^{2} + b^{2}}}}\rvert^{2}}}$$



49d566de484193bf8f3738fe00068e4be62c477c
ipynb
Jupyter Notebook
docs/examples/notebooks/teleportation.ipynb
tinyclues/ipython
71e32606b0242772b81c9be0d40751ba47d95f2c
BSD-3-Clause-Clear
2016-05-26T10:57:18.000Z
2016-05-26T10:57:18.000Z
docs/examples/notebooks/teleportation.ipynb
adgaudio/ipython
a924f50c0f7b84127391f1c396326258c2b303e2
BSD-3-Clause-Clear
docs/examples/notebooks/teleportation.ipynb
adgaudio/ipython
a924f50c0f7b84127391f1c396326258c2b303e2
BSD-3-Clause-Clear
Qwen/Qwen-72B
1. YES
2. YES