logo

Expression of type Abs

from the theory of proveit.trigonometry

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, b, c, r
from proveit.numbers import Abs, Exp, Mult, e, i, subtract
In [2]:
# build up the expression from sub-expressions
expr = Abs(subtract(Mult(r, Exp(e, Mult(i, a)), c), Mult(r, c, Exp(e, Mult(i, b)))))
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(r \cdot \mathsf{e}^{\mathsf{i} \cdot a} \cdot c\right) - \left(r \cdot c \cdot \mathsf{e}^{\mathsf{i} \cdot b}\right)\right|
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 25
operands: 8
7Operationoperator: 9
operand: 12
8ExprTuple16, 11, 17
9Literal
10ExprTuple12
11Operationoperator: 20
operands: 13
12Operationoperator: 25
operands: 14
13ExprTuple23, 15
14ExprTuple16, 17, 18
15Operationoperator: 25
operands: 19
16Variable
17Variable
18Operationoperator: 20
operands: 21
19ExprTuple27, 22
20Literal
21ExprTuple23, 24
22Variable
23Literal
24Operationoperator: 25
operands: 26
25Literal
26ExprTuple27, 28
27Literal
28Variable