logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.QFT

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprTuple, k, l, n
from proveit.numbers import Exp, Mult, Neg, e, frac, i, one, pi, two
from proveit.physics.quantum import NumBra, NumKet, Qmult
from proveit.physics.quantum.QFT import InverseFourierTransform
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Qmult(NumBra(l, n), InverseFourierTransform(n), NumKet(k, n)), Mult(frac(one, Exp(two, frac(n, two))), Exp(e, frac(Neg(Mult(two, pi, i, k, l)), Exp(two, n)))))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left({_{n}}\langle l \rvert \thinspace {\mathrm {FT}}^{\dag}_{n} \thinspace \lvert k \rangle_{n}, \frac{1}{2^{\frac{n}{2}}} \cdot \mathsf{e}^{\frac{-\left(2 \cdot \pi \cdot \mathsf{i} \cdot k \cdot l\right)}{2^{n}}}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 3
operands: 4
2Operationoperator: 36
operands: 5
3Literal
4ExprTuple6, 7, 8
5ExprTuple9, 10
6Operationoperator: 11
operands: 12
7Operationoperator: 13
operand: 35
8Operationoperator: 15
operands: 16
9Operationoperator: 28
operands: 17
10Operationoperator: 32
operands: 18
11Literal
12ExprTuple42, 35
13Literal
14ExprTuple35
15Literal
16ExprTuple41, 35
17ExprTuple19, 20
18ExprTuple21, 22
19Literal
20Operationoperator: 32
operands: 23
21Literal
22Operationoperator: 28
operands: 24
23ExprTuple38, 25
24ExprTuple26, 27
25Operationoperator: 28
operands: 29
26Operationoperator: 30
operand: 34
27Operationoperator: 32
operands: 33
28Literal
29ExprTuple35, 38
30Literal
31ExprTuple34
32Literal
33ExprTuple38, 35
34Operationoperator: 36
operands: 37
35Variable
36Literal
37ExprTuple38, 39, 40, 41, 42
38Literal
39Literal
40Literal
41Variable
42Variable