---------- Forwarded message ---------- From: Phuc Luoi phucluoi@gmail.com Date: Tue, Jun 19, 2012 at 12:51 PM Subject: Re: [armedbear-devel] How to compile and run Maxima with ABCL? To: Robert Dodier robert.dodier@gmail.com
Thanks for your answer.
I tried this and got these errors:
Can't intern zero-length symbol. Restarts: 0: RETRY Retry compiling #<ASDF:CL-SOURCE-FILE "maxima" "utilities" "mformt">. 1: ACCEPT Continue, treating compiling #<ASDF:CL-SOURCE-FILE "maxima" "utilities" "mformt"> as having been successful. 2: TOP-LEVEL Return to top level.
by compiling the file /maxima-5.27.0/src/mformt.lisp (step 9)
I have choose the option 1 to accept this. I got some more errors by compiling. After all I got
Out of memory PermGen space Restarts: 0: TOP-LEVEL Return to top level.
and abcl did not compiled maxima.
Can you tell me why I got these error? And how can repair them?
On Tue, Jun 19, 2012 at 5:04 AM, Robert Dodier robert.dodier@gmail.com wrote:
On 2012-06-16, Phuc Luoi phucluoi@gmail.com wrote:
How can I compile and run Maxima with ABCL?
(1) Unpack a Maxima tarball. http://sourceforge.net/projects/maxima and follow links to download page. Look for "Maxima-source".
(2) cd /path/to/maxima-5.27.0
(3) java -jar /path/to/abcl.jar
(4) (configure) ;; you can probably accept defaults for most/all questions
(5) (quit)
(6) cd src
(7) java -jar /path/to/abcl.jar
(8) (require 'asdf)
(9) (asdf:operate 'asdf:load-op :maxima)
(10) (quit)
(11) java -jar /path/to/abcl.jar
(12) (require 'asdf)
(13) (asdf:operate 'asdf:load-op :maxima) ;; yes, same as (9)
(14) (cl-user::run) ;; should bring up Maxima banner & input prompt
Furthermore can I emmbed maxima in a Java Programm with ABCL?
Yes. I've appended an example program. Command line to compile it:
javac -cp /path/to/abcl.jar -d /path/to/compiled/class abcl_maxima.java
To execute it: (you must be in the Maxima src directory)
java -cp /path/to/compiled/class:/path/to/abcl.jar abcl_maxima
I get: (takes a minute or two to load Maxima)
loading Maxima ... finished. x.getClass => class org.armedbear.lisp.Cons x = org.armedbear.lisp.Cons@1748ba8 x.javaInstance => org.armedbear.lisp.Cons@1748ba8 x.javaInstance.getClass => class org.armedbear.lisp.Cons 4 factors of 12341234 factor: 2, multiplicity: 1 factor: 73, multiplicity: 1 factor: 137, multiplicity: 1 factor: 617, multiplicity: 1
Note that all user functions have names which begin with dollar sign. E.g. user function ifactors <==> $IFACTORS in Lisp
If you need help with Lisp programming for Maxima, ask questions on the mailing list. See: http://maxima.sourceforge.net/maximalist.html
Hope this helps, have fun, & good luck.
Robert Dodier
PS. Example program abcl_maxima.java:
// abcl_maxima.java -- example program for calling Maxima from Java via ABCL // copyright 2012 by Robert Dodier // I release this work under terms of the GNU General Public License
import org.armedbear.lisp.Interpreter; import org.armedbear.lisp.Package; import org.armedbear.lisp.Packages; import org.armedbear.lisp.Symbol; import org.armedbear.lisp.Function; import org.armedbear.lisp.LispObject; import org.armedbear.lisp.Fixnum; import org.armedbear.lisp.Bignum; import org.armedbear.lisp.Cons;
public class abcl_maxima { public static void main (String [] args) throws Exception { int a;
if (args.length > 0) a = Integer.parseInt (args [0]); else a = 12341234;
Interpreter I = Interpreter.createInstance (); System.out.print ("loading Maxima ... "); I.eval ("(require 'asdf)"); I.eval ("(asdf:operate 'asdf:load-op :maxima)"); System.out.println ("finished."); Package P = Packages.findPackage ("MAXIMA");
// java.util.List <Symbol> L = P.getAccessibleSymbols (); // for (Symbol S : L) // { // if (P.equals (S.getPackage ())) // System.out.println (S.toString ()); // }
Symbol S = P.findAccessibleSymbol ("$IFACTORS"); Function F = (Function) S.getSymbolFunction (); LispObject x = Bignum.getInstance (a); x = F.execute (x); System.out.println ("x.getClass => " + x.getClass ()); System.out.println ("x = " + x); System.out.println ("x.javaInstance => " + x.javaInstance ()); System.out.println ("x.javaInstance.getClass => " + x.javaInstance () . getClass ());
int n = ((Cons) x).length (); System.out.println ((n - 1) + " factors of " + a);
for (int i = 1; i < n; i++) { Cons x1 = (Cons) ((Cons) x).NTH (i); Fixnum f = (Fixnum) x1.NTH (1); Fixnum m = (Fixnum) x1.NTH (2); System.out.println ("factor: " + f.intValue () + ", multiplicity: " + m.intValue ()); } } }
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
Java puts code (as opposed to data) in PermGen space (i.e. space that doesn't get garbage collected). The size of this space is fixed by default but can be overridden with a command line argument. Maxima (along with the Java code) probably contains too much code for the default java configuration. You can increase this java default as follows:
java -XX:MaxPermSize=200M -jar /path/to/abcl.jar
This makes the max permgen space 200 MB. You may have to vary that number.
Blake McBride
On Tue, Jun 19, 2012 at 6:29 AM, Phuc Luoi phucluoi@gmail.com wrote:
---------- Forwarded message ---------- From: Phuc Luoi phucluoi@gmail.com Date: Tue, Jun 19, 2012 at 12:51 PM Subject: Re: [armedbear-devel] How to compile and run Maxima with ABCL? To: Robert Dodier robert.dodier@gmail.com
Thanks for your answer.
I tried this and got these errors:
Can't intern zero-length symbol. Restarts: 0: RETRY Retry compiling #<ASDF:CL-SOURCE-FILE "maxima" "utilities" "mformt">. 1: ACCEPT Continue, treating compiling #<ASDF:CL-SOURCE-FILE "maxima" "utilities" "mformt"> as having been successful. 2: TOP-LEVEL Return to top level.
by compiling the file /maxima-5.27.0/src/mformt.lisp (step 9)
I have choose the option 1 to accept this. I got some more errors by compiling. After all I got
Out of memory PermGen space Restarts: 0: TOP-LEVEL Return to top level.
and abcl did not compiled maxima.
Can you tell me why I got these error? And how can repair them?
On Tue, Jun 19, 2012 at 5:04 AM, Robert Dodier robert.dodier@gmail.com wrote:
On 2012-06-16, Phuc Luoi phucluoi@gmail.com wrote:
How can I compile and run Maxima with ABCL?
(1) Unpack a Maxima tarball. http://sourceforge.net/projects/maxima and follow links to download
page.
Look for "Maxima-source".
(2) cd /path/to/maxima-5.27.0
(3) java -jar /path/to/abcl.jar
(4) (configure) ;; you can probably accept defaults for most/all
questions
(5) (quit)
(6) cd src
(7) java -jar /path/to/abcl.jar
(8) (require 'asdf)
(9) (asdf:operate 'asdf:load-op :maxima)
(10) (quit)
(11) java -jar /path/to/abcl.jar
(12) (require 'asdf)
(13) (asdf:operate 'asdf:load-op :maxima) ;; yes, same as (9)
(14) (cl-user::run) ;; should bring up Maxima banner & input prompt
Furthermore can I emmbed maxima in a Java Programm with ABCL?
Yes. I've appended an example program. Command line to compile it:
javac -cp /path/to/abcl.jar -d /path/to/compiled/class abcl_maxima.java
To execute it: (you must be in the Maxima src directory)
java -cp /path/to/compiled/class:/path/to/abcl.jar abcl_maxima
I get: (takes a minute or two to load Maxima)
loading Maxima ... finished. x.getClass => class org.armedbear.lisp.Cons x = org.armedbear.lisp.Cons@1748ba8 x.javaInstance => org.armedbear.lisp.Cons@1748ba8 x.javaInstance.getClass => class org.armedbear.lisp.Cons 4 factors of 12341234 factor: 2, multiplicity: 1 factor: 73, multiplicity: 1 factor: 137, multiplicity: 1 factor: 617, multiplicity: 1
Note that all user functions have names which begin with dollar sign. E.g. user function ifactors <==> $IFACTORS in Lisp
If you need help with Lisp programming for Maxima, ask questions on the mailing list. See: http://maxima.sourceforge.net/maximalist.html
Hope this helps, have fun, & good luck.
Robert Dodier
PS. Example program abcl_maxima.java:
// abcl_maxima.java -- example program for calling Maxima from Java via
ABCL
// copyright 2012 by Robert Dodier // I release this work under terms of the GNU General Public License
import org.armedbear.lisp.Interpreter; import org.armedbear.lisp.Package; import org.armedbear.lisp.Packages; import org.armedbear.lisp.Symbol; import org.armedbear.lisp.Function; import org.armedbear.lisp.LispObject; import org.armedbear.lisp.Fixnum; import org.armedbear.lisp.Bignum; import org.armedbear.lisp.Cons;
public class abcl_maxima { public static void main (String [] args) throws Exception { int a;
if (args.length > 0) a = Integer.parseInt (args [0]); else a = 12341234; Interpreter I = Interpreter.createInstance (); System.out.print ("loading Maxima ... "); I.eval ("(require 'asdf)"); I.eval ("(asdf:operate 'asdf:load-op :maxima)"); System.out.println ("finished."); Package P = Packages.findPackage ("MAXIMA"); // java.util.List <Symbol> L = P.getAccessibleSymbols (); // for (Symbol S : L) // { // if (P.equals (S.getPackage ())) // System.out.println (S.toString ()); // } Symbol S = P.findAccessibleSymbol ("$IFACTORS"); Function F = (Function) S.getSymbolFunction (); LispObject x = Bignum.getInstance (a); x = F.execute (x); System.out.println ("x.getClass => " + x.getClass ()); System.out.println ("x = " + x); System.out.println ("x.javaInstance => " + x.javaInstance
());
System.out.println ("x.javaInstance.getClass => " +
x.javaInstance () . getClass ());
int n = ((Cons) x).length (); System.out.println ((n - 1) + " factors of " + a); for (int i = 1; i < n; i++) { Cons x1 = (Cons) ((Cons) x).NTH (i); Fixnum f = (Fixnum) x1.NTH (1); Fixnum m = (Fixnum) x1.NTH (2); System.out.println ("factor: " + f.intValue () +
", multiplicity: " + m.intValue ());
} }
}
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
I have ready tried it. The error "PermGen" is corrected. But I even got the error "Can't intern zero-length symbol." I have search in google but can not find any useful article.
On Tue, Jun 19, 2012 at 2:21 PM, Blake McBride blake@mcbride.name wrote:
Java puts code (as opposed to data) in PermGen space (i.e. space that doesn't get garbage collected). The size of this space is fixed by default but can be overridden with a command line argument. Maxima (along with the Java code) probably contains too much code for the default java configuration. You can increase this java default as follows:
java -XX:MaxPermSize=200M -jar /path/to/abcl.jar
This makes the max permgen space 200 MB. You may have to vary that number.
Blake McBride
On Tue, Jun 19, 2012 at 6:29 AM, Phuc Luoi phucluoi@gmail.com wrote:
---------- Forwarded message ---------- From: Phuc Luoi phucluoi@gmail.com Date: Tue, Jun 19, 2012 at 12:51 PM Subject: Re: [armedbear-devel] How to compile and run Maxima with ABCL? To: Robert Dodier robert.dodier@gmail.com
Thanks for your answer.
I tried this and got these errors:
Can't intern zero-length symbol. Restarts: 0: RETRY Retry compiling #<ASDF:CL-SOURCE-FILE "maxima" "utilities" "mformt">. 1: ACCEPT Continue, treating compiling #<ASDF:CL-SOURCE-FILE "maxima" "utilities" "mformt"> as having been successful. 2: TOP-LEVEL Return to top level.
by compiling the file /maxima-5.27.0/src/mformt.lisp (step 9)
I have choose the option 1 to accept this. I got some more errors by compiling. After all I got
Out of memory PermGen space Restarts: 0: TOP-LEVEL Return to top level.
and abcl did not compiled maxima.
Can you tell me why I got these error? And how can repair them?
On Tue, Jun 19, 2012 at 5:04 AM, Robert Dodier robert.dodier@gmail.com wrote:
On 2012-06-16, Phuc Luoi phucluoi@gmail.com wrote:
How can I compile and run Maxima with ABCL?
(1) Unpack a Maxima tarball. http://sourceforge.net/projects/maxima and follow links to download page. Look for "Maxima-source".
(2) cd /path/to/maxima-5.27.0
(3) java -jar /path/to/abcl.jar
(4) (configure) ;; you can probably accept defaults for most/all questions
(5) (quit)
(6) cd src
(7) java -jar /path/to/abcl.jar
(8) (require 'asdf)
(9) (asdf:operate 'asdf:load-op :maxima)
(10) (quit)
(11) java -jar /path/to/abcl.jar
(12) (require 'asdf)
(13) (asdf:operate 'asdf:load-op :maxima) ;; yes, same as (9)
(14) (cl-user::run) ;; should bring up Maxima banner & input prompt
Furthermore can I emmbed maxima in a Java Programm with ABCL?
Yes. I've appended an example program. Command line to compile it:
javac -cp /path/to/abcl.jar -d /path/to/compiled/class abcl_maxima.java
To execute it: (you must be in the Maxima src directory)
java -cp /path/to/compiled/class:/path/to/abcl.jar abcl_maxima
I get: (takes a minute or two to load Maxima)
loading Maxima ... finished. x.getClass => class org.armedbear.lisp.Cons x = org.armedbear.lisp.Cons@1748ba8 x.javaInstance => org.armedbear.lisp.Cons@1748ba8 x.javaInstance.getClass => class org.armedbear.lisp.Cons 4 factors of 12341234 factor: 2, multiplicity: 1 factor: 73, multiplicity: 1 factor: 137, multiplicity: 1 factor: 617, multiplicity: 1
Note that all user functions have names which begin with dollar sign. E.g. user function ifactors <==> $IFACTORS in Lisp
If you need help with Lisp programming for Maxima, ask questions on the mailing list. See: http://maxima.sourceforge.net/maximalist.html
Hope this helps, have fun, & good luck.
Robert Dodier
PS. Example program abcl_maxima.java:
// abcl_maxima.java -- example program for calling Maxima from Java via ABCL // copyright 2012 by Robert Dodier // I release this work under terms of the GNU General Public License
import org.armedbear.lisp.Interpreter; import org.armedbear.lisp.Package; import org.armedbear.lisp.Packages; import org.armedbear.lisp.Symbol; import org.armedbear.lisp.Function; import org.armedbear.lisp.LispObject; import org.armedbear.lisp.Fixnum; import org.armedbear.lisp.Bignum; import org.armedbear.lisp.Cons;
public class abcl_maxima { public static void main (String [] args) throws Exception { int a;
if (args.length > 0) a = Integer.parseInt (args [0]); else a = 12341234;
Interpreter I = Interpreter.createInstance (); System.out.print ("loading Maxima ... "); I.eval ("(require 'asdf)"); I.eval ("(asdf:operate 'asdf:load-op :maxima)"); System.out.println ("finished."); Package P = Packages.findPackage ("MAXIMA");
// java.util.List <Symbol> L = P.getAccessibleSymbols (); // for (Symbol S : L) // { // if (P.equals (S.getPackage ())) // System.out.println (S.toString ()); // }
Symbol S = P.findAccessibleSymbol ("$IFACTORS"); Function F = (Function) S.getSymbolFunction (); LispObject x = Bignum.getInstance (a); x = F.execute (x); System.out.println ("x.getClass => " + x.getClass ()); System.out.println ("x = " + x); System.out.println ("x.javaInstance => " + x.javaInstance ()); System.out.println ("x.javaInstance.getClass => " + x.javaInstance () . getClass ());
int n = ((Cons) x).length (); System.out.println ((n - 1) + " factors of " + a);
for (int i = 1; i < n; i++) { Cons x1 = (Cons) ((Cons) x).NTH (i); Fixnum f = (Fixnum) x1.NTH (1); Fixnum m = (Fixnum) x1.NTH (2); System.out.println ("factor: " + f.intValue () + ", multiplicity: " + m.intValue ()); } } }
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
On Jun 19, 2012, at 15:24 , Phuc Luoi wrote:
I have ready tried it. The error "PermGen" is corrected. But I even got the error "Can't intern zero-length symbol." I have search in google but can not find any useful article.
This error is fixed in the development version of abcl, on Jan 12. It might not yet have arrived in any released version.
The patch (taken from source control version history) looks like this:
--- a/src/org/armedbear/lisp/Stream.java +++ b/src/org/armedbear/lisp/Stream.java @@ -1136,8 +1136,10 @@ public class Stream extends StructureObject { packageName + '.', this)); } + } else { // token.length == 0 + Package pkg = (Package)Symbol._PACKAGE_.symbolValue(thread); + return pkg.intern(""); } - return error(new ReaderError("Can't intern zero-length symbol.", this)); }
private final BitSet _readToken(StringBuilder sb, Readtable rt)
Unfortunately, this is in the Java part of abcl and cannot be patched in an init file. You will have to recompile the whole of abcl yourself.
Rudi
On 2012-06-19, Rudi Schlatte rudi@constantly.at wrote:
This error is fixed in the development version of abcl, on Jan 12. It might not yet have arrived in any released version.
For the record, I'm working with svn r13978 (2012-06-18).
best,
Robert Dodier
Can I just manual fix/path the source in the released version? I means copy past. However I will try to compile abcl from SVN tonight. Thank you for your detailed answer.
Best wish.
Hong Phuc
On Tue, Jun 19, 2012 at 5:33 PM, Robert Dodier robert.dodier@gmail.com wrote:
On 2012-06-19, Rudi Schlatte rudi@constantly.at wrote:
This error is fixed in the development version of abcl, on Jan 12. It might not yet have arrived in any released version.
For the record, I'm working with svn r13978 (2012-06-18).
best,
Robert Dodier
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
On Jun 19, 2012, at 17:41 , Phuc Luoi wrote:
Can I just manual fix/path the source in the released version? I means copy past. However I will try to compile abcl from SVN tonight. Thank you for your detailed answer.
Yes, if you download the source of the released version and the patch applies cleanly, you can use that to create an abcl that is identical to the released version except for the bugfix. Good luck!
Rudi
Yes, it should be possible to simply cut and paste the new lines of code. Or you can use the program 'patch' if it is on your system.
By the way, to what end are you working with Maxima and Java? Just curious.
best,
Robert Dodier
I 'm working on the E-Learning system mathcoach: http://mathcoach.htw-saarland.de/project/ We plan to use maxima for the back-end our system. We used python to connect to maxima over Pipe (in Linux) and redirect the output of maxima to a http-server written in Python. The Java front-end can then connect to the http server. I think it is more robust if we can integrate maxima directly in Java, something like a jar file or so.
On Tue, Jun 19, 2012 at 6:10 PM, Robert Dodier robert.dodier@gmail.com wrote:
Yes, it should be possible to simply cut and paste the new lines of code. Or you can use the program 'patch' if it is on your system.
By the way, to what end are you working with Maxima and Java? Just curious.
best,
Robert Dodier
Hi, after I let the maxima run_testsuite(); run, I got the result of maxima test suite in abcl:
The following 3 problems failed: (403 411 524) Running tests in rtest_expintegral: 185/185 tests passed Running tests in rtest_signum: 44/44 tests passed Running tests in rtest_lambert_w: 35/35 tests passed Running tests in rtest_elliptic: 81/81 tests passed Running tests in rtest_integrate: 812/812 tests passed Running tests in rtest_integrate_special: 53/53 tests passed Running tests in rtest_ask: 6/6 tests passed Running tests in rtest_sqrt: 313/313 tests passed (not counting 1 expected errors) Running tests in rtest_carg: 55/55 tests passed (not counting 2 expected errors) Running tests in rtest_log: 120/120 tests passed (not counting 1 expected errors) Running tests in rtest_power: 72/72 tests passed (not counting 6 expected errors)
Error summary: Error found in /usr/local/share/maxima/5.27.0/tests/rtest16.mac, problem: (393) Errors found in /usr/local/share/maxima/5.27.0/tests/rtest_gamma.mac, problems: (403 411 524) 4 tests failed out of 9,169 total tests. 380.728 seconds real time 741765431 cons cells
also 4 of 9,169 tests. Not bad.
On 2012-06-20, Phuc Luoi phucluoi@gmail.com wrote:
Error found in /usr/local/share/maxima/5.27.0/tests/rtest16.mac, problem: (393) Errors found in /usr/local/share/maxima/5.27.0/tests/rtest_gamma.mac, problems: (403 411 524)
I believe these tests fail for some Lisp implementations because of differences in floating point functions. We (Maxima developers) don't have a good way to compensate for that. Typically someone just fudges the error tolerance from a very small number to a slightly larger small number.
best
Robert Dodier
I think even so. Just only 4 of 9,169 it is a very very small quote, and even comes from floating point, which is very different implemented.
On Wed, Jun 20, 2012 at 5:25 PM, Robert Dodier robert.dodier@gmail.com wrote:
On 2012-06-20, Phuc Luoi phucluoi@gmail.com wrote:
Error found in /usr/local/share/maxima/5.27.0/tests/rtest16.mac, problem: (393) Errors found in /usr/local/share/maxima/5.27.0/tests/rtest_gamma.mac, problems: (403 411 524)
I believe these tests fail for some Lisp implementations because of differences in floating point functions. We (Maxima developers) don't have a good way to compensate for that. Typically someone just fudges the error tolerance from a very small number to a slightly larger small number.
best
Robert Dodier
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
On 2012-06-20, Phuc Luoi phucluoi@gmail.com wrote:
I 'm working on the E-Learning system mathcoach: http://mathcoach.htw-saarland.de/project/ We plan to use maxima for the back-end our system. We used python to connect to maxima over Pipe (in Linux) and redirect the output of maxima to a http-server written in Python. The Java front-end can then connect to the http server.
Hmm, you might be able to simplify this architecture somewhat. There is a share package, maxima-server.lisp, which implements an ordinary Unix-ish server via listen, accept, and fork function calls (in SBCL). Each client gets a separate session (due to fork). Maxima has command line options to turn off the input and output labels and banner message, so only results are output.
What is the output of the Python HTTP server? You could probably write that same functionality in Lisp, or maybe in Maxima itself.
I think it is more robust if we can integrate maxima directly in Java, something like a jar file or so.
That makes sense to me. The main problem I see, which affects socket-based architectures as well, is that Maxima sometimes wants to ask questions (e.g. "Is x positive, negative, or zero?"). I don't know what to do about that. There is an experimental share package named noninteractive which attempts to intercept such questions and turn them into if-then expressions. I can say more about that if you are interested.
best
Robert Dodier
Hmm, you might be able to simplify this architecture somewhat. There is a share package, maxima-server.lisp, which implements an ordinary Unix-ish server via listen, accept, and fork function calls (in SBCL). Each client gets a separate session (due to fork). Maxima has command line options to turn off the input and output labels and banner message, so only results are output.
I have never known about it, I will try it. Well firstly i must learn to program in lisp. I have never programmed in lisp.
What is the output of the Python HTTP server? You could probably write that same functionality in Lisp, or maybe in Maxima itself.
python takes all output of maxima an redirects http server. I choose http because its more robuster than primary tcp socket server.
That makes sense to me. The main problem I see, which affects socket-based architectures as well, is that Maxima sometimes wants to ask questions (e.g. "Is x positive, negative, or zero?"). I don't know what to do about that. There is an experimental share package named noninteractive which attempts to intercept such questions and turn them into if-then expressions. I can say more about that if you are interested.
Yes, please tell me about that. Thanks you very much.
On Thu, Jun 21, 2012 at 8:12 AM, Robert Dodier robert.dodier@gmail.com wrote:
On 2012-06-20, Phuc Luoi phucluoi@gmail.com wrote:
I 'm working on the E-Learning system mathcoach: http://mathcoach.htw-saarland.de/project/ We plan to use maxima for the back-end our system. We used python to connect to maxima over Pipe (in Linux) and redirect the output of maxima to a http-server written in Python. The Java front-end can then connect to the http server.
Hmm, you might be able to simplify this architecture somewhat. There is a share package, maxima-server.lisp, which implements an ordinary Unix-ish server via listen, accept, and fork function calls (in SBCL). Each client gets a separate session (due to fork). Maxima has command line options to turn off the input and output labels and banner message, so only results are output.
What is the output of the Python HTTP server? You could probably write that same functionality in Lisp, or maybe in Maxima itself.
I think it is more robust if we can integrate maxima directly in Java, something like a jar file or so.
That makes sense to me. The main problem I see, which affects socket-based architectures as well, is that Maxima sometimes wants to ask questions (e.g. "Is x positive, negative, or zero?"). I don't know what to do about that. There is an experimental share package named noninteractive which attempts to intercept such questions and turn them into if-then expressions. I can say more about that if you are interested.
best
Robert Dodier
armedbear-devel mailing list armedbear-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
On 2012-06-21, Phuc Luoi phucluoi@gmail.com wrote:
I have never known about it, I will try it. Well firstly i must learn to program in lisp. I have never programmed in lisp.
Oh, to use maxima-server.lisp you don't need to do any Lisp programming. Just load("maxima-server.lisp"); and then: :lisp (server-run) See the comments in maxima-server.lisp for more info.
What is the output of the Python HTTP server? You could probably write that same functionality in Lisp, or maybe in Maxima itself.
python takes all output of maxima an redirects http server. I choose http because its more robuster than primary tcp socket server.
OK, I guess, but then there is still the socket between Maxima and Python, so in a sense that socket is still the weak link in the chain. I'll let you be the judge of it.
Yes, please tell me about that. Thanks you very much.
Take a look at share/contrib/noninteractive/noninteractive.mac. I'll give some details later today.
best
Robert Dodier
python takes all output of maxima an redirects http server. I choose http because its more robuster than primary tcp socket server.
OK, I guess, but then there is still the socket between Maxima and Python, so in a sense that socket is still the weak link in the chain. I'll let you be the judge of it.
Yes, It was a socket connection between python and Maxima. And it was really a weak connection. I have tried it for one year. Now we use the library pyexpect http://www.noah.org/wiki/pexpect as "glue" to connect Maxima and Python together. This library uses tty and pty to connect the program. It is more stable than socket.
Other reason that I use python is, It has some out-of-the box framework for http such as authority, and authentication, and so on. So far I have even a simple JSONRPC Protocol developed for this purpose. Unfortunately I can not publish my work, because it is a part of my job.
I think in the future we will use the Maxima server instead of tty and pty for the connection between Maxima and python, any use python only for authentication and authority.
best. Hong Phuc
Hi, I have tried the maxima-server.lisp. It works reallly more robuster than $ maxima -s <port-numer> I'm writing a small wrapper in Java to start, load maxima-server, and after some time terminate the maxima process to bind it in a Tomcat server, so I don't need to use Python. If I can, I'll publish these work under an opensource licence.
Have a nice weekend. HongPhuc
On Fri, Jun 22, 2012 at 1:29 PM, Phuc Luoi phucluoi@gmail.com wrote:
python takes all output of maxima an redirects http server. I choose http because its more robuster than primary tcp socket server.
OK, I guess, but then there is still the socket between Maxima and Python, so in a sense that socket is still the weak link in the chain. I'll let you be the judge of it.
Yes, It was a socket connection between python and Maxima. And it was really a weak connection. I have tried it for one year. Now we use the library pyexpect http://www.noah.org/wiki/pexpect as "glue" to connect Maxima and Python together. This library uses tty and pty to connect the program. It is more stable than socket.
Other reason that I use python is, It has some out-of-the box framework for http such as authority, and authentication, and so on. So far I have even a simple JSONRPC Protocol developed for this purpose. Unfortunately I can not publish my work, because it is a part of my job.
I think in the future we will use the Maxima server instead of tty and pty for the connection between Maxima and python, any use python only for authentication and authority.
best. Hong Phuc
armedbear-devel@common-lisp.net