On Sat, 2004-02-07 at 04:21, Dimitri Pissarenko wrote:
> Now I am thinking about making some nifty interface between my Java
> program and Maxima, so that I can take advantage of Maxima's
> functionality.
I would like to have a good mechanism for this sort of thing.
Unfortunately, we don't have one yet.
> At SourceForge.net, I discovered a piece of software called Jatha
> (http://sourceforge.net/projects/jatha/), which is an implementation
> of LISP in Java.
I see from the web page that Jatha "implements a large subset of Common
LISP." It's *possible* that you could get Maxima working under Jatha
with a reasonable amount of work, but I would be surprised if that
happened. Go ahead and try if you like.
I know that re-implementing a language in Java so that it can be easily
called from Java has been done more than once. It seems like a terrible
approach to me.
> Has anybody attempted to connect Maxima and Java? If so, what were the
> biggest challenges?
What sort of inputs do you want to send to Maxima and what sorts out
outputs do you expect to get back? Specifically, do you expect to get
back numbers, vectors of numbers, matrices of numbers, symbolic
expressions, or something else? If the answer includes symbolic
expressions, how would you deal with them? Do you plan to parse
expressions in Maxima syntax and convert them to Java?
I looked at your scheme described in
<http://demetrix.sourceforge.net/resources/2004_02_07_maxima/2004_02_07_maxima.html>. I'm afraid it doesn't quite make sense to me. I don't see any reason to talk to clisp independently of Maxima.
Here is a list of ways you could communicate between your program and
Maxima:
1) Write a maxima batch file, then run maxima with the --batch option.
You will have to parse the output.
2) Talk to maxima interactively through pipes. TeXmacs talks to Maxima
in this way, so you should look at the interface it uses.
3) Talk to maxima interactively through sockets. Xmaxima talks to Maxima
in this way. This method doesn't differ much from (2).
4) Setup a CORBA interface to Maxima. There is a free Common Lisp CORBA
implementation called clorb. I once built a minimal Maxima CORBA
interface using clorb, so I know it can be made to work.
5) As Richard suggested, use the Allegro CL-Java interface. This options
limits you to using Allegro CL.
None of these suggestions are perfect. Which one makes most sense will
depend on the answers to the questions I asked about inputs and outputs.
Since I would like to see us implement a better solution to this sort of
problem, it would be useful if you share your experiences with the list.
--Jim