Skip to content

Instantly share code, notes, and snippets.

-- boilerplate functions
natToInt : Nat -> Int
natToInt Z = 0
natToInt (S n) = 1 + (natToInt n)
natToString : Nat -> String
natToString n = show (natToInt n)
module Matrices
-- Vector stuff ~ maybe put Prelude.Vect
||| Dot product between numerical vectors
dot : Num a => Vect n a -> Vect n a -> a
dot w v = sum (zipWith (*) w v)
||| Numerical vector times a scalar of the appropriate type
@fieldstrength
fieldstrength / Sigmas.hs
Last active August 29, 2015 13:56
Higher sigma operators: basic building blocks for quantum observables
-- Sigmas Module ~ Higher Sigma operators and their operator algebra
-- Cliff Harvey
-- February 2014
module Sigmas where
import Control.Applicative
-- 4 basic complex phases: 1, -1, i, -i
data Phase = P1 | M1 | Pi | Mi deriving Eq