Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.14 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.14 KB

Build Status

Ev3

Ev3 is a C++ library to compute symbolic derivatives written by [Leo Liberti] (http://www.lix.polytechnique.fr/~liberti/academic.html).

It is an alternative to libmatheval but under the more permissive CPL license.

The library was originaly available here, and used also [here] (https://projects.coin-or.org/ROSE/browser/rose/Ev3) with some modifications. This is the debugged version used in the OpenTURNS software.

Here a snippet which define two variables and derivates 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;
}