logo

Expression of type Lambda

from the theory of proveit.linear_algebra.matrices.exponentiation

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 A, Conditional, Lambda, m, rho, x
from proveit.linear_algebra import MatrixExp, MatrixMult, ScalarMult
from proveit.logic import Equals
from proveit.numbers import Exp, Mult, e, i, pi, two
In [2]:
# build up the expression from sub-expressions
expr = Lambda([A, x], Conditional(Equals(MatrixMult(MatrixExp(A, m), x), ScalarMult(Exp(e, Mult(two, pi, i, Mult(m, rho))), x)), Equals(MatrixMult(A, x), ScalarMult(Exp(e, Mult(two, pi, i, rho)), 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(A, x\right) \mapsto \left\{\left(A^{m} \thinspace x\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(m \cdot \rho\right)} \cdot x\right) \textrm{ if } \left(A \thinspace x\right) = \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \rho} \cdot x\right)\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 14
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 5
operands: 4
3Operationoperator: 5
operands: 6
4ExprTuple7, 8
5Literal
6ExprTuple9, 10
7Operationoperator: 13
operands: 11
8Operationoperator: 15
operands: 12
9Operationoperator: 13
operands: 14
10Operationoperator: 15
operands: 16
11ExprTuple17, 20
12ExprTuple18, 20
13Literal
14ExprTuple26, 20
15Literal
16ExprTuple19, 20
17Operationoperator: 21
operands: 22
18Operationoperator: 24
operands: 23
19Operationoperator: 24
operands: 25
20Variable
21Literal
22ExprTuple26, 38
23ExprTuple28, 27
24Literal
25ExprTuple28, 29
26Variable
27Operationoperator: 36
operands: 30
28Literal
29Operationoperator: 36
operands: 31
30ExprTuple33, 34, 35, 32
31ExprTuple33, 34, 35, 39
32Operationoperator: 36
operands: 37
33Literal
34Literal
35Literal
36Literal
37ExprTuple38, 39
38Variable
39Variable