Learn quantum spin and entanglement
Project description
Quantum Spin
This is a little package that will help with learning how quantum spin and entanglement work. It is meant to complement some of the “theoretical minimum” lectures and other web resources.
Book: Quantum Mechanics - The Theoretical Minimum, Leanoard Susskind and Art Friedman, Basic Books, 2014. (mostly chapters 6&7)
[http://theoreticalminimum.com/courses/quantum-mechanics/2012/winter/lecture-6] and 7
Eventually I hope to work this in to understanding quantum computing.
Examples of code use.
Out-of-the box tests:
from qspin import *
test_spin()
test_entangled()
Symbolic states, up, down and linear combinations to form mixed states
>>> u
1.0 |u>
>>> d
1.0 |d>
>>> u + d
1.0 |u> + 1.0 |d>
>>> u + i*d
(1+0j) |u> + 1j |d>
Operators
>>> sx
[[0 1]
[1 0]]
>>> sy
[[ 0.+0.j -0.-1.j]
[ 0.+1.j 0.+0.j]]
>>> sz
[[ 1 0]
[ 0 -1]]
>>> sz*u
1.0 |u>
>>> sz*d
-1.0 |d>
Expected value (.H is Hermetian conjugate)
>> u.H*sz*u
1.0
Two-particle states, formed as tensor products
>>> uu = u**u
>>> ud = u**d
>>> du = d**u
>>> dd = d**d
>>> uu
1.0 |uu>
>>> ud
1.0 |ud>
>>> du
1.0 |du>
>>> dd
1.0 |dd>
>>> (ud - du).normalized()
0.707106781187 |ud> - 0.707106781187 |du>
Same with two-particle operators - tensor products of single particle operators. s0 is the identity operator.
>>> sigx = s0**sx
>>> taux = sx**s0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.