Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling Mathematica from OCaml program

I am writing OCaml code. In part of it, I want to examine whether two arithmetic expression are equal (like x+2+y == x+2*y-y+2). Implemeting this in mathematica is straightforward, so all I want some help on executing Mathematica and get the result back in OCaml. My OS platform is Linux.

Cheers, Z.

like image 767
user440526 Avatar asked Nov 20 '25 21:11

user440526


1 Answers

You may be able to use something along the lines of this:

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

like image 130
Pascal Cuoq Avatar answered Nov 23 '25 05:11

Pascal Cuoq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!