Kernel: Python 3 (Anaconda)
In [1]:
In [2]:
In [3]:
<class 'efprob_qu.State'>
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-bb412b2b92a5> in <module>()
1 print(type(ket(0)))
----> 2 print(type(k0))
NameError: name 'k0' is not defined
In [17]:
[[ 0.5+0.j 0.5+0.j]
[ 0.5+0.j 0.5+0.j]]
[[ 0.5+0.j -0.5+0.j]
[-0.5+0.j 0.5+0.j]]
In [18]:
(3+0j)
In [19]:
(3+4j)
In [32]:
File "<ipython-input-32-80aac62e4fb0>", line 1
[1,3] /. 4
^
SyntaxError: invalid syntax
In [36]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-36-e15615023789> in <module>()
----> 1 array([3])
NameError: name 'array' is not defined
In [43]:
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-43-28112a5a1c6e> in <module>()
----> 1 cflip(1.1)
~/Projects/python/efprob/efprob_qu.py in cflip(r)
1100 def cflip(r):
1101 if r < 0 or r > 1:
-> 1102 raise Exception('Coin flip requires a number in the unit interval')
1103 return State(np.array([[r, 0],
1104 [0, 1 - r]]), [2])
Exception: Coin flip requires a number in the unit interval
In [47]:
[[ 0.375 0. 0. ]
[ 0. 0.5 0. ]
[ 0. 0. 0.125]] <class 'efprob_qu.State'>
In [50]:
<class 'efprob_qu.State'>
In [65]:
array([ 0.375, 0.5 , 0.125])
In [70]:
[[ 0.5 0. ]
[ 0. 0.5]]
In [51]:
[[ 0.5 0. ]
[ 0. 0.5]]
In [74]:
[[ 1. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]]
In [91]:
[[1 0]
[0 0]]