mXparser - Math Expression Evaluator / Parser - Library Description

MathParser.org - mXparser - logo

mXparser is a super easy, rich, fast and highly flexible math expression parser library (parser and evaluator of mathematical expressions / formulas provided as plain text / string). Software delivers easy to use API for JAVA, Android and C# .NET/MONO (Common Language Specification compliant: F#, Visual Basic, C++/CLI). Expression parser comes with extensive documentation, easy to follow tutorial, "Hello World!" projects for 5 different languages explained with many screenshots, and finally - last, but not least - performance test summary. Formula evaluator is distributed under "Simplified BSD license", which means software is completely free 🙂

!!! mXparser - v.3.0.0 released on 2016-05-18: Major update: Random numbers, Probability distributions & Random variables, Double precision rounding, ULP rounding, epsilon comparison, New special functions !!!

 


Please check it out – my new project - Janet Sudoku - a powerful and flexible Sudoku Generator and Sudoku Solver library for Java, Android, .NET, MONO.

Janet Sudoku


 

Few examples of string equivalent to the math formula notation:

1+2"1+2"

1+\frac{2}{3} + (4\cdot 5-10)"1+2/3+(4*5-10)"

2x+\sin(y)"2*x+sin(y)"

\int_{-1}^{1}\sqrt{1-x^2} =  "int( sqrt(1-x^2), x, -1, 1)"

\sum_{n=1}^{100}\frac{1}{n^2} = "sum(n, 1, 100, 1/n^2)"

n\choose k = "C(n,k)"

fib_n=\begin{cases}fib_{n-1}+fib_{n-2}\\fib_1=1\\fib_0=0\end{cases}"fib(n) = iff( n>1, fib(n-1)+fib(n-2); n=1, 1; n=0, 0)"

Math expressions parser - supported frameworks:

  • JAVA: 1.5, 1.6, 1.7, 1.8 (separate binaries available if necessary)
  • Android: tested with mxparser_jdk1.7.jar
  • .NET/MONO: 2.0, 3.0, 3.5, 4.0, 4.5, 4.6 (separate binaries available if necessary)

Download latest release – v.3.0.0: bin + doc + src (.zip 8.05 MB)

Download latest release – v.3.0.0: bin only (.zip 2.06 MB) – separate binaries for java: 1.5, 1.6, 1.7, 1.8; .NET: 2.0, 3.0, 3.5, 4.0, 4.5, 4.6;

Latest downloads

Source code .zipSource code .tar.gz View on GitHubMathSpace.pl

Math Expressions Parser Features:

  • rich built-in library of operators, constants, math functions;
  • user defined: arguments, functions, recursive functions and general recursion (direct / indirect);
  • grammar and internal syntax checking;

Math Expressions Parser - features list with examples

Functionality Example Support level
Simple calculator i.e.: 2+3, n! Full support
Binary relations i.e.: a*b Full support
Boolean operators i.e.: a&b Full support
Built-in constants i.e.: 2+pi Full support
User defined constants i.e.: 3tau, where tau = 2pi Full support
Built-in unary functions i.e.: sin(2) Extensive collection
Built-in binary functions i.e.: log(a,b) Main functions
Built-in n-arguments functions i.e.: gcd(a,b,c,d,…) Special functions
Evaluating conditions i.e.: if(a=true, then b, else c) Full support
Cases functions i.e.: iff(case1, then a1, case2, then a2, ...) Full support
User defined arguments i.e.: x = 5, cos(x) Full support
User defined dependent arguments i.e.: x=2, y=x^2 Full support
Iterated operators - SIGMA summation i.e.: sum( 1, n, f(…,i) {step} ) Full support
Iterated operators - PI product i.e.: prod( 1, n, f(…,i) {step} ) Full support
Derivatives i.e.: der( sin(x), x) ) Full support
Integrals i.e.: 2*int( sqrt(1-x^2), x, -1, 1) Full support
User defined functions i.e.: f(x,y) = sin(x+y) Full support
Fast (limited) recursion i.e.: fib(n) = fib(n-1) + fib(n-2), addBaseCase(0, 0), addBaseCase(1, 1) Full support
Recursion, any kind i.e.: Cnk(n,k) = if( k>0, if( k<n, Cnk(n-1,k-1)+Cnk(n-1,k), 1), 1) Full support
Syntax checking checkSyntax() Full support
Getting computing time getComputingTime() Full support
Verbose mode setVerboseMode() Full support

mXparser - deliverables

Language / Framework Documentation Library Source code
JAVA Yes Yes Yes
Android Yes Yes Yes
C# .NET Yes Yes Yes
Visual Basic .NET(CLS) Yes Yes
C++/CLI .NET(CLS) Yes Yes
F# .NET(CLS) Yes Yes
Other .NET languages Yes Yes, not tested
MONO Yes Yes, dll tested C# code

Math Expression Parser - Main functionalities:

Math ExpressionParser - High flexibility functionalities

Math Expression Parser - Project documentation

- mXparser - API documentation

- mXparser - a very easy Tutorial

- MathSpace.pl - site about math with mXparser examples (polish)

mXparser - GitHub

mXparser - SourceForge

Enjoy 🙂

Best regards,

Mariusz Gromada