logo

Expression of type Lambda

from the theory of proveit.numbers.absolute_value

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 Conditional, Lambda, r, theta
from proveit.logic import And, Equals, InSet
from proveit.numbers import Abs, Exp, Mult, Real, e, i
In [2]:
# build up the expression from sub-expressions
expr = Lambda([r, theta], Conditional(Equals(Abs(Mult(r, Exp(e, Mult(i, theta)))), Abs(r)), And(InSet(r, Real), InSet(theta, Real))))
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(r, \theta\right) \mapsto \left\{\left|r \cdot \mathsf{e}^{\mathsf{i} \cdot \theta}\right| = \left|r\right| \textrm{ if } r \in \mathbb{R} ,  \theta \in \mathbb{R}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple22, 31
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 14
operand: 19
10Operationoperator: 14
operand: 22
11Operationoperator: 17
operands: 16
12Operationoperator: 17
operands: 18
13ExprTuple19
14Literal
15ExprTuple22
16ExprTuple22, 20
17Literal
18ExprTuple31, 20
19Operationoperator: 28
operands: 21
20Literal
21ExprTuple22, 23
22Variable
23Operationoperator: 24
operands: 25
24Literal
25ExprTuple26, 27
26Literal
27Operationoperator: 28
operands: 29
28Literal
29ExprTuple30, 31
30Literal
31Variable