GinacSym: a fast C++ symbolic manipulation library

GinacSym is a fast C++ symbolic manipulation library. It has been made on GiNaC c++ library. It has many additional features in compared to GiNaC library, some are functions f(x), Infinity, inert differential Diff, inert integration Integration, integrate, solve of system of nonlinear polynomial equations, simplify of algebraic expressions, many new mathematical functions, powerful factor of polynomial expressions using flint c library etc. The main aim of this project ginacsym is to become a complete computer algebra system by adding many new features to ginac library, and creating its a python wrapper GinacSympy. GinacSympy is also a beautiful project which is a Cython frontend to ginacsym, and in jupyter notebook we can make all mathematical computations with mathjax equation rendering.

Main differences between GiNaC and GinacSym:

At first you should read this tutorial on GiNaC, and then it is easy to work with GinacSym. There are two main differences between GiNaC and GinacSym:
  1. In GiNaC, symbols are declared by symbol, realsymbol, possymbol classes, and mathematical expressions from string are parsed by parser class. In GinacSym, symbols and mathematical expressions from string are created by generator class, and all new symbols are generated and stored in generator class. In this regard, following code shows a brief comparison between GiNaC code and GinacSym code:
    GiNaC Code:
     symbol x("x");
     realsymbol y("y");
     possymbol z("z");
     parser reader;
     ex expr=reader("x^2+y^2");
    
    Corresponding GinacSym code:
     ex x=generator.symGenerator("x",symbol_assumptions::symbol);
     ex y=generator.symGenerator("y",symbol_assumptions::realsymbol);
     ex z=generator.symGenerator("z",symbol_assumptions::possymbol);
     ex expr=generator.exGenerator("x^2+y^2");
    

  2. In GiNaC, the map_function class declares a virtual function call operator (()) that we can overload. But in GinacSym, the map_function class declares a virtual function expr_visitior() (instead of call operator) that we can overload.
    GiNaC Code:
     struct map_rem_quad : public map_function {
        ex var;
        map_rem_quad(const ex & var_) : var(var_) {}
        ex operator()(const ex & e)
        {
            if (is_a(e) || is_a(e))
            return e.map(*this);
            else if (is_a(e) &&
                    e.op(0).is_equal(var) && e.op(1).info(info_flags::even))
            return 0;
            else
            return e;
        }
     };
    
    Corresponding GinacSym code:
     struct map_rem_quad : public map_function {
        ex var;
        map_rem_quad(const ex & var_) : var(var_) {}
        ex expr_visitor(const ex & e)
        {
            if (is_a(e) || is_a(e))
            return e.map(*this);
            else if (is_a(e) &&
                    e.op(0).is_equal(var) && e.op(1).info(info_flags::even))
            return 0;
            else
            return e;
        }
     };
    
    We have made this change because it is impossible to wrap virtual function call operator in the python wrapper GinacSympy, but we can easily wrap expr_visitior() in GinacSympy.

Additional Features:

In contrast to GiNaC, GinacSym has the following additional features:

Install:

To install GinacSym, we require C library flint>=3.0.0 and c++ library CLN >= 1.3.4. After installing these dependencies, we can install GinacSym using the following commands:
 $ ./configure
 $ make
 $ make check
 $ make install