wiki:MPreduce
Last modified 13 months ago Last modified on 04/23/11 14:51:04

Introduction

MPReduce is an experimental version of JReduce. JReduce is part of the Reduce project which is at http://reduce-algebra.sourceforge.net/.

Building Instructions

You can check out mpreduce using subversion using the following command:

svn checkout https://mathpiper.googlecode.com/svn/trunk/src/library_apps/mpreduce
mpreduce-read-only

Apache Ant is used to build mpreduce and you need to change into the mpreduce-read-only directory to execute the ant tasks which are in the build.xml file.

The mpreduce system consists of a Lisp interpreter which is written in Java and a large number of packages which are written in the Reduce RLisp language. The packages are compiled and placed into a .img file which is accessed by the Lisp interpreter during runtime.

The following tasks are used to compile the interpreter and create .img files.

Delete the build directory:

ant clean

Compile the Java-based Lisp interpreter and place the compiled code into build/classes:

ant compile

Run the compile task. Then, create a reduce.img file which contains a compiled version of all of the reduced packages and place it into build/image:

ant reduce.img

Run the compile task. Then, create a minireduce.img file which contains a compiled version of a subset of the reduced packages and place it into build/image:

ant minireduce.img

Running Instructions

When the mpreduce interpreter is run, it needs to be able to access a .img file or it will throw an exception. If any .img file (such as reduce.img or minireduce.img) is renamed to default.img and then placed on the classpath, the interpreter will be able to find it. The following example shows how a .img file can be renamed while being copied into the classes directory before running mpreduce:

cd build/classes
cp ../images/reduce.img ./default.img

To run the mpreduce command line interface, change into build/classes directory and execute the following command (use ctrl-c to exit):

java org.mathpiper.mpreduce.Jlisp

To run the mpreduce GUI interface, execute the following command:

java org.mathpiper.mpreduce.ui.gui.CWin

Using the Interpreter from Java

The org/mathpiper/mpreduce/Interpreter.java class can be used to access the mpreduce interpreter from Java. The main method in this class contains some examples of how to do this.

Questions

Q: What does differentiating asin(sin(x)) give? (Note: result is cos(x) / sqrt(1 - sin(x)²) in Maxima and in MathPiper)

A: The current MPReduce from the MathPiper SVN (Rev. 3996 from 27.03.2011) gives:

                  2
  - sqrt( - sin(x)  + 1)*cos(x)
--------------------------------
                2
          sin(x)  - 1