learn-physics- Haskell code for learning physics

Copyright(c) Scott N. Walck 2016
LicenseBSD3 (see LICENSE)
MaintainerScott N. Walck <walck@lvc.edu>
Safe HaskellNone



This module contains functions for displaying the state of a spin-1/2 particle or other quantum two-level system as a point on the Bloch Sphere.



type VisObj = VisObject Double Source

A Vis object.

toPos :: Vector C -> Position Source

Convert a 2x1 complex state vector for a qubit into Bloch (x,y,z) coordinates.

staticBlochSphere :: Position -> VisObj Source

A static VisObj for the state of a qubit.

displayStaticState :: Vector C -> IO () Source

Display a qubit state vector as a point on the Bloch Sphere.

animatedBlochSphere :: (Double -> Position) -> Float -> VisObj Source

Given a Bloch vector as a function of time, return a VisObj as a function of time.

simulateBlochSphere :: Double -> Vector C -> (Float -> (Float, Vector C) -> (Float, Vector C)) -> IO () Source

Given a sample rate, initial qubit state vector, and state propagation function, produce a simulation. The Float in the state propagation function is the time since the beginning of the simulation.

stateProp :: (Double -> Matrix C) -> Float -> (Float, Vector C) -> (Float, Vector C) Source

Produce a state propagation function from a time-dependent Hamiltonian.

evolutionBlochSphere :: Vector C -> (Double -> Matrix C) -> IO () Source

Given an initial qubit state and a time-dependent Hamiltonian, produce a visualization.

hamRabi :: Double -> Double -> Double -> Double -> Matrix C Source

Hamiltonian for nuclear magnetic resonance. Explain omega0, omegaR, omega.