ocaml - 从 OCaml 程序调用 Mathematica

标签 ocaml wolfram-mathematica

我正在编写 OCaml 代码。其中一部分,我想检查两个算术表达式是否相等(比如 x+2+y == x+2*y-y+2)。在 Mathematica 中实现这个很简单,所以我只需要一些帮助来执行 Mathematica 并将结果返回到 OCaml 中。我的操作系统平台是 Linux。

干杯, Z.

最佳答案

您可以按照以下方式使用一些东西:

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

关于ocaml - 从 OCaml 程序调用 Mathematica,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3650674/

相关文章:

functional-programming - 在 OCaml 中反转 int

functional-programming - 匹配比较 OCaml

types - ocaml %identity 函数

wolfram-mathematica - Mathematica中的 “hand-drawn”对象

plot - 平滑密度图 Mathematica

OCaml 仅从模块中打开某些值/类型

haskell - SystemT 编译器和处理 Haskell 中的无限类型

wolfram-mathematica - 如何提高这段代码的性能?

optimization - Mathematica 求幂并查找指定系数

wolfram-mathematica - 如何在源代码级别区分 2 个笔记本?