On Thu, Jan 15, 2015 at 6:38 PM, yueming liu <[email protected]> wrote:
> Just finished a prototype of the project SymJava (
> https://github.com/yuemingl/SymJava ) which is similar to sympy. Actually, I
> borrowed some ideas from sympy. Thanks all the sympy contributors.
>
> The reason to develop this library is that sympy can NOT run on JPython :(.
> I have another Java library FuturEye for numerical computation to solve PDE
> constrained inverse problems. Symbolic computation is important for this
> library since it will reduce a huge amount of time with automatic functional
> derivative computation.
>
> Here is a piece of example code of SymJava:
>
> Expr expr = x + y * z;
>
> System.out.println(expr); //x + y*z
>
> Expr expr2 = expr.subs(x, y*y);
>
> System.out.println(expr2); //y^2 + y*z
>
> System.out.println(expr2.diff(y)); //2*y + z
>
> Func f = new Func("f1", expr2.diff(y));
>
> System.out.println(f); //f1(y,z)
>
> BytecodeFunc func = f.toBytecodeFunc(); //Similar to the lambdify in sympy
>
> System.out.println(func.apply(1,2)); //4.0
>
> There are two important features:
>
> 1. Operator Overloading is implemented by using
> https://github.com/amelentev/java-oo
>
> 2. Lambdify in sympy is implemented in SymJava by using BCEL library
>
> Let me know if any one interested in this? Just send me an email:
> nkliuyuemingATgmail.com

Very cool.

As Aaron said, the best is to simply figure out how to interface
CPython (as opposed to create an alternative implementation), for
example like Julia guys did it ---- they can call SymPy directly from
Julia, and it just uses the regular CPython interpreter.

Another thought is that we are also developing CSymPy
(https://github.com/sympy/csympy) in C++ with a C interface
(https://github.com/sympy/csympy/blob/34ab10dc6cb64f4a4739f5d094a39168b8081ab2/src/cwrapper.h),
for efficiency. It is just a simple .a or .so library and the C
interface allows you to call it from any language, like Python, Julia
or Java (http://en.wikipedia.org/wiki/Java_Native_Interface,
https://github.com/twall/jna/, ...). For your applications, can you
call C from Java?

If so, you can then either call CSymPy, or find a library (or write
one) that calls the CPython interpreter using C/API, similar to how
the Julia <-> Python interface works, then you can call SymPy
directly.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVCZ68L5zOn8muyxkgztMN04ygjTtBeUNCt%2BEGmi155kEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to