Debian Codegraph @

texmf-dist/doc/lualatex/luacas/reference/ref_algebra/ref_algebra.tex

raw
1 \documentclass{article}
2
3 \usepackage{luacas}
4 \usepackage{amsmath}
5 \usepackage{amssymb}
6
7 \usepackage[margin=1in]{geometry}
8 \usepackage[shortlabels]{enumitem}
9
10 \usepackage{pgfplots}
11 \pgfplotsset{compat=1.18}
12 \usetikzlibrary{positioning,calc}
13 \usepackage{forest}
14 \usepackage{minted}
15 \usemintedstyle{pastie}
16 \usepackage[hidelinks]{hyperref}
17 \usepackage{parskip}
18 \usepackage{multicol}
19 \usepackage[most]{tcolorbox}
20 \tcbuselibrary{xparse,documentation}
21 \usepackage{microtype}
22 \usepackage{makeidx}
23
24 \usepackage[
25 backend=biber,
26 style=numeric,
27 ]{biblatex}
28 \addbibresource{sources.bib}
29
30 \definecolor{rose}{RGB}{128,0,0}
31 \definecolor{roseyellow}{RGB}{222,205,99}
32 \definecolor{roseblue}{RGB}{167,188,214}
33 \definecolor{rosenavy}{RGB}{79,117,139}
34 \definecolor{roseorange}{RGB}{232,119,34}
35 \definecolor{rosegreen}{RGB}{61,68,30}
36 \definecolor{rosewhite}{RGB}{223,209,167}
37 \definecolor{rosebrown}{RGB}{108,87,27}
38 \definecolor{rosegray}{RGB}{84,88,90}
39
40 \definecolor{codegreen}{HTML}{49BE25}
41
42 \newtcolorbox{codebox}[1][sidebyside]{
43 enhanced,skin=bicolor,
44 #1,
45 arc=1pt,
46 colframe=brown,
47 colback=brown!15,colbacklower=white,
48 boxrule=1pt,
49 notitle
50 }
51
52 \newtcolorbox{codehead}[1][]{
53 enhanced,
54 frame hidden,
55 colback=rosegray!15,
56 boxrule=0mm,
57 leftrule=5mm,
58 rightrule=5mm,
59 boxsep=0mm,
60 arc=0mm,
61 outer arc=0mm,
62 left=3mm,
63 right=3mm,
64 top=1mm,
65 bottom=1mm,
66 toptitle=1mm,
67 bottomtitle=1mm,
68 oversize,
69 #1
70 }
71
72 \usepackage{varwidth}
73
74 \newtcolorbox{newcodehead}[2][]{
75 enhanced,
76 frame hidden,
77 colback=rosegray!15,
78 boxrule=0mm,
79 leftrule=5mm,
80 rightrule=5mm,
81 boxsep=0mm,
82 arc=0mm,
83 outer arc=0mm,
84 left=3mm,
85 right=3mm,
86 top=1mm,
87 bottom=1mm,
88 toptitle=1mm,
89 bottomtitle=1mm,
90 oversize,
91 #1,
92 fonttitle=\bfseries\ttfamily\footnotesize,
93 coltitle=rosegray,
94 attach boxed title to top text right,
95 boxed title style={frame hidden,
96 size=small,
97 bottom=-1mm,
98 interior style={fill=none,
99 top color=white,
100 bottom color=white}
101 },
102 title={#2}
103 }
104
105 \makeindex
106
107 \newcommand{\coderef}[2]{%
108 \begin{codehead}[sidebyside,segmentation hidden]%
109 \mintinline{lua}{#1}%
110 \tcblower%
111 \begin{flushright}%
112 \mintinline{lua}{#2}%
113 \end{flushright}%
114 \end{codehead}%
115 }
116
117 \newcommand{\newcoderef}[3]{%
118 \begin{newcodehead}[sidebyside,segmentation hidden]{#3}%
119 \mintinline{lua}{#1}%
120 \tcblower%
121 \begin{flushright}%
122 \mintinline{lua}{#2}%
123 \end{flushright}%
124 \end{newcodehead}%
125 }
126
127 \usetikzlibrary{shapes.multipart}
128 \useforestlibrary{edges}
129
130 \def\error{\color{red}}
131 \def\self{\color{gray}}
132 \def\call{$\star$ }
133
134 \begin{document}
135 \thispagestyle{empty}
136
137 \section{Algebra}
138 This section contains reference materials for the algebra functionality of \texttt{luacas}. The classes in this module are diagramed below according to inheritance along with the methods/functions one can call upon them.
139 \begin{itemize}
140 \item {\error\ttfamily\itshape method}: an abstract method;
141 \item {\self\ttfamily\itshape method}: a method that returns the expression unchanged;
142 \item {\ttfamily\itshape method}: method that is either unique, implements an abstract method, or overrides an abstract
143 method;
144 \item {\tikz[baseline=-0.5ex]\node[fill=rose!30] {\ttfamily\bfseries Class};}: a concrete class.
145 \end{itemize}
146 Here is an inhertiance diagram of the classes in the algebra module that are derived from the \texttt{AtomicExpression} branch of classes. However, not all of them are proper {\ttfamily ConstantExpression}s, so some of them override the {\ttfamily isconstant()} method. Most methods are stated, but some were omitted (because they inherit in the obvious way, they are auxiliary and not likely to be interesting to the end-user, etc).
147 \vfill
148 \forestset{
149 rectcore/.style = {rectangle split,
150 rectangle split parts=2,
151 draw = {rosenavy,thick},
152 rounded corners = 1pt,
153 font = \ttfamily\bfseries,
154 fill = roseblue!#1
155 },
156 rectalg/.style = {rectangle split,
157 rectangle split parts=2,
158 draw = {rose,thick},
159 rounded corners = 1pt,
160 font = \ttfamily\bfseries,
161 fill = rose!#1
162 }
163 }
164 \forestset{
165 multiple directions/.style={
166 for tree={#1},
167 phantom,
168 for relative level=1{
169 no edge,
170 delay={
171 !c.content/.pgfmath=content("!u")},
172 before computing xy={l=0,s=0}
173 }
174 },
175 multiple directions/.default={},
176 grow subtree/.style={for tree={grow=#1}},
177 grow' subtree/.style={for tree={grow'=#1}}}
178 \tikzset{
179 every two node part/.style={font=\ttfamily\itshape\footnotesize}
180 }
181 \begin{center}
182 \begin{forest}
183 for tree = {node options={align=left},
184 edge = {-stealth}
185 },
186 forked edges
187 [Expression\nodepart{two}$\cdots$,rectcore={0}
188 [AtomicExpression\nodepart{two}$\cdots$,rectcore={0}
189 [SymbolExpression\nodepart{two}$\cdots$,rectcore={50}]
190 [ConstantExpression\nodepart{two}$\cdots$,rectcore={0}
191 [Ring\nodepart{two}\begin{minipage}{0.45\textwidth}\begin{multicols}{3}
192 {\error :getring}\\
193 {\error :inring(ring)}\\
194 {\error :iscommutative}\\
195 {\error :add(b)}\\
196 :sub(b)\\
197 {\error :neg(b)}\\
198 {\error :mul(b)}\\
199 :pow(n)\\
200 {\error :eq(b)}\\
201 {\error :lt(b)}\\
202 {\error :le(b)}\\
203 {\error :zero()}\\
204 {\error :one()}\\
205 {\error .makering}\\
206 .resultantring
207 \end{multicols}\end{minipage}
208 ,rectalg={0}
209 [PolynomialRing\nodepart{two}
210 .makering\\
211 .R\\
212 .gcd\\
213 .extendedgcd\\
214 .resultant\\
215 .resultantmulti\\
216 .monicgcdremainders\\
217 .partialfractions\\
218 %:isatomic\\
219 :new\\
220 .mul{\textunderscore}rec\\
221 :divremainder\\
222 :psuedodivide\\
223 :isconstant\\
224 :isatomic\\
225 :freeof\\
226 :tocompoundexpression\\
227 :evaluateat\\
228 :derivative\\
229 :squarefreefactorization\\
230 :factor\\
231 :rationalroots\\
232 :roots\\
233 $\cdots$
234 ,rectalg={30}]
235 [EuclideanDomain\nodepart{two}
236 {\error :divremainder}\\
237 :iscommutative
238 ,rectalg={0}
239 [Integer\nodepart{two}
240 .gcd\\
241 .extendedgcd\\
242 .max\\
243 .min\\
244 .ceillog\\
245 .powmod\\
246 :new\\
247 :divremainder\\
248 :asnumber\\
249 :divisors\\
250 :primefactorization\\
251 :findafactor\\
252 :isprime\\
253 :abs\\
254 $\cdots$
255 ,rectalg={30}]
256 [Field\nodepart{two}
257 :div
258 ,rectalg={0}
259 [Rational\nodepart{two}
260 :new\\
261 :reduce\\
262 :isconstant\\
263 :tocompoundexpression\\
264 :asnumber\\
265 :div
266 ,rectalg={30}]
267 [IntegerModN\nodepart{two}
268 :new
269 ,rectalg={30}]
270 ]
271 ]
272 ]
273 ]
274 ]
275 ]
276 \end{forest}
277 \end{center}
278 \vfill
279
280 \newpage
281
282 Here is an inhertiance diagram of the classes in the algebra module that are derived from the \texttt{CompoundExpression} branch of classes. Again, most methods are stated, but some were omitted (because they inherit in the obvious way, they are auxiliary and not likely to be interesting to the end-user, etc).
283 \vfill
284 \begin{center}
285 \begin{forest}
286 for tree = {node options={align=left},
287 grow = south,
288 edge = {-stealth},
289 child anchor = west
290 },
291 forked edges
292 [Expression\nodepart{two}$\cdots$,
293 rectcore={0}
294 [CompoundExpression\nodepart{two}
295 $\cdots$,
296 rectcore={0},
297 calign = first,
298 for tree = {node options = {anchor = west},
299 grow' = east}
300 [BinaryOperation\nodepart{two}
301 $\cdots$,
302 rectcore={50}]
303 [FunctionExpression\nodepart{two}
304 $\cdots$,
305 rectcore={50}
306 [TrigExpression\nodepart{two}
307 :new
308 ,rectalg={30}]
309 ]
310 [AbsExpression\nodepart{two}
311 :new
312 ,rectalg={30}]
313 [SqrtExpression\nodepart{two}
314 :new\\
315 :topower
316 ,rectalg={30}]
317 [RootExpression\nodepart{two}
318 :new
319 ,rectalg={30}]
320 [FactorialExpression\nodepart{two}
321 :new
322 ,rectalg={30}]
323 [Logarithm\nodepart{two}
324 :new
325 ,rectalg={30}]
326 [Equation\nodepart{two}
327 :new\\
328 :solvefor()
329 ,rectalg={30}]
330 ]
331 ]
332 \end{forest}
333 \end{center}
334 \vfill
335 \end{document}
336