2010-09-06 23 views
3

我在写OCaml代码。在其中的一部分,我想检查两个算术表达式是否相等(如x + 2 + y == x + 2 * y-y + 2)。在mathematica中实现这一点很简单,所以我希望在执行Mathematica时获得一些帮助,并在OCaml中获得结果。我的操作系统平台是Linux。从OCaml程序调用Mathematica

干杯, Z.

回答

3

您可以沿着这个线路使用的东西:

let channel_to_mathematica, channel_from_mathematica = open_process "mathematica" 
in 
Printf.fprintf channel_to_mathematica "Tell me if this is equal ...\n"; 
let answer_from_mathematica = Scanf.fscanf channel_from_mathematica ... 
in 
... 

Documentation of open_process here

Documentation of module Scanf here