Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gap-system with all npm packages installed. Try it out:

var gapSystem = require("gap-system")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gap-system v0.1.0

Perform computations using the GAP computer algebra system

gap-system

Perform computations using the GAP computer algebra system from node.js.

Setup

  • Currently only supports calculating expressions created in OpenMath XML format.
  • Requires OpenMath in your GAP installation.
  • Create a workspace in GAP using:
gap> LoadPackage("openmath");
gap> SaveWorkspace("workspace");
true
gap>

Usage

Initialize:

var gap = require('gap-system')({
  path: GAP_PATH,
  workspace: 'workspace'
});

Calculate:

var xml = "<OMOBJ xmlns='http://www.openmath.org/OpenMath' version='2.0' cdbase='http://\www.openmath.org/cd'> <OMA> <OMS cd='arith1' name='plus'/> <OMI>3</OMI> <OMI>4</OMI> </OMA> </OMOBJ>";

gap.calculate(xml, function(err, resp) {
  var result = resp;
});

Options

path

Type: String - [Optional] Default: 'gap'

Path to your GAP installation. You can also use GAP_PATH.

workspace

Type: String - [Required]

Path to your GAP workspace.

Development

Running tests:

npm test

or custom path:

GAP_PATH=[path]/gap/gap npm test

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free