Calling Maxima $diff from java



>>>>> "Rupert" == Rupert Swarbrick <rswarbrick at gmail.com> writes:

    Rupert> Mohamed Rayes <rayes.o.mohamed at gmail.com> writes:
    >> I have compiled maxima with ABCL as described in
    >> http://comments.gmane.org/gmane.lisp.armedbear.devel/2365. I even
    >> successfully ran a java program that calls maxima $Factors. The
    >> program is listed at the end of this message.
    >> 
    >> I tried calling the $DIFF (as in $DIFF(sin(x),x)) function in the
    >> following way:
    >> 
    >> 1- manually translated sin(x) to maxima internal rep: sin(x) ==> ((%sin) $x)
    >> 2- calling $Diff:
    >> 
    >> Interpreter I = Interpreter.createInstance ();
    >> I.eval ("(require 'asdf)");
    >> I.eval ("(asdf:operate 'asdf:load-op :maxima)");
    >> Package P = Packages.findPackage ("MAXIMA");
    >> LispObject exp = I.eval("'(%SIN) $x)");
    >> LispObject x = I.eval("'$x");
    >> Symbol S = P.findAccessibleSymbol ("$DIFF");
    >> Function F = (Function) S.getSymbolFunction ();
    >> LispObject result = F.execute(exp,p);
    >> 
    >> I keep getting the error that $DIFF was not found?
    >> 
    >> Thanks for all the help.

    Rupert> Ah, I see. I haven't used ABCL, but what you've pasted here looks
    Rupert> plausible (in particular, you've got the case of $DIFF correct in the
    Rupert> code). Can you post the actual error you're getting? One of us might be
    Rupert> able to help more.

On the other hand, since you're running maxima on abcl, why bother
going through all these hoops and just use the repl that comes with
maxima and abcl?  (I assume maxima running on abcl has a repl.  I've
never tried it.)

Ray