| Copyright | (c) Scott N. Walck 2016-2018 |
|---|---|
| License | BSD3 (see LICENSE) |
| Maintainer | Scott N. Walck <walck@lvc.edu> |
| Stability | experimental |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Physics.Learn.Ket
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
- kron :: a -> a -> a
- possibleOutcomes :: Operator -> [Double]
- outcomesProjectors :: Operator -> [(Double, Operator)]
- outcomesProbabilities :: Operator -> Ket -> [(Double, Double)]
- class Mult a b c | a b -> c where
- (<>) :: a -> b -> c
- class Dagger a b | a -> b where
- dagger :: a -> b
- class HasNorm a where
- class Representable a b | a -> b where
- rep :: OrthonormalBasis -> a -> b
- dim :: a -> Int
- 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.
Instances
A bra vector describes the state of a quantum system.
Instances
An operator describes an observable (a Hermitian operator) or an action (a unitary operator).
Instances
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 Source #
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 Source #
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 Source #
Pauli operator for an arbitrary direction given by spherical coordinates theta and phi.
sn' :: Double -> Double -> Operator Source #
Alternative definition of Pauli operator for an arbitrary direction.
Quantum Dynamics
timeEvOp :: Double -> Operator -> Operator Source #
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 Source #
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
Measurement
possibleOutcomes :: Operator -> [Double] Source #
The possible outcomes of a measurement of an observable. These are the eigenvalues of the operator of the observable.
outcomesProjectors :: Operator -> [(Double, Operator)] Source #
Given an obervable, return a list of pairs of possible outcomes and projectors for each outcome.
outcomesProbabilities :: Operator -> Ket -> [(Double, Double)] Source #
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 Source #
Generic multiplication including inner product, outer product, operator product, and whatever else makes sense. No conjugation takes place in this operation.
Instances
| Mult C C C Source # | |
| Mult C Bra Bra Source # | |
| Mult C Ket Ket Source # | |
| Mult C Operator Operator Source # | |
| Mult Bra C Bra Source # | |
| Mult Bra Ket C Source # | |
| Mult Bra Operator Bra Source # | |
| Mult Ket C Ket Source # | |
| Mult Ket Bra Operator Source # | |
| Mult Operator C Operator Source # | |
| Mult Operator Ket Ket Source # | |
| Mult Operator Operator Operator Source # | |
Adjoint operation
class Dagger a b | a -> b where Source #
The adjoint operation on complex numbers, kets, bras, and operators.
Normalization
Representation
class Representable a b | a -> b where Source #
Orthonormal bases
data OrthonormalBasis Source #
An orthonormal basis of kets.
Instances
| Show OrthonormalBasis Source # | |
Defined in Physics.Learn.Ket Methods showsPrec :: Int -> OrthonormalBasis -> ShowS # show :: OrthonormalBasis -> String # showList :: [OrthonormalBasis] -> ShowS # | |
makeOB :: [Ket] -> OrthonormalBasis Source #
Make an orthonormal basis from a list of linearly independent kets.
listBasis :: OrthonormalBasis -> [Ket] Source #
size :: OrthonormalBasis -> Int Source #