Skip to content

gchudnov/aamath

Repository files navigation

aamath

ASCII art mathematics renderer

C/C++ CI

aamath is a program that reads mathematical expressions in infix notation and renders them as ASCII art. It may be useful to send mathematics through text-only media, such as e-mail or newsgroups.

As a simple example, the output for an expression such as

A_OPR = x*sqrt(x^2-1)/2 - int(sqrt(t^2-1), t = 1 .. x)

will look like

                        x
            ______     /
           / 2        |    ______
       x \/ x  - 1    |   / 2
A    = ----------- -  | \/ t  - 1 dt
 OPR        2         |
                      |
                     /
                      1

Other than the usual operations (addition, subtraction, multiplication, division, and exponentiation), aamath can also handle functions, integrals, limits, sums, products, matrices and vectors. Here is a more thorough set of examples.

aamath is a command-line utility. It was successfully compiled and tested on Linux, FreeBSD, Cygwin, and DJGPP. It is written in C++, and will need lex and yacc to compile. GNU readline is also recommended, although not essential.

Installing

From Snap Store:

snap install aamath

Get it from the Snap Store

Usage

aamath "lim(1/x^2 - (cos(x)/x)^2, x -> inf) = 1"

output:

        /            2\
        | 1   /cos x\ |
 lim    |-- - |-----| | = 1
        | 2   \  x  / |
x -> oo \x            /

More examples are included in the file EXAMPLES.md.

Compiling on *nix

  make -f Makefile

To test it:

  ./aamath < testcases

To run in interactive mode:

  ./aamath

To compile without readline:

  remove -DUSE_READLINE and -lreadline and -ltermcamp from Makefile

Copyright

aamath is licensed under the GNU General Public License, v2. A copy of this license is included in the file LICENSE.

Author

http://fuse.superglue.se/aamath/; mauro_persano at yahoo dot com