mXparser – Math Expression Evaluator / Parser – Library Description

MathParser.org-mXparser has been downloaded more than 4.000.000 times!

TO SUPPORT MY WORK, ORDER A COMMERCIAL LICENSE
THANK YOU!

mXparser v.6.1 (Sagitara)

New awesome features:
1. mXparser supports C++ (new in 6.1)
2. mXparser in Chinese (new in 6.1)
3. mXparser in French (new in 6.0)
4. mXparser in German (new in 6.0)
5. mXparser in Italian (new in 6.0)
6. mXparser in Polish (new in 6.0)
7. mXparser in Portuguese (new in 6.0)
8. mXparser in Spanish (new in 6.0)
9. Implied Multiplication (new in 5.0)
10. Unicode Math Symbols (new in 5.0)
11. Flexible Registration of Calculation Steps (new in 5.1)
12. Serialization / Deserialization support (new in 5.1)
13. Cloning for thread safe operations (new in 5.2)
14. Help content in the JSON format (new in 5.2)
15. Help content in the Markdown format (new in 5.2)
16. Help content in the HTML format (new in 5.2)
17. Help content in the CSV format (new in 5.2)
18. Help content in the TXT format (improved in 5.2)
19. Accessing help programmatically (improved in 5.2)
20. Configuration of your own translation (new in 5.2)
21. Standardization of built-in elements descriptions (new in 5.2)

Tutorial Math Collection API spec Download

Package installation

Nuget – Package Manager (C#, F#, Visual Basic, …)

Install-Package MathParser.org-mXparser -Version 6.1.0

Nuget – .NET CLI

dotnet add package MathParser.org-mXparser --version 6.1.0

Nuget – Package Reference

<PackageReference Include="MathParser.org-mXparser" Version="6.1.0"/>

Maven – Dependency (Java, Kotlin, Scala, Groovy, …)

<dependency>
<groupid>
org.mariuszgromada.math</groupid>
<artifactid>
MathParser.org-mXparser</artifactid>
<version>
6.1.0</version>
</dependency>

Maven – Gradle

implementation 'org.mariuszgromada.math:MathParser.org-mXparser:6.1.0'

CMake – Dependency / FetchContent (C++, MSVC, LLVM/Clang, GNU/GCC, MinGW, MSYS2, WSL, Windows, Linux, Unix, MacOS)

include(FetchContent)
FetchContent_Declare(
MathParserOrgMxParser
GIT_REPOSITORY
https://github.com/mariuszgromada/MathParser.org-mXparser.git
GIT_TAG
v.6.1.0
SOURCE_SUBDIR CURRENT/cpp/lib
)
FetchContent_MakeAvailable(
MathParserOrgMxParser)
target_link_libraries(YourExecutable
MathParserOrgMxParser)

GitHub

git clone https://github.com/mariuszgromada/MathParser.org-mXparser

mXparser is a super easy, rich, fast, and highly flexible math engine library that includes expression parser and expression evaluator (parser and evaluator of mathematical expressions / formulas provided as plain text / string). The software provides easy-to-use APIs for JAVA, Kotlin, Android, C++, C# .NET / .NET Core / MONO (including compatibility with CLS / Common Language Specification: F#, Visual Basic, C++/CLI). The expression parser comes with extensive documentation, an easy-to-follow tutorial, a step-by-step “Hello World” projects and a summary of performance tests. The formula parser / evaluator is distributed under the DUAL LICENSE model, that is designed to meet the needs of both Non-Commercial Use as well as Commercial Use.

mXparser - Supported frameworks

mXparser works at runtime, which means it can fully execute end user commands while the entire application is running

JAVA Demo – showing how easy it is to define a user function along with its use in an expression

mXparser - deomo - JAVA

C# Demo – showing how easy it is to define a user function along with its use in an expression

mXparser - deomo - C#

Few examples of string equivalent to the math formula notation:

MATH EXPRESSIONMXPARSER EXPRESSION STRING
$1+2$“1+2”
$1+\frac{2}{3} + (4\cdot 5-10)$1+2/3 +(4*5-10) – classic or
1+2_3+(4*5-10) – with fractions or
1+2_3+(4×5-10) – with fractions and Unicode math or
1+2÷3+(4⨉5-10) – with fractions and Unicode math or
1+2÷3+(4∙5-10) – with fractions and Unicode math
$2x+\sin(y)$2*x+sin(y) – classic or
2x+sin(y) – with implied multiplication
$\int_{-1}^{1}\sqrt{1-x^2}$int( sqrt(1-x^2), x, -1, 1) – classic or
∫( sqrt(1-x^2), x, -1, 1) – with Unicode math or
∫( √(1-x^2), x, -1, 1) – with even more Unicode math
$\sum_{n=1}^{100}\frac{1}{n^2}$sum(n, 1, 100, 1/n^2) – classic or
∑(n, 1, 100, 1/n^2) – with Unicode math
Σ(n, 1, 100, 1÷n^2) – with Unicode math (another symbols)
$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)
$2\frac{3}{4} + 3\frac{2}{3}+\frac{1}{2} $2_3_4+3_2_3+1_2 – with fractions or
2+3/4+3+2/3+1/2 – classic
$f(x,y)=x^2+\sin x+\cos y$f(x,y) = x^2+sin(x)+cos(y)
$\sqrt{\pi}$sqrt(pi) – classic or
√ℼ – with Unicode math
Just a few examples of math expressions with corresponding mXparser syntax

