logo

Expression of type ExprTuple

from the theory of proveit.numbers.summation

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, i, j, k, x
from proveit.numbers import Add, Exp, Interval, Sum, frac, one, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Sum(index_or_indices = [i], summand = Exp(x, i), domain = Interval(j, k)), frac(subtract(Exp(x, j), Exp(x, Add(k, one))), subtract(one, x)))
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(\sum_{i = j}^{k} x^{i}, \frac{x^{j} - x^{k + 1}}{1 - x}\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
operand: 7
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7
5Literal
6ExprTuple8, 9
7Lambdaparameter: 26
body: 11
8Operationoperator: 36
operands: 12
9Operationoperator: 36
operands: 13
10ExprTuple26
11Conditionalvalue: 14
condition: 15
12ExprTuple16, 17
13ExprTuple39, 18
14Operationoperator: 31
operands: 19
15Operationoperator: 20
operands: 21
16Operationoperator: 31
operands: 22
17Operationoperator: 24
operand: 28
18Operationoperator: 24
operand: 34
19ExprTuple34, 26
20Literal
21ExprTuple26, 27
22ExprTuple34, 33
23ExprTuple28
24Literal
25ExprTuple34
26Variable
27Operationoperator: 29
operands: 30
28Operationoperator: 31
operands: 32
29Literal
30ExprTuple33, 38
31Literal
32ExprTuple34, 35
33Variable
34Variable
35Operationoperator: 36
operands: 37
36Literal
37ExprTuple38, 39
38Variable
39Literal