Link Java to Maple

A java project should link to Maple using those math methods.  Step as following.

1. In the maple, get the bin lib path. in windows XP, input:

> kernelopts(bindir);

and I get the answer:  "d:\Program Files\Maple 11\bin.win"

2. Set the path into the windows system path. You can check it with "echo %path%" command.

3. Create the java project, and import the packages: externalcall.jar and jopenmaple.jar in %MAPLE%\java dictionary.

4. Build and run.

 

I use the %MAPLE%\samples\OpenMaple\Java\jcmaple for test. And that's perfect !

run the sample and input a recursive equation set to get the solution.

> eq[1] := d(0) = d[0];

                             eq[1] := d(0) = d[0]

> eq[2] := d(k+1) = d(k)+1;

                           eq[2] := d(k+1) = d(k)+1

> eq[3] := l1(m+1) = l1(m)+1;

                          eq[3] := l1(m+1) = l1(m)+1

> eq[4] := l2(n+1) = l2(n)+1;

                          eq[4] := l2(n+1) = l2(n)+1

> eq[5] := l1(0) = l1[0];

                            eq[5] := l1(0) = l1[0]

> eq[6] := l2(0) = l2[0];

                            eq[6] := l2(0) = l2[0]

> p := rsolve(convert(eq, set), {d(k), l1(m), l2(n)});

            p := {d(k) = k+d[0], l1(m) = m+l1[0], l2(n) = n+l2[0]}

 

Maple can convert procedures and data into the languages such as C, Java, BASIC and so on, however it can not convert the kernel funtions like the "rsovle". As a result, it's the only way to use its API.

Ok, I'll use it to solve my complex problems for bug-finding in the software.

 

posted on 2009-04-27 19:37  逍遥子  阅读(397)  评论(0编辑  收藏  举报

导航