gpt4 book ai didi

ocaml - 从 OCaml 程序调用 Mathematica

转载 作者:行者123 更新时间:2023-12-01 11:07:40 26 4
gpt4 key购买 nike

我正在编写 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com