learn-physics-0.6.2: Haskell code for learning physics

Physics.Learn.QuantumMat

Description

This module contains state vectors and matrices for quantum mechanics.

Synopsis

Complex numbers

type C = Complex Double #

State Vectors

The state resulting from a measurement of spin angular momentum in the x direction on a spin-1/2 particle when the result of the measurement is hbar/2.

The state resulting from a measurement of spin angular momentum in the x direction on a spin-1/2 particle when the result of the measurement is -hbar/2.

The state resulting from a measurement of spin angular momentum in the y direction on a spin-1/2 particle when the result of the measurement is hbar/2.

The state resulting from a measurement of spin angular momentum in the y direction on a spin-1/2 particle when the result of the measurement is -hbar/2.

The state resulting from a measurement of spin angular momentum in the z direction on a spin-1/2 particle when the result of the measurement is hbar/2.

The state resulting from a measurement of spin angular momentum in the z direction on a spin-1/2 particle when the result of the measurement is -hbar/2.

The state resulting from a measurement of spin angular momentum in the direction specified by spherical angles theta (polar angle) and phi (azimuthal angle) on a spin-1/2 particle when the result of the measurement is hbar/2.

The state resulting from a measurement of spin angular momentum in the direction specified by spherical angles theta (polar angle) and phi (azimuthal angle) on a spin-1/2 particle when the result of the measurement is -hbar/2.

Dimension of a vector.

Scale a complex vector by a complex number.

Complex inner product. First vector gets conjugated.

Length of a complex vector.

Return a normalized version of a given state vector.

Arguments

 :: Vector C state vector -> Vector Double vector of probabilities

Return a vector of probabilities for a given state vector.

gramSchmidt :: [Vector C] -> [Vector C] Source #

Form an orthonormal list of complex vectors from a linearly independent list of complex vectors.

Conjugate the entries of a vector.

fromList :: [C] -> Vector C Source #

Construct a vector from a list of complex numbers.

toList :: Vector C -> [C] Source #

Produce a list of complex numbers from a vector.

Matrices (operators)

The Pauli X matrix.

The Pauli Y matrix.

The Pauli Z matrix.

Scale a complex matrix by a complex number.

Matrix product.

Matrix-vector product.

Vector-matrix product

Conjugate transpose of a matrix.

fromLists :: [[C]] -> Matrix C Source #

Construct a matrix from a list of lists of complex numbers.

toLists :: Matrix C -> [[C]] Source #

Produce a list of lists of complex numbers from a matrix.

size :: Matrix C -> (Int, Int) Source #

Size of a matrix.

matrixFunction :: (C -> C) -> Matrix C -> Matrix C Source #

Apply a function to a matrix. Assumes the matrix is a normal matrix (a matrix with an orthonormal basis of eigenvectors).

Density matrices

Complex outer product

Build a pure-state density matrix from a state vector.

Trace of a matrix.

Normalize a density matrix so that it has trace one.

The one-qubit totally mixed state.

Quantum Dynamics

Given a time step and a Hamiltonian matrix, produce a unitary time evolution matrix. Unless you really need the time evolution matrix, it is better to use timeEv, which gives the same numerical results without doing an explicit matrix inversion. The function assumes hbar = 1.

Given a time step and a Hamiltonian matrix, advance the state vector using the Schrodinger equation. This method should be faster than using timeEvMat since it solves a linear system rather than calculating an inverse matrix. The function assumes hbar = 1.

Given a Hamiltonian matrix, return a function from time to evolution matrix. Uses spectral decomposition. Assumes hbar = 1.

Composition

class Kronecker a where Source #

Minimal complete definition

kron

Methods

kron :: a -> a -> a Source #

Instances

 Product t => Kronecker (Matrix t) Source # Methodskron :: Matrix t -> Matrix t -> Matrix t Source # Product t => Kronecker (Vector t) Source # Methodskron :: Vector t -> Vector t -> Vector t Source #

Measurement

The possible outcomes of a measurement of an observable. These are the eigenvalues of the matrix of the observable.

Given an obervable, return a list of pairs of possible outcomes and projectors for each outcome.

Given an observable and a state vector, return a list of pairs of possible outcomes and probabilites for each outcome.

Vector and Matrix

data Vector a :: * -> * #

Storable-based vectors

Instances