logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.addition

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, Function, N, k, v, vk
from proveit.linear_algebra import ScalarMult, VecAdd, VecSum
from proveit.numbers import Exp, Interval, Mult, e, i, one, pi, two, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [k]
sub_expr2 = ScalarMult(Exp(e, Mult(two, pi, i, k)), vk)
expr = ExprTuple(VecSum(index_or_indices = sub_expr1, summand = sub_expr2, domain = Interval(zero, N)), VecAdd(Function(v, [zero]), VecSum(index_or_indices = sub_expr1, summand = sub_expr2, domain = Interval(one, 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(\sum_{k=0}^{N} \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot k} \cdot v\left(k\right)\right), v\left(0\right) + \left(\sum_{k=1}^{N} \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot k} \cdot v\left(k\right)\right)\right)\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: 11
operand: 6
2Operationoperator: 4
operands: 5
3ExprTuple6
4Literal
5ExprTuple7, 8
6Lambdaparameter: 44
body: 9
7Operationoperator: 31
operand: 25
8Operationoperator: 11
operand: 14
9Conditionalvalue: 18
condition: 13
10ExprTuple25
11Literal
12ExprTuple14
13Operationoperator: 23
operands: 15
14Lambdaparameter: 44
body: 16
15ExprTuple44, 17
16Conditionalvalue: 18
condition: 19
17Operationoperator: 33
operands: 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20ExprTuple25, 38
21Literal
22ExprTuple26, 27
23Literal
24ExprTuple44, 28
25Literal
26Operationoperator: 29
operands: 30
27Operationoperator: 31
operand: 44
28Operationoperator: 33
operands: 34
29Literal
30ExprTuple35, 36
31Variable
32ExprTuple44
33Literal
34ExprTuple37, 38
35Literal
36Operationoperator: 39
operands: 40
37Literal
38Variable
39Literal
40ExprTuple41, 42, 43, 44
41Literal
42Literal
43Literal
44Variable