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 details)

Uploaded Source

File details

Details for the file qspin-0.1.tar.gz.

File metadata

  • Download URL: qspin-0.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for qspin-0.1.tar.gz
Algorithm Hash digest
SHA256 8666be1a5dd732a6f2da0ae92c3e7333e5c1a572dee4f3323edb95f27b1f9e20
MD5 a2a2f479ec24e9cc69d4c5859bcebebc
BLAKE2b-256 58d26323c69b480d4646ef0d66be823a7dd0672c929f4198b2aa128cd6c68314

See more details on using hashes here.

Supported by

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