How to use the bra-ket notation with SigSpace¶
In quantum theory, operators play a central role to obtain physical quantities such as momentum or energy. A widely used nomenclature to simplify the use of operators is the bra-ket notation. Its terms are easy to read, compact and provide a direct way to express and compute various physical quantities. For more details on the mathematical background, refer to Bra-ket notation.
SigSpace supports simple bra-ket expressions, allowing you to quickly evaluate wave functions. The following terms can be used directly in python:
No. | Syntax | Description |
---|---|---|
1. | B = O\|A> ket |
Applies the operator O to the state A and stores the result in a new state B. |
2. | C = bra <A\|B> ket |
Represents the inner product. The states A and B are multiplied and the integrated value is returned. |
3. | C = bra <A\|O\|B> ket |
Returns the expectation value calculated by the operator O. Often A and B are identical. For example to determine the energy of a state |
The keywords "bra" and "ket" are needed to fulfill the python syntax and must be imported from SigSpace.
The following operators are defined by default. These expressions are particularly useful for computing the expectation value (expression 3 in table above).
Symbol | Name | Description |
---|---|---|
X | Position operator | Is used to calculate the expected position of a particle. |
I | Identity operator | This is the "1" element of the operator algebra. Applied to a state it will return a copy of the state. |
U | Time operator | The time operator is used to obtain the time evolution of the state. It takes a value as parameter. See example below. |
P | Momentum operator | Computes the impulse of a wave function. |
H | Hamiltonian | The hamiltonian of course is itself an operator. Its definition is explained in the first tutorials. |
grad | Gradient operator | Returns the first derivative of the wave function. The returned state will (e.g. in term No. 1) will have as many columns as the problem has dimensions. |
laplace | Laplace operator | The Laplace operator calculates the sum of the second derivative in all dimensions. |
Examples¶
Now that we've covered the theory, let's explore some examples. To perform real calculations, we’ll first create two states (psi1 and psi2) to be used with the operators:
import sigspace as sg
from sigspace.H.braket import *
import numpy as np
H = sg.Hamiltonian(sdims=1) + (lambda x: -1/(1+(x-2)**2))
solver = sg.Solver(H)
solver.grid(-20, 20, 200)
sol = solver.run()
psi1 = sol.state
E1 = sol.energy
sg.quickplot(sol)
solver.nodes.add(sg.PointNode())
sol = solver.run()
psi2 = sol.state
E2 = sol.energy
sg.quickplot(sol)