This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

interfacing Ocaml with Mathematica
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: 2010-09-10 (12:54) From: Frederic Chyzak Subject: Re: [Caml-list] interfacing Ocaml with Mathematica
```Hi,

On Fri, 2010-09-03 at 16:49 +0100, zaid al-zobaidi wrote:
> I am writing an Ocaml code and part of it I need to do the following job:
>
> * I want to find out if two arithmetic or logical expressions  are equal
>   like "a + b" and "2 * a + b - a" or "a and b or a" and "a", and Ocaml

It is not clear to me what power of symbolic computation you really
need.

If you really need to be able to interface a computer-algebra system
with ocaml (whether Mathematica or Maple or ...), you might be
interested to hear that we are developing a tool [1] named DynaMoW
(for Dynamic Mathematics on the Web) for this purpose.  (Well, beyond
this, our purpose is to generate web pages with dynamic mathematical
content).  We cannot unfortunately point you to a public release as we
expect our first release only later this fall.

Concerning the test you were asking for, it could be coded as follows
using DynaMoW's quotations and antiquotations, and Mathematica's
syntax:

let s1 = <:symb< a + b >> and s1 = <:symb< 2 * a + b - a >> in
let b = <:bool< If[ \$(symb:s1) == \$(symb:s2), True, False, False ] >>
in
if b then "equal" else "different" ;;

If this really is the route you have to go, we are ready to discuss it
further.

Best regards,