Math parser – main features summary

FEATURECOMMENT / EXAMPLES
Broad list of supported frameworksJAVA, .NET – many versions
Rich Match Collection500+ built-in keywords including: operators, constants, math functions
Implied Multiplication2x+3sin(x)
2(3+4)2(4+3)
Unicode Symbolsα, β, …
∑, ∛, …
⊽, ⊼, ⇔, ..
×, ÷, …
User Defined Argumentsx = 2
y = 2x
User Defined Functionsf(x) = 2x
f(x,y) = sin(x)+cos(y)
User Defined Variadic Functionsf(…) = sum(i, 1, [npar], par(i) )
User Defined Constantsa = 2
User Defined Random VariablesRandom value on each call
User Defined RecursionFully supported
Evaluating conditionsif(a=true, then b, else c)
Cases functionsiff(case1, then a1, case2, then a2, …)
Iterated operatorssum( 1, n, f(…,i) {step} )
prod( 1, n, f(…,i) {step} )
Derivativesder( sin(x), x) )
Integrals2*int( sqrt(1-x^2), x, -1, 1)
Syntax checkingCheck syntax
Check Lex syntax
Calculation Steps RegisterFlexible registration of all the calculation steps.
List of main features

Rich Match Collection: list of 500+ built-in keywords

BUILT-IN KEYWORD CATEGORY# OF BUILT-IN KEYWORDS
Operator16
Boolean Operator40
Bitwise Operator6
Binary Relation14
Math Constant
Physical Constant
Astronomical Constant
93
Unit105
Iterated Operator12
Calculus Operator15
Unary Function105
Binary Function36
3-args Function15
Variadic Function23
Random Variable32
Parser Symbol5
Number Literals6
TOTAL500+
Rich match collection

Supported frameworks

JAVA1.8+: separate binaries for each version
Androidfully tested with JAVA binaries
.NET5.0+: separate binaries for each version
.NET Framework / MONO3.5+: separate binaries for each version
.NET Core1.0+: separate binaries for each version
.NET Standard1.0+: separate binaries for each version
.NET PCLportable45, win8, wpa81
Xamarin.Andoird1.0, 6.0
Xamarin.iOS1.0
Broad list of supported frameworks
Nuget – Package Manager (C#, F#, Visual Basic, …)

Install-Package MathParser.org-mXparser -Version 6.1.0

Nuget – .NET CLI

dotnet add package MathParser.org-mXparser --version 6.1.0

Nuget – Package Reference

<PackageReference Include="MathParser.org-mXparser" Version="6.1.0"/>

Maven – Dependency (Java, Kotlin, Scala, Groovy, …)

<dependency>
<groupid>
org.mariuszgromada.math</groupid>
<artifactid>
MathParser.org-mXparser</artifactid>
<version>
6.1.0</version>
</dependency>

Maven – Gradle

implementation 'org.mariuszgromada.math:MathParser.org-mXparser:6.1.0'

CMake – Dependency / FetchContent (C++, MSVC, LLVM/Clang, GNU/GCC, MinGW, MSYS2, WSL, Windows, Linux, Unix, MacOS)

include(FetchContent)
FetchContent_Declare(
MathParserOrgMxParser
GIT_REPOSITORY
https://github.com/mariuszgromada/MathParser.org-mXparser.git
GIT_TAG
v.6.1.0
SOURCE_SUBDIR CURRENT/cpp/lib
)
FetchContent_MakeAvailable(
MathParserOrgMxParser)
target_link_libraries(YourExecutable
MathParserOrgMxParser)

GitHub

git clone https://github.com/mariuszgromada/MathParser.org-mXparser

OTHER DOWNLOAD OPTIONS

Download latest release – v.6.1.0 Sagitara: .NET bin onlyDownload latest release – v.6.1.0 Sagitara: JAVA bin onlyDownload latest release – v.6.1.0 Sagitara: bin + doc

NEWS FROM MATHPARSER.ORG
SOURCE CODE

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

My other creative spaces