Link Java to Maple

本文介绍如何通过设置环境变量及导入必要jar包,在Java项目中调用Maple解决递归方程组的方法。具体步骤包括获取Maple的bin路径并将其加入系统路径,创建Java项目并导入外部调用所需的jar文件。

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.

 

转载于:https://www.cnblogs.com/xiaoyz/archive/2009/04/27/1444795.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值