Skip to main content

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qspin-0.1.tar.gz (5.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page