Skip to content

Getting started

Antoine Tran edited this page Apr 12, 2019 · 29 revisions

Mask-algebra is a free, cross-platform, open-source, flexible and user-friendly library that allows numeric/algebraic expressions treatment. Most of the features rely on the binary tree algorithm, a procedure that consists of splitting an expression into different branches, so that that the problem can be divided and treated more easily.

This is quite an early project, however, some nice features are already available


The core of the API is based on three main systems:

  • The Operation system
  • The Structure system
  • The Affection system


As its title suggest, the operation system takes care of the different calculations you can perform involving a single mathematical expression (+ potential extra data). The operations handled by the library are the following:

  • Expression reduction
    • Extra data : None
  • Expression expansion
    • Extra data : None
  • Derivative calculation
    • Extra data: The unknown of the function
  • Image of function calculation
    • Extra data: Mapped unknown and values

On the other hand, the structure system handles the calculations implying several expression (+ potential extra data). It handles:

  • Equation solving (first degree only yet)
    • Extra data: None
  • Compositions of functions (not available yet)
    • Extra data: None
  • Other features unavailable for the moment

Eventually, the affection system takes care of two principal actions :

  1. Input / Output modification
  2. Calculation canceling

These actions allow the user to define calculation options through the different steps of an operation. The IO modification system formats the different inputs (before a calculation) and outputs (after a calculation) provided. The following modifications can be applied:

  • Significant digits amount (output)

After performing binary operations (+-*/^), the result may have too many significant digits. This affection will reduce the result if that is the case. The value of the maximum allowed digits can be changed at runtime.

  • Angles unit conversion: degrees-radians-gradients (input)

By default, the trigonometric operations are performed assuming the angles are given in radians. If chosen, the effect will convert (if possible) the angle value found to radians.


The canceling system, as its name suggests, checks whether an input (before a calculation) cannot (or does not need) to be calculated. It might be extremely helpful if some results do not need to be expanded or reduced the most. For instance, it can choose whether the division 5/3 must be performed, or if it should remain in its actual state since it is an irreducible fraction. The different canceling possibilities are the following:

  • Numeric exponents expansion limit

It decides what the maximal exponent is before canceling the pow calculation. If set to 3 for instance, (x+y)^3 will be expanded as x^3 + 3x^2y + 3xy^2 + y^3, whereas (x+y)^4 will remain (x+y)^4