| Copyright | (c) Scott N. Walck 2016-2018 |
|---|---|
| License | BSD3 (see LICENSE) |
| Maintainer | Scott N. Walck <walck@lvc.edu> |
| Stability | experimental |
| Safe Haskell | Safe |
| Language | Haskell98 |
Physics.Learn.Ket
Contents
Description
This module contains ket vectors, bra vectors, and operators for quantum mechanics.
Synopsis
- type C = Complex Double
- i :: C
- magnitude :: C -> Double
- data Ket
- data Bra
- data Operator
- xp :: Ket
- xm :: Ket
- yp :: Ket
- ym :: Ket
- zp :: Ket
- zm :: Ket
- np :: Double -> Double -> Ket
- nm :: Double -> Double -> Ket
- sx :: Operator
- sy :: Operator
- sz :: Operator
- sn :: Double -> Double -> Operator
- sn' :: Double -> Double -> Operator
- timeEvOp :: Double -> Operator -> Operator
- timeEv :: Double -> Operator -> Ket -> Ket
- class Kron a where
- possibleOutcomes :: Operator -> [Double]
- outcomesProjectors :: Operator -> [(Double, Operator)]
- outcomesProbabilities :: Operator -> Ket -> [(Double, Double)]
- class Mult a b c | a b -> c where
- class Dagger a b | a -> b where
- class HasNorm a where
- class Representable a b | a -> b where
- data OrthonormalBasis
- makeOB :: [Ket] -> OrthonormalBasis
- listBasis :: OrthonormalBasis -> [Ket]
- size :: OrthonormalBasis -> Int
- xBasis :: OrthonormalBasis
- yBasis :: OrthonormalBasis
- zBasis :: OrthonormalBasis
- nBasis :: Double -> Double -> OrthonormalBasis
Basic data types
A ket vector describes the state of a quantum system.
A bra vector describes the state of a quantum system.
An operator describes an observable (a Hermitian operator) or an action (a unitary operator).
Instances
| Num Operator # | |
| Show Operator # | |
| Kron Operator # | |
| Dagger Operator Operator # | |
Defined in Physics.Learn.Ket | |
| Mult C Operator Operator # | |
| Mult Bra Operator Bra # | |
| Mult Operator C Operator # | |
| Mult Operator Operator Operator # | |
| Mult Operator Ket Ket # | |
| Mult Ket Bra Operator # | |
| Representable Operator (Matrix C) # | |
Kets for spin-1/2 particles
State of a spin-1/2 particle if measurement in the x-direction would give angular momentum +hbar/2.
State of a spin-1/2 particle if measurement in the x-direction would give angular momentum -hbar/2.
State of a spin-1/2 particle if measurement in the y-direction would give angular momentum +hbar/2.
State of a spin-1/2 particle if measurement in the y-direction would give angular momentum -hbar/2.
State of a spin-1/2 particle if measurement in the z-direction would give angular momentum +hbar/2.
State of a spin-1/2 particle if measurement in the z-direction would give angular momentum -hbar/2.
np :: Double -> Double -> Ket #
State of a spin-1/2 particle if measurement in the n-direction, described by spherical polar angle theta and azimuthal angle phi, would give angular momentum +hbar/2.
nm :: Double -> Double -> Ket #
State of a spin-1/2 particle if measurement in the n-direction, described by spherical polar angle theta and azimuthal angle phi, would give angular momentum -hbar/2.
Operators for spin-1/2 particles
sn :: Double -> Double -> Operator #
Pauli operator for an arbitrary direction given by spherical coordinates theta and phi.
sn' :: Double -> Double -> Operator #
Alternative definition of Pauli operator for an arbitrary direction.
Quantum Dynamics
timeEvOp :: Double -> Operator -> Operator #
Given a time step and a Hamiltonian operator,
produce a unitary time evolution operator.
Unless you really need the time evolution operator,
it is better to use timeEv, which gives the
same numerical results without doing an explicit
matrix inversion. The function assumes hbar = 1.
timeEv :: Double -> Operator -> Ket -> Ket #
Given a time step and a Hamiltonian operator,
advance the state ket using the Schrodinger equation.
This method should be faster than using timeEvOp
since it solves a linear system rather than calculating
an inverse matrix. The function assumes hbar = 1.
Composition
Minimal complete definition
Measurement
possibleOutcomes :: Operator -> [Double] #
The possible outcomes of a measurement of an observable. These are the eigenvalues of the operator of the observable.
outcomesProjectors :: Operator -> [(Double, Operator)] #
Given an obervable, return a list of pairs of possible outcomes and projectors for each outcome.
outcomesProbabilities :: Operator -> Ket -> [(Double, Double)] #
Given an observable and a state ket, return a list of pairs of possible outcomes and probabilites for each outcome.
Generic multiplication
class Mult a b c | a b -> c where #
Generic multiplication including inner product, outer product, operator product, and whatever else makes sense. No conjugation takes place in this operation.
Minimal complete definition
Adjoint operation
class Dagger a b | a -> b where #
The adjoint operation on complex numbers, kets, bras, and operators.
Minimal complete definition
Instances
| Dagger C C # | |
Defined in Physics.Learn.Ket | |
| Dagger Bra Ket # | |
Defined in Physics.Learn.Ket | |
| Dagger Operator Operator # | |
Defined in Physics.Learn.Ket | |
| Dagger Ket Bra # | |
Defined in Physics.Learn.Ket | |
Normalization
Representation
class Representable a b | a -> b where #
Instances
| Representable Bra (Vector C) # | |
| Representable Operator (Matrix C) # | |
| Representable Ket (Vector C) # | |
Orthonormal bases
data OrthonormalBasis #
An orthonormal basis of kets.
Instances
| Show OrthonormalBasis # | |
Defined in Physics.Learn.Ket Methods showsPrec :: Int -> OrthonormalBasis -> ShowS # show :: OrthonormalBasis -> String # showList :: [OrthonormalBasis] -> ShowS # | |
makeOB :: [Ket] -> OrthonormalBasis #
Make an orthonormal basis from a list of linearly independent kets.
listBasis :: OrthonormalBasis -> [Ket] #
size :: OrthonormalBasis -> Int #