2010-09-06 53 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