MXparser


mXparser is an open-source mathematical expressions parser/evaluator providing abilities to calculate various expressions at a run time. Expressions definitions are given as plain text, then verified in terms of grammar / syntax, finally calculated. Library source code is maintained separately for Java and C#, providing the same API for Java/JVM, Android, .NET and Mono.

Main features / usage examples

mXparser delivers functionalities such as: basic calculations, implied multiplication, built-in constants and functions, numerical calculus operations, iterated operators, user defined constants, user defined functions, user defined recursion, Unicode mathematical symbols support.

Basic operators">Operator (mathematics)">operatorshttp://mathparser.org/mxparser-math-collection/ mXparser - Math Collection

mXparser supports basic operators, such as: addition '+', subtraction '-', multiplication '*', division '/', factorial '!', power '^', modulo '#'.

Expression e = new Expression;
double v = e.calculate;

Implied multiplication


Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression2sin;
double v = e.calculate;

[Binary relation]s

It is possible to combine typical expressions with binary relations, as each relation evaluation results in either '1' for true outcome, or '0' for false.

Expression e = new Expression;
double v = e.calculate;

Boolean logic">Logical connective">Boolean logic

Boolean logic also operates assuming equivalence of '1 as true' and '0 as false'. Supported Boolean operators include: AND conjunction, OR disjunction, NAND Sheffer stroke, NOR, XOR Exclusive OR, IMP Implication, CIMP Converse implication, NIMP Material nonimplication, CNIMP Converse nonimplication, EQV Logical biconditional, Negation.

Expression e = new Expression;
double v = e.calculate;

Built-in mathematical functions

Supported common mathematical functions, including: trigonometric functions, inverse trigonometric functions, logarithm functions, exponential function, hyperbolic functions, Inverse hyperbolic functions, Bell numbers, Lucas numbers, Stirling numbers, prime-counting function, exponential integral function, logarithmic integral function, offset logarithmic integral, binomial coefficient and others.

Expression e = new Expression+ln+log;
double v = e.calculate;


Expression e = new Expression+gcd;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;

Built-in math constants

Built-in mathematical constants, with high precision.

Expression e = new Expression+ln;
double v = e.calculate;

Iterated operators

Iterated summation and product operators.

Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;

Numerical differentiation">Derivative">differentiation and integration">Integral">integration

mXparser delivers implementation of the following calculus operations: differentiation and integration.

Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;

[Prime number]s support


Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;

Unicode [mathematical symbols support">Mathematical operators and symbols in Unicode">Unicode [mathematical symbols support]


Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;


Expression e = new Expression;
double v = e.calculate;

Elements defined by user

Library provides API for creation of user-defined objects, such as: constants, arguments, functions.

User-defined constantshttp://mathparser.org/mxparser-tutorial/ mXparser - Tutorial


Constant t = new Constant;
Expression e = new Expression;
double v = e.calculate;

User-defined arguments


Argument x = new Argument;
Argument y = new Argument;
Expression e = new Expression;
double v = e.calculate;

User-defined functions


Function f = new Function = sin+cos;
Expression e = new Expression;
double v = e.calculate;

User-defined variadic functions


Function f = new Function;
Expression e = new Expression;
double v = e.calculate;

User-defined [recursion]


Function fib = new Function = iff+fib )");
Expression e = new Expression;
double v = e.calculate;

Requirements

Documentation

mXparser - source code

Source code is maintained and shared on GitHub.