logo

Expression of type Mult

from the theory of proveit.physics.quantum.QPE

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 l
from proveit.numbers import Exp, Mult, e, frac, i, one, pi, subtract, two
from proveit.physics.quantum.QPE import _delta_b_floor, _two_pow_t
In [2]:
# build up the expression from sub-expressions
expr = Mult(frac(one, _two_pow_t), frac(subtract(one, Exp(e, Mult(two, pi, i, subtract(Mult(_two_pow_t, _delta_b_floor), l)))), subtract(one, Exp(e, Mult(two, pi, i, subtract(_delta_b_floor, frac(l, _two_pow_t)))))))
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())
\frac{1}{2^{t}} \cdot \frac{1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(\left(2^{t} \cdot \delta_{b_{\textit{f}}}\right) - l\right)}}{1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(\delta_{b_{\textit{f}}} - \frac{l}{2^{t}}\right)}}
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 34
operands: 1
1ExprTuple2, 3
2Operationoperator: 43
operands: 4
3Operationoperator: 43
operands: 5
4ExprTuple11, 47
5ExprTuple6, 7
6Operationoperator: 29
operands: 8
7Operationoperator: 29
operands: 9
8ExprTuple11, 10
9ExprTuple11, 12
10Operationoperator: 37
operand: 15
11Literal
12Operationoperator: 37
operand: 16
13ExprTuple15
14ExprTuple16
15Operationoperator: 48
operands: 17
16Operationoperator: 48
operands: 18
17ExprTuple20, 19
18ExprTuple20, 21
19Operationoperator: 34
operands: 22
20Literal
21Operationoperator: 34
operands: 23
22ExprTuple50, 25, 26, 24
23ExprTuple50, 25, 26, 27
24Operationoperator: 29
operands: 28
25Literal
26Literal
27Operationoperator: 29
operands: 30
28ExprTuple31, 32
29Literal
30ExprTuple39, 33
31Operationoperator: 34
operands: 35
32Operationoperator: 37
operand: 46
33Operationoperator: 37
operand: 40
34Literal
35ExprTuple47, 39
36ExprTuple46
37Literal
38ExprTuple40
39Operationoperator: 41
operand: 45
40Operationoperator: 43
operands: 44
41Literal
42ExprTuple45
43Literal
44ExprTuple46, 47
45Literal
46Variable
47Operationoperator: 48
operands: 49
48Literal
49ExprTuple50, 51
50Literal
51Literal