English / Japanese

Ruby/Mathematica

Ruby/Mathematica is a library for Ruby that provides an interface to the MathLink(TM) library. This library has some methods that implement a protocol for sending and receiving Mathematica(TM) expressions. Using this library, a Ruby program runs with Mathematica kernel in the background as a computational engine. In the future we wish to improve the library that Mathematica can communicate Ruby scripts or objects.

Version

Newer Ruby/Mathematica version is 0.0.3. Now some codes for Mathematica on Windows are included. This version is alpha and released experimentally.

Changes

There are two main improvements between 0.0.1a and 0.0.1:

See also ChangeLog or NEWS.

Download

ruby-mathematica-0.0.3.tar.gz

Old version (stable than alpha version) is also available.

Warning

The Ruby/Mathematica library is alpha version now. This library may hang up or do core dump. Take care that your important data do not be missing.

Please tell us some problems when you meet. We want to improve the library.

Ruby/Mathematica is totally copyrighted free and you can freely use, copy, modify, improve, or destribute it as same as Ruby. However, you must need Wolfram Research, Inc's permission to redistribute MathLink itself, or distribute a library that is statically linked with MathLink. Now this library includes neither MathLink nor a library that statically linked with MathLink. This library follows the MathLink License Agreement too.

We welcome any comments and improvements.

Requirements

Note: MathLink C library is ordinary included Mathematica as AddOns. The C library was installed automatically when Mathematica did.

We tested only on ruby version 1.6.4 and Mathematica version 4.1 on DEC UNIX alpha station. This library may possibly not work on another versions. When the library does not work on your compurter, please tell us problems and your environments, such that

We wish to improve the library.

The MathLink C library works on not only Unix but also Windows or Macintosh. To run Ruby/Mathematica on Windows or Macintosh, it needs a C compiler of the platforms. On Windows, I confirm that the version 0.0.2 works using Cygwin.

Example

We prepare some simple examples for Ruby/Mathematica.

This example is quite small but powerful computation using Mathematica.

Note: matheval.rb works only from version 0.0.1a. This interface is also experimentally.

For using MathLink with Ruby/Mathematica;

Description

The Ruby/Mathematica library newer version has two modules and two classes,

Mathematica:: # module Mathematica
  MathLink::  # submodule MathLink
     MathLink # class MathLink
  Mathematica # class Mathematica

Mathematica module as the top module is an abstract module to provide a name space for Ruby/Mathematica.

Mathematica class is an interface to communicate Mathematica kernel without knowledge about MathLink. See also doc.en/mathematica.html for detail of all methods in Mathematica class. We may change some methods or a interface or a framework at newer version suddenly since this library is experimentally now.

MathLink class has some methods produced by MathLink C library. The class does not have all MathLink C-functions but a Ruby program may connect Mathematica kernel and compute some expressions using only few methods provided the MathLink class. Please see also some examples.

When a Ruby program connects Mathematica kernel using Ruby/Mathematica, the programmer have to know some details about MathLink now. However, the MathLink class will provide an easier interface than MathLink C library. (We wish to provide more useful interface in the future.) There are some samples in ``./samples'' directory.

The MathLink module has some constants defined by MathLink. See also mathlink.h that is provided Mathematica. (The header file ``mathlink.h'' locates in your Mathematica directory)

Classes and Methods

Here is all methods list provided newer version.

Related Links

Copyright

Both Mathematica(TM) and MathLink(TM) are registered trademarks of Wolfram Research, Inc.

Back...

Last modified: "Wed Sep 18 13:59:25 2002"
[Server was down at Oct 28-29 2001 and this page is moved on new server. Thanks.]