Quantum mechanical operators.
TODO:
Base class for noncommuting quantum operators.
An operator maps between quantum states [R76]. In quantum mechanics, observables (including, but not limited to, measured physical values) are represented as Hermitian operators [R77].
Parameters :  args : tuple


References
[R76]  (1, 2) http://en.wikipedia.org/wiki/Operator_(physics) 
[R77]  (1, 2) http://en.wikipedia.org/wiki/Observable 
Examples
Create an operator and examine its attributes:
>>> from sympy.physics.quantum import Operator
>>> from sympy import symbols, I
>>> A = Operator('A')
>>> A
A
>>> A.hilbert_space
H
>>> A.label
(A,)
>>> A.is_commutative
False
Create another operator and do some arithmetic operations:
>>> B = Operator('B')
>>> C = 2*A*A + I*B
>>> C
2*A**2 + I*B
Operators don’t commute:
>>> A.is_commutative
False
>>> B.is_commutative
False
>>> A*B == B*A
False
Polymonials of operators respect the commutation properties:
>>> e = (A+B)**3
>>> e.expand()
A*B*A + A*B**2 + A**2*B + A**3 + B*A*B + B*A**2 + B**2*A + B**3
Operator inverses are handle symbolically:
>>> A.inv()
A**(1)
>>> A*A.inv()
1
A Hermitian operator that satisfies H == Dagger(H).
Parameters :  args : tuple


Examples
>>> from sympy.physics.quantum import Dagger, HermitianOperator
>>> H = HermitianOperator('H')
>>> Dagger(H)
H
A unitary operator that satisfies U*Dagger(U) == 1.
Parameters :  args : tuple


Examples
>>> from sympy.physics.quantum import Dagger, UnitaryOperator
>>> U = UnitaryOperator('U')
>>> U*Dagger(U)
1
An unevaluated outer product between a ket and bra.
This constructs an outer product between any subclass of KetBase and BraBase as a><b. An OuterProduct inherits from Operator as they act as operators in quantum expressions. For reference see [R78].
Parameters :  ket : KetBase
bar : BraBase


References
[R78]  (1, 2) http://en.wikipedia.org/wiki/Outer_product 
Examples
Create a simple outer product by hand and take its dagger:
>>> from sympy.physics.quantum import Ket, Bra, OuterProduct, Dagger
>>> from sympy.physics.quantum import Operator
>>> k = Ket('k')
>>> b = Bra('b')
>>> op = OuterProduct(k, b)
>>> op
k><b
>>> op.hilbert_space
H
>>> op.ket
k>
>>> op.bra
<b
>>> Dagger(op)
b><k
In simple products of kets and bras outer products will be automatically identified and created:
>>> k*b
k><b
But in more complex expressions, outer products are not automatically created:
>>> A = Operator('A')
>>> A*k*b
A*k>*<b
A user can force the creation of an outer product in a complex expression by using parentheses to group the ket and bra:
>>> A*(k*b)
A*k><b
An operator for representing the differential operator, i.e. d/dx
It is initialized by passing two arguments. The first is an arbitrary expression that involves a function, such as Derivative(f(x), x). The second is the function (e.g. f(x)) which we are to replace with the Wavefunction that this DifferentialOperator is applied to.
Parameters :  expr : Expr
func : Expr


Examples
You can define a completely arbitrary expression and specify where the Wavefunction is to be substituted
>>> from sympy import Derivative, Function, Symbol
>>> from sympy.physics.quantum.operator import DifferentialOperator
>>> from sympy.physics.quantum.state import Wavefunction
>>> from sympy.physics.quantum.qapply import qapply
>>> f = Function('f')
>>> x = Symbol('x')
>>> d = DifferentialOperator(1/x*Derivative(f(x), x), f(x))
>>> w = Wavefunction(x**2, x)
>>> d.function
f(x)
>>> d.variables
(x,)
>>> qapply(d*w)
Wavefunction(2, x)
Returns the arbitary expression which is to have the Wavefunction substituted into it
Examples
>>> from sympy.physics.quantum.operator import DifferentialOperator
>>> from sympy import Function, Symbol, Derivative
>>> x = Symbol('x')
>>> f = Function('f')
>>> d = DifferentialOperator(Derivative(f(x), x), f(x))
>>> d.expr
Derivative(f(x), x)
>>> y = Symbol('y')
>>> d = DifferentialOperator(Derivative(f(x, y), x) +
... Derivative(f(x, y), y), f(x, y))
>>> d.expr
Derivative(f(x, y), x) + Derivative(f(x, y), y)
Returns the function which is to be replaced with the Wavefunction
Examples
>>> from sympy.physics.quantum.operator import DifferentialOperator
>>> from sympy import Function, Symbol, Derivative
>>> x = Symbol('x')
>>> f = Function('f')
>>> d = DifferentialOperator(Derivative(f(x), x), f(x))
>>> d.function
f(x)
>>> y = Symbol('y')
>>> d = DifferentialOperator(Derivative(f(x, y), x) +
... Derivative(f(x, y), y), f(x, y))
>>> d.function
f(x, y)
Returns the variables with which the function in the specified arbitrary expression is evaluated
Examples
>>> from sympy.physics.quantum.operator import DifferentialOperator
>>> from sympy import Symbol, Function, Derivative
>>> x = Symbol('x')
>>> f = Function('f')
>>> d = DifferentialOperator(1/x*Derivative(f(x), x), f(x))
>>> d.variables
(x,)
>>> y = Symbol('y')
>>> d = DifferentialOperator(Derivative(f(x, y), x) +
... Derivative(f(x, y), y), f(x, y))
>>> d.variables
(x, y)