From: Yigal
Subject: How to embed Maxima in Common Lisp?
Date: 
Message-ID: <1187437378.060114.184130@a39g2000hsc.googlegroups.com>
Hi,

I'm learning Lisp (clisp) with purpose to build a site for interactive
solving school math problems.

My question is, how can I call Maxima from within a Lisp program?

In "Maxima tutorial" they say: "The Lisp function mfuncall calls a
Maxima function", but when I try it in my clisp, I get "mfuncall is
undefined". I think I need to load some Maxima's library but I don't
know what exactly, Maxima consist of many .lisp files...

Thanks for the help in advance.

Yigal Asnis.

From: Xah Lee
Subject: Re: How to embed Maxima in Common Lisp?
Date: 
Message-ID: <1187471030.794045.163980@x35g2000prf.googlegroups.com>
Not a answer to your question, but a piece of info i think you'll be
interested:

�Maxima does not include any of the numerous enhancements made to the
commercial version of Macsyma between 1982-1999 (at least 50 man-years
of work). Due to this, extensive effort may be required to port code
from Macsyma to Maxima.�

above is a quote from:
http://en.wikipedia.org/wiki/Macsyma

If you have about 3 thousand dollars to spare, you might want to buy
Mathematica instead. Goto:
http://wolfram.com/

If you have no money to spare, it is my feeling that there are better
free packages than maxima.

Wikipedia has a page that list computer algebra software.

  Xah
  ···@xahlee.org
  http://xahlee.org/

On Aug 18, 4:42 am, Yigal <··········@yahoo.com> wrote:
> Hi,
>
> I'm learning Lisp (clisp) with purpose to build a site for interactive
> solving school math problems.
>
> My question is, how can I call Maxima from within a Lisp program?
>
> In "Maxima tutorial" they say: "The Lisp function mfuncall calls a
> Maxima function", but when I try it in my clisp, I get "mfuncall is
> undefined". I think I need to load some Maxima's library but I don't
> know what exactly, Maxima consist of many .lisp files...
>
> Thanks for the help in advance.
>
> Yigal Asnis.
From: rjf
Subject: Re: How to embed Maxima in Common Lisp?
Date: 
Message-ID: <1187553858.873012.173410@x35g2000prf.googlegroups.com>
On Aug 18, 2:03 pm, Xah Lee <····@xahlee.org> wrote:
> Not a answer to your question, but a piece of info i think you'll be
> interested:
>
> �Maxima does not include any of the numerous enhancements made to the
> commercial version of Macsyma between 1982-1999 (at least 50 man-years
> of work). Due to this, extensive effort may be required to port code
> from Macsyma to Maxima.�
>
> above is a quote from:http://en.wikipedia.org/wiki/Macsyma

Do you believe everything you read in wikipedia?
It turns out that Macsyma does not include any of the numerous
enhancements made to the open-source Maxima.

In spite of these differences, vast quantities of code can run
interchangeably on each platform since they are each implemented in
(more or less standard) ANSI Common Lisp.

> If you have about 3 thousand dollars to spare, you might want to buy
> Mathematica instead. Goto:http://wolfram.com/
>

I can't imagine why the original poster, who apparently wants to link
his CL code with Maxima, should consider this as an alternative.

> If you have no money to spare, it is my feeling that there are better
> free packages than maxima.

Do you often have such feelings?

<snip>
From: Xah Lee
Subject: Re: How to embed Maxima in Common Lisp?
Date: 
Message-ID: <1188347818.577644.9360@x35g2000prf.googlegroups.com>
Dear Richard Fateman,

you (aka rjf) wrote:
�Do you believe everything you read in wikipedia?�

Encyclopedia, My Experiences
Xah Lee, 2007-08
http://xahlee.org/Periodic_dosage_dir/encyclopedia.html

The last paragraph of the first section, address your question in the
affirmative. I quote:

�I assert today, that wikipedia as a encyclopedia, with respect to
quality, all things considered, has surpassed all major general
encyclopedias as well as specialized encyclopedias in mathematics and
computer science. If this is not true for humanity at large, it is at
least for me. Specifically, if i can only choose to have one
encyclopedia now of existing encyclopedias as they are currently, i
choose Wikipedia.�

You, or the readers, might have general concern about the correctness
of wikipedia. Of which, is addresss at the second section of this
essay:

The Engine of Wikipedia (and On Wikipedia's Misinformation)
Xah Lee, 2007-08-28
http://xahlee.org/Periodic_dosage_dir/t2/wikipedia_engine.html

I quote the first paragraph:

�There is a common conception and worry, especially among
academecians, that Wikipedia is filled with misinformation. That, we
will often see among online forums, that these people outright
disclaim the reliability of wikipedia, in fact will disparage it out
of proportions especially when some error got broadcasted in the news
media.

...
�

  Xah
  ···@xahlee.org
  http://xahlee.org/
From: Yigal
Subject: Re: How to embed Maxima in Common Lisp?
Date: 
Message-ID: <1187642444.111436.216560@r34g2000hsd.googlegroups.com>
Thank you Robert for the detailed answer.

Finally I succeed to follow your instructions.
On my box Maxima was installed as debian package so it worked with GCL
only. When it came to this row:
>:lisp (ext:saveinitmem "/tmp/foo-maxima.mem" :init-function 'cl-user::run),
GCL said "no such package "ext"".
I installed Maxima from source with clisp and now it worked as you
wrote.

Apropos web server, I tested "lisp-cgi-utils" and mod_lisp for Apache,
it's work.

Thanks again,
Yigal


On Aug 19, 8:40 pm, Robert Dodier <·············@gmail.com> wrote:

> Yigal, I think a useful approach here is to create a Lisp
> binary image which contains your function or functions to
> run the web stuff plus all of Maxima. That is easy to do:
> launch Maxima, load your Lisp and/or Maxima functions,
> and save the current Lisp state. Then you can launch Clisp
> and tell it to run the saved image. This method works
> with other Lisp implementations as well.
>
> e.g. Here is my replacement for CL-USER::RUN. You will want
> to write a function to read and write a socket, I guess.
>
> $ cat /tmp/foo-run.lisp
> (defun cl-user::run ()
>   (in-package :maxima)
>   (format t "HELLO FROM REPLACEMENT CL-USER::RUN~%")
>   (let (($display2d nil))
>     (displa (mfuncall '$foo 123 '$abc)))
>   (bye))
>
> Here is a Maxima function called from CL-USER::RUN.
>
> $ cat /tmp/foo-function.mac
> foo (x, y) := (x - y)^(y - x);
>
> Now I'll create the saved image. I'm running an already-built
> Maxima here; it is not necessary to rebuild Maxima to
> incorporate your new functions. I'll tell Clisp to call my
> replacement CL-USER::RUN.
>
> $ maxima -q -l clisp
> load ("/tmp/foo-function.mac");
> load ("/tmp/foo-run.lisp");
> :lisp (ext:saveinitmem "/tmp/foo-maxima.mem" :init-function 'cl-
> user::run)
> quit ();
>
> Now I'll run Clisp with the saved image.
>
> $ clisp -q -M /tmp/foo-maxima.mem
> HELLO FROM REPLACEMENT CL-USER::RUN
> (123-abc)^(abc-123)
>
> By the way, if you are working with web servers or whatever,
> there are Lisp libraries for that. But first you need to get
> comfortable with Lisp + Maxima. Hope this helps, & good luck.
>
> Robert Dodier