Skip to main content
Giac is a free computer algebra system that can be installed and used in multiple ways across different platforms.

Prerequisites

Since Giac is a C++ library, you need to have a compiler toolchain installed:
  • Node.js and npm
  • A C++ compiler (gcc, clang, or Visual Studio)
  • GMP library (GNU Multiple Precision Arithmetic)
  • MPFR library (Multiple Precision Floating-Point Reliable)
  • node-gyp for native compilation

Linux

Install the required packages:
sudo apt install build-essential libgmp-dev libmpfr-dev
Ubuntu 16.04 and above are supported. Tested on amd64, i386, and armhf processors.

macOS

Install dependencies using MacPorts:
sudo port install gmp mpfr
The build assumes GMP and MPFR are installed in /opt/local/lib. If using a different location, set the LIBDIR environment variable.

Windows

Currently only the 32-bit version works correctly. The 64-bit version may fail for some computations.
  1. Follow Microsoft’s NodeJS Guidelines to set up node-gyp
  2. Install Visual Studio 2013 (newer versions may cause compilation errors)
  3. Download MPIR (instead of GMP) and MPFR static libraries (.LIB files)
  4. Place .LIB files in the current folder or set the LIBDIR environment variable
  5. Place .DLL files (MPIR.DLL and MPFR.DLL) in the same folder for runtime

Installation

Install the latest stable version:
npm install giac
Or install the latest development version:
npm install giac@latest

Faster compilation

The compilation may take several minutes. Speed it up by using multiple cores:
JOBS=4 npm install giac@latest
Set JOBS to the number of CPU cores on your system for optimal compilation speed.

Testing

After installation, test that Giac is working:
cd node_modules/giac
npm test
On Windows, ensure the .DLL files are in the giac folder or build subfolder before testing.

Verifying Installation

After installation, verify that Giac is working correctly by running a simple test:
var giac = require('bindings')('giac');
console.log(giac.evaluate("expand((x+y)^3)"));
// Output: x^3+y^3+3*x*y^2+3*x^2*y

Getting Help

If you encounter any issues or have questions:

Next Steps

Quick Start Guide

Learn the basics with a hands-on tutorial

API Reference

Explore available functions and methods

Build docs developers (and LLMs) love