/ev3

C++ library to compute symbolic derivatives

Primary LanguageC++GNU Lesser General Public License v3.0LGPL-3.0

https://github.com/openturns/ev3/actions/workflows/build.yml/badge.svg?branch=master

Ev3

Ev3 is a C++ library for symbolic computation written by Leo Liberti.

It is an alternative to libmatheval.

It was originally published by Leo Liberti under the CPL license.

The Computational Infrastructure for Operations Research project (COIN-OR) uses a modified version in ROSE.

Leo Liberti has since republished the original Ev3 under the LGPL license (see COPYING and COPYING.LESSER).

This repository stores the version used in the OpenTURNS software also published under the LGPL. It contains bug fixes made between 2015 and 2019.

Here is a snippet which defines two variables and differentiates an expression:

#include <iostream>
#include "expression.h"
#include "parser.h"

int main()
{
  Ev3::ExpressionParser parser;
  parser.SetVariableID("x1", 0);
  parser.SetVariableID("x2", 1);
  int nerr = 0;
  Ev3::Expression expr = parser.Parse("x1*sin(x2)", nerr);
  Ev3::Expression derivative = Ev3::Diff(expr, 1);
  std::cout << derivative->ToString() << std::endl;
}