algebra.render
Functionality for pretty-printing multivectors in Jupyter notebooks
align(lhs, mv, func=lambda x: x)
Render a vector or a bivector with each component on a separate line
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lhs
|
Symbol
|
String to put on the left hand side of the rendered equality |
required |
mv
|
Mv
|
Multivector whose components are to be rendered on the right hand side, one per line |
required |
func
|
Callable[[Mv], Mv]
|
Manipulation to be performed on each coefficient of the given vector or bivector |
lambda x: x
|
Returns:
| Type | Description |
|---|---|
Math
|
IPython.display.Math object holding the rendered LaTeX output |
Source code in src/analemma/algebra/render.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
expression(lhs, rhs)
Render an expression
For example,
\(f_1\wedge f_2 = \cos(\alpha) \, e_1 \wedge e_2 - \sin(\alpha) \, e_2 \wedge 3_3\)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lhs
|
str
|
String to put on the left hand side of the rendered equality |
required |
rhs
|
Symbol
|
Expression to be placed on the right hand side of the rendered equality |
required |
Returns:
| Type | Description |
|---|---|
Math
|
IPython.display.Math object holding the rendered LaTeX output |
Source code in src/analemma/algebra/render.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
expressions(lhss, rhss)
Render multiple expressions
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lhss
|
Tuple[str]
|
Tuple of strings to put on the left hand side of each rendered equality |
required |
rhss
|
Tuple[Symbol]
|
Tuple of expressions to be placed on the right hand side of each rendered equality |
required |
Returns:
| Type | Description |
|---|---|
Math
|
IPython.display.Math object holding the rendered LaTeX output |
Source code in src/analemma/algebra/render.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
frame(symbol, frame)
Render a vector frame
For example,
\(f_1 = \cos(\alpha)\cos(\psi) e_1 + \sin(\psi) e_2 + \sin(\alpha)\cos(\psi) e_3\)
\(f_2 = -\cos(\alpha)\sin(\psi) e_1 + \cos(\psi) e_2 - \sin(\alpha)\sin(\psi) e_3\)
\(f_3 = -\sin(\alpha) e_1 + \cos(\alpha) e_3\)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Symbol to use for each vector in the frame |
required |
frame
|
Tuple[Mv]
|
Tuple of vectors to be rendered |
required |
Returns:
| Type | Description |
|---|---|
Math
|
IPython.display.Math object holding the rendered LaTeX output |
Source code in src/analemma/algebra/render.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
multivector(mv)
Render a GAlgebra multivector in a manner compatible with mkdocs
Multivector mv on its own in a cell appears fine in the notebook but when nbconverted to Markdown comes out as \begin{equation} x \end{equation} instead of eg \(\displaystyle x\) and consequently isn't rendered in HTML after running mkdocs.
Source code in src/analemma/algebra/render.py
12 13 14 15 16 17 18 19 20 | |
simplification(lhs, stages, as_lines=None)
Render the simplification of a vector or a bivector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lhs
|
str
|
String to put on the left hand side of the rendered equality |
required |
stages
|
Tuple[Mv]
|
Tuple of equivalent multivectors in different forms |
required |
as_lines
|
Tuple[bool]
|
Flag to indicate whether to render each stage in multiline format |
None
|
Returns:
| Type | Description |
|---|---|
Math
|
IPython.display.Math object holding the rendered LaTeX output |
Source code in src/analemma/algebra/render.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |