17
$\begingroup$

I guess all computer algebra systems have command line interfaces which render formula as 2D monospace "ascii art". But the only standalone tool to render TeX to 2D I know is tex2mail (comes with PARI/GP).

Are there other standalone programs or libraries for that task, preferably making advantage of various Unicode symbols? Or maybe there is a CAS capable for that.

What I'm talking about:

FriCAS:

            ┌──┐        x   \│%A      ┌┐  %e      │   ─────── d%A     └┘       2            %A 

tex2mail:

         +-+                                    ,- \|x   2                                    | e    /x    dx                                   -'                  

Maxima:

     /   sqrt(x)      [ %e      I --------- dx      ]     2      /    x 

Those are meant to represent:

$\int \frac{e^{\sqrt x}}{x^2} \, dx$

  • 1
    Good lord. That is *hideous*. If you're stuck in ASCII, it's a million times better to write "the indefinite integral of (exp(root x))/(x^2))dx", or something like that.2015-04-15

4 Answers 4

4

If you are on *NIX platforms you can use asciitex.

There is also aamath which does a great job in traslating the equation to ascii text files.

If you don't want to install anything locally take a look at http://ascii.gallery/matheq which I believe is a web wrapper over aamath.

  • 0
    I noticed ascii.gallery is moved. Use the new url https://textart.io/matheq2018-10-29
9

You can use this Web Application: Diagon

  • No need to download anything
  • Supports ASCII and Unicode.
  • Supports other kind of ASCII art diagrams.

Examples:

sum(i^2, i=0, n) = n^3/2+n^2/2+n/6

output (Unicode)    n                     ___        3    2      ╲     2   n    n    n  ╱    i  = ── + ── + ─  ‾‾‾        2    2   6 i = 0                   output (ASCII):     n                     ===        3    2      \     2   n    n    n  /    i  = -- + -- + -  ===        2    2   6 i = 0                  

mult(i^2, i=1, n) = (mult(i, i=1, n))^2

                    2      n        ⎛  n    ⎞     ━┳┳━   2   ⎜━┳┳━   ⎟      ┃┃   i  = ⎜ ┃┃   i⎟     i = 1      ⎝i = 1  ⎠                          

sqrt(1 + sqrt(1 + x/2))

     _____________     ╱        _____    ╱        ╱    x   ╱        ╱ 1 + ─ ╲╱   1 + ╲╱      2 

[1,2; 3,4] * [x; y] = [1*x+2*y; 3*x+4*y]

⎛1 2⎞   ⎛x⎞   ⎛1 ⋅ x + 2 ⋅ y⎞ ⎜   ⎟ ⋅ ⎜ ⎟ = ⎜             ⎟ ⎝3 4⎠   ⎝y⎠   ⎝3 ⋅ x + 4 ⋅ y⎠ 

int(x^2/2 * dx ,0 ,1) = n^3/6

1              ⌠  2         3 ⎮ x         n  ⎮ ── ⋅ dx = ── ⌡  2         6 0              

phi = 1 + 1/(1+1/(1+1/(1+1/(1+...))))

                 1          φ = 1 + ───────────────────                    1                1 + ───────────────                      1                  1 + ───────────                        1                    1 + ───────                     1 + ... 

Disclaimer: I am the author.

It is an open source project under the MIT license.

  • 2
    Wonderful answer :-) Welcome on the MathSE! :-)2018-06-01
8

I've edited a bit tex2mail to use Unicode for output. Here are the results:

                                      ┌──────┐                        ┌─┐  3                   4  │     2     6      4                   ⌠   \│a  x         ┌─┐     3 x  \│1 - x   + x  - 3 x                    ⎮  ───────── dx = \│a  ──────────────────────────────────               ⌡   ┌──────┐                          ┌──────┐                   │     2            ⎛    2      ⎞  │     2      2                  \│1 - x             ⎝ 3 x  - 12 ⎠ \│1 - x   - 9x  + 12                                            ⎡     1 ⎤n                                            lim           ⎢ 1 + ─ ⎥  = e                                                n  --> oo ⎣     n ⎦                                                               n       n                                   ⌠1  x     ──┐oo   ⌠1 x (log x)                                    ⎮  x dx = >       ⎮  ──────────   dx.                                   ⌡0        ──┘n=0  ⌡0     n!                          ┬─┬oo ⎛   1  ⎞   ⎛ ┬─┬oo   1   ⎞-1           1            1     6  │ │   ⎜ 1-── ⎟ = ⎜ │ │   ───── ⎟   = ───────────────── = ──── = ──  ≈ 61% ┴ ┴p  ⎜    2 ⎟   ⎜ ┴ ┴p     -2 ⎟         1    1          ζ(2)    2       ⎝   p  ⎠   ⎝       1-p   ⎠     1 + ── + ── + ∙∙∙          π                                            2    2                                          2    3  

The look depends hugely on the fonts and the browser. If you are interested in the script here is the link.

  • 0
    @RahulNarain As for the sub and superscripts, I just think that they are small and poorly readable. Anyway, implementing this is beyond my Perl skills.2012-06-09
8

At this site one can get following:


Input:

int(int(int(psi^2, x = -inf .. inf), y = -inf .. inf), z = -inf .. inf) = 1

Output:

   oo    oo    oo   /     /     /  |     |     |    2  |     |     | psi  dx dy dz = 1  |     |     | /     /     /  -oo   -oo   -oo 

Input:

sqrt(e) = 1+1/(1+1/(1+1/(1+1/(5+1/(1+1/(1+1/(9+1/(1+1/(1+...)))))))))

Output:

  _                          1 \/e = 1 + ---------------------------------------                                1           1 + -----------------------------------                                  1               1 + -------------------------------                                    1                   1 + ---------------------------                                      1                       5 + -----------------------                                        1                           1 + -------------------                                          1                               1 + ---------------                                            1                                   9 + -----------                                              1                                       1 + -------                                           1 + ... 

Input:

e^x = 1 + x + x^2/2! + x^3/3! + x^4/4! + ... = 1 + sum(x^n/n!, n = 1 .. inf)

Output:

                                       oo               2    3    4             =====  n  x           x    x    x              \     x e  = 1 + x + -- + -- + -- + ... = 1 +  >    --              2!   3!   4!             /     n!                                       =====                                       n = 1 

Input:

(1/4)pisqrt(2) = sum((-1)^(k+1)/(4*k + 1) + (-1)^(k+1)/(4*k - 3), k = 1 .. inf) = 1 + 1/3 - 1/5 - 1/7 + 1/9 + 1/11 - ...

Output:

            oo            ===== /    k + 1       k + 1\ 1 __   _   \     |(-1)        (-1)     |       1   1   1   1    1 - || \/2 =  >    |--------- + ---------| = 1 + - - - - - + - + -- - ... 4          /     \ 4 k + 1     4 k - 3 /       3   5   7   9   11            =====            k = 1 

Input:

sin(a)/a = cos(a/2) * cos(a/4) * cos(a/8) * cos(a/16) * ... = prod(cos(a/2^n), n = 1 .. inf)

Output:

                                        oo                                        ===== sin a       a     a     a      a        | |       a ----- = cos - cos - cos - cos -- ... =  | |  cos --   a         2     4     8     16        | |       n                                         | |      2                                        n = 1 

Input:

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

Output:

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

Finally,

$\int \frac{e^{\sqrt x}}{x^2} \, dx$

is represented as

Input:

int(e^sqrt(x)/x^2 , x)

Output:

  /  |    _  |  \/x  | e  | ---- dx  |   2  |  x  | /