Hello
the title should be self explanatory.
I would like to find some code which could take a mathematical
expression in some machine format (eg. something like the TeX
\frac{e^{2 x}}{1 + x}
or S-exp
(/ (exp e (* 2 x)) (+ 1 x))
), and printed
2 x
e
-----
1 + x
A description of the algorithms used would be good enough and Lisp (Scheme)
code would be welcome.
Thanks in advance
--
Marco Antoniotti - Resistente Umano
===============================================================================
International Computer Science Institute | ·······@icsi.berkeley.edu
1947 Center STR, Suite 600 | tel. +1 (510) 643 9153
Berkeley, CA, 94704-1198, USA | +1 (510) 642 4274 x149
===============================================================================
...it is simplicity that is difficult to make.
...e` la semplicita` che e` difficile a farsi.
Bertholdt Brecht
From: Richard J Fateman
Subject: Re: Code/algorithms to display math with ASCII??????
Date:
Message-ID: <485ctq$if5@agate.berkeley.edu>
In article <·····················@lox.icsi.berkeley.edu>,
Marco Antoniotti <·······@lox.icsi.berkeley.edu> wrote:
.....
>I would like to find some code which could take a mathematical
>expression in some machine format (eg. something like the TeX
>
> \frac{e^{2 x}}{1 + x}
>
>or S-exp
>
> (/ (exp e (* 2 x)) (+ 1 x))
>
>), and printed
>
> 2 x
> e
> -----
> 1 + x
>
>A description of the algorithms used would be good enough and Lisp (Scheme)
>code would be welcome.
.....
There's a free common lisp program you might like, that
among other things probably does what you want
int terms of display. You need to use only one or two
of the files used in constructing the system, but you
can get the whole thing, anyway..
The on-line copy is temporarily unavailable (until later this week,
perhaps). It is called MockMMA. Here's a sample interaction...
......
<cl> (tl)
In[1] := Timing[RatExpand[(x+y)^4]]
4 3 2 2 3 4
Out[1] = {0.0 Second, x + 4 x y + 6 x y + 4 x y + y }
In[2] := Timing[RatExpand[(x+y+z)^15];done]
Out[2] = {0.23300001 Second, done}
In[3] := D[ArcTanh[x]^2,x]
2 ArcTanh[x]
Out[3] = ------------
2
1 - x
In[4] := Int[%,x]
2
Out[4] = (ArcTanh[x])
In[5] := Int[x^n,x]
n
Out[5] = integrate[x , x]
In[6] := integrate[y_^m_,y_]:= (y^(m+1)-1)/(m+1)
In[7] := Int[x^n,x]
1 + n
-1 + x
Out[7] = -----------
1 + n
In[8] := Exit
......
To reconstruct this on your unix system (I'm using Allegro Common Lisp,
and it should work on any hardware supporting it; it should also work
in other Common Lisps), do the following:
cd someplace with room for a few 100k bytes
type:
ftp peoplesparc.cs.Berkeley.EDU or 128.32.35.42
anonymous %%response to name prompt
your name %%response to password prompt
image %% or maybe, for some ftp systems, binary rather than image
cd pub
get mma_1.5.tar.Z
quit
%%now you're out of ftp
uncompress mma_1.5.tar.Z
tar xvf mma_1.5.tar
%% you are now the proud possessor of the files
%% you should probably try to compile them.
.......
If you get a copy, I would appreciate e-mail (to ·······@cs.berkeley.EDU)
advising me of that fact, so I can keep you up on new features or
improvements. Of course I'd like to know of any
problems or successes you have. On the other hand, I can't promise
to fix any particular problems, and there is no warranty. If you
are interested in enhancing the behavior of this system for use
by others, please tell me.
Important note: This program is a rough shell
that has only rudimentary (but fast) parsing, display, numeric evaluation,
polynomial/ rational simplification, integration, and some pattern matching.
It is not a substitute for Mathematica (r), Maple (r), Macsyma, MuPAD,
Axiom etc.
generally, and is not intended
to compete with such commercial systems. This system
can be used for experimentation ... e.g. insert an entirely
different evaluation strategy or an entirely different numeric
system, and re-run your "Mathematica(r) source code" through it.
Or hook it up to your favorite other semantics for solve, integrate,
etc. (e.g. JACAL, Reduce, Macsyma, Maple, ...).
It is difficult or impossible to do these experiments
with the commercial Mathematica.
--
Richard J. Fateman
·······@cs.berkeley.edu http://http.cs.berkeley.edu/~fateman/
From: Jacques Gelinas
Subject: Re: Code/algorithms to display math with ASCII??????
Date:
Message-ID: <48ffpc$iqb@news.axess.com>
Marco Antoniotti (·······@lox.icsi.berkeley.edu) wrote:
: Hello
: the title should be self explanatory.
: I would like to find some code which could take a mathematical
: expression in some machine format (eg. something like the TeX
: \frac{e^{2 x}}{1 + x}
: or S-exp
: (/ (exp e (* 2 x)) (+ 1 x))
: ), and printed
: 2 x
: e
: -----
: 1 + x
: A description of the algorithms used would be good enough and Lisp (Scheme)
: code would be welcome.
Here is a free solution (but I do not have the source code)
================================================================
*----* MuPAD 1.2.2 -- Multi Processing Algebra Data Tool
/| /|
*----* | Copyright (c) 1992-95 by B. Fuchssteiner, Automath
| *--|-* University of Paderborn. All rights reserved.
|/ |/
*----* Licensed to: jacquesg
>> e^(2*x)/(1+x);
2 x
e
-----
x + 1
=================================================================
From: Dominique de Waleffe
Subject: Re: Code/algorithms to display math with ASCII??????
Date:
Message-ID: <30AC60B5.3438@miscrit.be>
Another solution, with source code can be found in Aubrey Jaffer's
jacal package for scheme.
D.