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 Abs, Exp, Mult, e, frac, i, one, pi, subtract, two
from proveit.physics.quantum.QPE import _delta_b_floor, _two_pow_t
from proveit.trigonometry import Sin
In [2]:
# build up the expression from sub-expressions
expr = Mult(frac(one, _two_pow_t), frac(Abs(subtract(one, Exp(e, Mult(two, pi, i, subtract(Mult(_two_pow_t, _delta_b_floor), l))))), Mult(two, Sin(Mult(pi, Abs(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{\left|1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(\left(2^{t} \cdot \delta_{b_{\textit{f}}}\right) - l\right)}\right|}{2 \cdot \sin{\left(\pi \cdot \left|\delta_{b_{\textit{f}}} - \frac{l}{2^{t}}\right|\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: 40
operands: 1
1ExprTuple2, 3
2Operationoperator: 44
operands: 4
3Operationoperator: 44
operands: 5
4ExprTuple15, 48
5ExprTuple6, 7
6Operationoperator: 23
operand: 10
7Operationoperator: 40
operands: 9
8ExprTuple10
9ExprTuple54, 11
10Operationoperator: 34
operands: 12
11Operationoperator: 13
operand: 17
12ExprTuple15, 16
13Literal
14ExprTuple17
15Literal
16Operationoperator: 42
operand: 20
17Operationoperator: 40
operands: 19
18ExprTuple20
19ExprTuple30, 21
20Operationoperator: 51
operands: 22
21Operationoperator: 23
operand: 27
22ExprTuple25, 26
23Literal
24ExprTuple27
25Literal
26Operationoperator: 40
operands: 28
27Operationoperator: 34
operands: 29
28ExprTuple54, 30, 31, 32
29ExprTuple46, 33
30Literal
31Literal
32Operationoperator: 34
operands: 35
33Operationoperator: 42
operand: 39
34Literal
35ExprTuple37, 38
36ExprTuple39
37Operationoperator: 40
operands: 41
38Operationoperator: 42
operand: 47
39Operationoperator: 44
operands: 45
40Literal
41ExprTuple48, 46
42Literal
43ExprTuple47
44Literal
45ExprTuple47, 48
46Operationoperator: 49
operand: 53
47Variable
48Operationoperator: 51
operands: 52
49Literal
50ExprTuple53
51Literal
52ExprTuple54, 55
53Literal
54Literal
55Literal