Debian Codegraph @

texmf-dist/doc/lualatex/luacas/intro/intro.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}
21 \usepackage{microtype}
22
23 \usepackage[
24 backend=biber,
25 style=numeric,
26 ]{biblatex}
27 \addbibresource{sources.bib}
28
29 \newtcolorbox{codebox}[1][sidebyside]{
30 enhanced,skin=bicolor,
31 #1,
32 arc=1pt,
33 colframe=brown,
34 colback=brown!15,colbacklower=white,
35 boxrule=1pt,
36 notitle
37 }
38
39 \begin{document}
40
41 \section{What is \texttt{luacas}?}
42
43 The package {\ttfamily luacas} allows for symbolic computation within \LaTeX{}. For example:
44 \begin{CAS}
45 vars('x','y')
46 f = 3*x*y - x^2*y
47 fxy = diff(f,x,y)
48 \end{CAS}
49 \begin{minted}[fontsize=\small]{latex}
50 \begin{CAS}
51 vars('x','y')
52 f = 3*x*y - x^2*y
53 fxy = diff(f,x,y)
54 \end{CAS}
55 \end{minted}
56 The above code will compute the mixed partial derivative $f_{xy}$ of the function $f$ defined by
57 \[ f(x,y)=3xy-x^2y.\]
58 There are various methods for fetching and/or printing results from the CAS within your \LaTeX{} document:
59
60 \begin{codebox}
61 \begin{minted}{latex}
62 \[ \print{fxy} = \print*{fxy} \]
63 \end{minted}
64 \tcblower
65 \[ \print{fxy} = \print*{fxy} \]
66 \end{codebox}
67
68 \subsection{About}
69
70 The core CAS program is written purely in Lua and integrated into \LaTeX{} via Lua\LaTeX{}. Currently, most existing computer algebra systems such as Maple and Mathematica allow for converting their stored expressions to \LaTeX{} code, but this still requires exporting code from \LaTeX{} to another program and importing it back, which can be tedious.
71
72 The target audience for this package are mathematics students, instructors, and professionals who would like some ability to perform basic symbolic computations within \LaTeX{} without the need for laborious and technical setup. But truly, this package was born out of a desire from the authors to learn more about symbolic computation. What you're looking at here is the proverbial ``carrot at the end of the stick'' to keep our learning moving forward.
73
74 Using a scripting language (like Lua) as opposed to a compiled language for the core CAS reduces performance dramatically, but the following considerations make it a good option for our intentions:
75
76 \begin{itemize}
77 \item Compiled languages that can communicate with \LaTeX{} in some way (such as C through Lua) require compiling the code on each machine before running, reducing portability.
78 \item Our target usage would generally not involve computations that take longer than a second, such as factoring large primes or polynomials.
79 \item Lua is a fast scripting language, especially when compared to Python, and is designed to be compact and portable.
80 \item If C code could be used, we could tie into one of many open-source C symbolic calculators, but the point of this project was (and continues to be) to learn the mathematics of symbolic computation. The barebones but friendly nature of Lua made it an ideal language for those intents.
81 \end{itemize}
82
83 \subsection{Features}
84
85 Currently, {\ttfamily luacas} includes the following functionality:
86
87 \begin{itemize}
88 \item Arbitrary-precision integer and rational arithmetic
89 \item Number-theoretic algorithms for factoring integers and determining primality
90 \item Constructors for arbitrary polynomial rings and integer mod rings, and arithmetic algorithms for both
91 \item Factoring univariate polynomials over the rationals and over finite fields
92 \item Polynomial decomposition and some multivariate functionality, such as pseudodivision
93 \item Basic symbolic root finding and equation solving
94 \item Symbolic expression manipulations such as expansion, substitution, and simplification
95 \item Symbolic differentiation and integration
96 \end{itemize}
97
98 The CAS is written using object-oriented Lua, so it is modular and would be easy to extend its functionality.
99
100 \subsection{Acknowledgements}
101
102 We'd like to thank the faculty of the Department of Mathematics at Rose-Hulman Institute of Technology for offering constructive feedback as we worked on this project. A special thanks goes to Dr. Joseph Eichholz for his invaluable input and helpful suggestions.
103
104 \section{Installation}
105
106 \subsection{Requirements}
107
108 The \texttt{luacas} package (naturally) requires you to compile with Lua\LaTeX{}. Lua 5.3 or higher is also required. Beyond that, the following packages are needed:
109 \begin{multicols}{2}
110 {\ttfamily
111 \begin{itemize}
112 \item xparse
113 \item pgfkeys
114 \item verbatim
115 \item mathtools
116 \item luacode
117 \item iftex
118 \item tikz/forest
119 \item xcolor
120 \end{itemize}}
121 \end{multicols}
122 The packages {\ttfamily tikz}, {\ttfamily forest}, and {\ttfamily xcolor} aren't strictly required, but they are needed for drawing expression trees.
123
124 \subsection{Installing {\ttfamily luacas}}
125 The package manager for your local TeX distribution ought to install the package fine on its own. But for those who like to take matters into their own hands: unpack \texttt{luacas.zip} in the current working directory (or in a directory visible to TeX, like your local texmf directory), and in the preamble of your document, put:
126 \begin{minted}{latex}
127 \usepackage{luacas}
128 \end{minted}
129 That's it, you're ready to go.
130
131 \subsection{Todo}
132
133 Beyond squashing bugs that inevitably exist in any new piece of software, future enhancements to \texttt{luacas} may include:
134 \begin{itemize}
135 \item Improvements to existing functionality, e.g., a more powerful \texttt{simplify()} command and more powerful expression manipulation tools in general, particularly in relation to complex numbers, a designated class for multivariable polynomial rings, irreducible factorization over multivariable polynomial rings, and performance improvements;
136 \item New features in the existing packages, such as sum and product expressions \& symbolic evaluation of both, and symbolic differential equation solving;
137 \item New packages, such as for logic (boolean expressions), set theory (sets), and linear algebra (vectors and matrices), and autosimplification rules and algorithms for all of them;
138 \item Numeric functionality, such as numeric root-finding, linear algebra, integration, and differentiation;
139 \item A parser capable of evaluating arbitrary \LaTeX{} code and turning it into CAS expressions.
140 \end{itemize}
141
142
143 \end{document}