logo

Expression of type ExprTuple

from the theory of proveit.numbers.multiplication

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, a, b, c, d
from proveit.numbers import Exp, Mult, Neg, four, frac, one, sqrt, three, two
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Mult(frac(four, three), Exp(d, two), b, a, c)
expr = ExprTuple(Mult(sub_expr1, Exp(sqrt(b), Neg(one))), Mult(sub_expr1, Exp(b, Neg(frac(one, two)))))
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(\left(\frac{4}{3} \cdot d^{2} \cdot b \cdot a \cdot c\right) \cdot (\sqrt{b})^{-1}, \left(\frac{4}{3} \cdot d^{2} \cdot b \cdot a \cdot c\right) \cdot b^{-\frac{1}{2}}\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: 9
operands: 3
2Operationoperator: 9
operands: 4
3ExprTuple6, 5
4ExprTuple6, 7
5Operationoperator: 22
operands: 8
6Operationoperator: 9
operands: 10
7Operationoperator: 22
operands: 11
8ExprTuple12, 13
9Literal
10ExprTuple14, 15, 26, 16, 17
11ExprTuple26, 18
12Operationoperator: 22
operands: 19
13Operationoperator: 24
operand: 33
14Operationoperator: 31
operands: 21
15Operationoperator: 22
operands: 23
16Variable
17Variable
18Operationoperator: 24
operand: 30
19ExprTuple26, 30
20ExprTuple33
21ExprTuple27, 28
22Literal
23ExprTuple29, 34
24Literal
25ExprTuple30
26Variable
27Literal
28Literal
29Variable
30Operationoperator: 31
operands: 32
31Literal
32ExprTuple33, 34
33Literal
34Literal