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, 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))), Mult(r, 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}\right) - \left(r \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: 24
operands: 8
7Operationoperator: 9
operand: 12
8ExprTuple16, 11
9Literal
10ExprTuple12
11Operationoperator: 19
operands: 13
12Operationoperator: 24
operands: 14
13ExprTuple22, 15
14ExprTuple16, 17
15Operationoperator: 24
operands: 18
16Variable
17Operationoperator: 19
operands: 20
18ExprTuple26, 21
19Literal
20ExprTuple22, 23
21Variable
22Literal
23Operationoperator: 24
operands: 25
24Literal
25ExprTuple26, 27
26Literal
27Variable