Dimensionality and default coordinates¶
Dimensionality is to a large extent defined implicitly in Braketlab, meaning that there is no universal variable defining the dimensionality of integrals or visualization routines.
Rather, a ket has a number of coordinates associated with each dimension (and potentially various particles in the system). The default coordinates can be obtained as Sympy
-variables as follows:
import braketlab as bk
import sympy as sp
x,y,z = bk.get_default_variables(0,3) #for particle p=0, get three default coordinates
x + y + z # display the variables in a sum
Kets are initialized with a Sympy-function, from which the number of variables are taken as the dimensionality. Thus, for a one dimensional system we may do
p = bk.ket( sp.sin(2.0*x)*sp.exp(-.1*x**2) )
p.view(web = True)
For a two-dimensional system, we have instead
p = bk.ket( x* sp.cos(0.2*(x**2 + y**2))*sp.exp(-.5*(x**2 + y**2)) )
p.view()
..and the three-dimensional case, which happens to be our own world:
p = bk.ket( x*y*sp.exp(-0.5*(x**2 + y**2 + z**2) ) )
p.view()
What is beyond the third dimension?¶
BraketLab is totally fine working in more than three dimensions, so feel free to define something like
x,y,z,w = bk.get_default_variables(0,4)
p = bk.ket( x*y*sp.exp(-0.5*(x**2 + y**2 + z**2 + w**2) ) )
While the algebraic treatment is agnostic to the number of dimensions, the visualization can only handle up to three dimensions. Thus, calling
p.view(web = True)
... will only show a projection onto the first three dimensions.