# Index

## Introduction

libqalculate is math libary for expression evaluation with units, variables and functions support and CAS functionality.

The main parts of the library is the almighty Calculator class, the MathStructure class for mathematical expressions and classes for objects in an epxression, mostly of the class Numbers and sub classes of ExpressionItem.

A simple application using libqalculate need only create a calculator object, perhaps load definitions (functions, variables, units, etc.) and use the calculate function as follows:

     new Calculator();
     CALCULATOR->loadGlobalDefinitions();
     CALCULATOR->loadLocalDefinitions();
     EvaluationOptions eo;
     MathStructure result = CALCULATOR->calculate("1 + 1", eo);

More complex usage mainly involves manipulating objects of the MathStructure class directly.

To display the resulting expression you will normally use MathStructure::format() followed by MathStructure::print() as follows:

     PrintOptions po;
     result.format(po);
     string result_str = result.print(po);

Central to the flexiblity of libqalculate is the many options passed to evaluating and display functions with EvaluationOptions and PrintOptions.

## Using the library

libqalculate uses pkg-config.

For a simple program use pkg-config on the command line:

     c++ `pkg-config --cflags --libs libqalculate` hello.c -o hello

If the program uses autoconf, put the following in configure.in:

     PKG_CHECK_MODULES(QALCULATE, [
            libqalculate >= 0.9.7
            ])
     AC_SUBST(QALCULATE_CFLAGS)
     AC_SUBST(QALCULATE_LIBS)