TO SUPPORT MY WORK, ORDER A COMMERCIAL LICENSE
THANK YOU!
The tutorial consists of more than 200 live examples from 50 sections. Each of the examples can be copied and run on your own environment. In addition, mXparser provides an extensive collection of over 500 built-in math functions, expressions and symbols. Familiarize yourself with the scope and the syntax. Live testing is the best way to learn. Good luck! 🙂
Tutorial Math Collection API spec Download
Below is the code for JAVA, the code for C# is almost identical. To copy the code, double-click inside the frame.
Case 1: Bitwise unary complement
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e1 = new Expression("@~ 2");
Expression e2 = new Expression("@~ b.10");
double v1 = e1.calculate();
double v2 = e2.calculate();
mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 );
mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));
[mXparser-v.5.2.1] Res 1: @~ 2 = -3.0
[mXparser-v.5.2.1] Res 2: @~ b.10 = -3.0, bits = -11
Case 2: Bitwise AND
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e1 = new Expression("13 @& 10");
Expression e2 = new Expression("b.1101 @& b.1010");
double v1 = e1.calculate();
double v2 = e2.calculate();
mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 );
mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));
[mXparser-v.5.2.1] Res 1: 13 @& 10 = 8.0
[mXparser-v.5.2.1] Res 2: b.1101 @& b.1010 = 8.0, bits = 1000
Case 3: Bitwise exclusive OR
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e1 = new Expression("13 @^ 10");
Expression e2 = new Expression("b.1101 @^ b.1010");
double v1 = e1.calculate();
double v2 = e2.calculate();
mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 );
mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));
[mXparser-v.5.2.1] Res 1: 13 @^ 10 = 7.0
[mXparser-v.5.2.1] Res 2: b.1101 @^ b.1010 = 7.0, bits = 111
Case 4: Bitwise inclusive OR
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e1 = new Expression("13 @| 10");
Expression e2 = new Expression("b.1101 @| b.1010");
double v1 = e1.calculate();
double v2 = e2.calculate();
mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 );
mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));
[mXparser-v.5.2.1] Res 1: 13 @| 10 = 15.0
[mXparser-v.5.2.1] Res 2: b.1101 @| b.1010 = 15.0, bits = 1111
Case 5: Signed left shift
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e1 = new Expression("13 @<< 2");
Expression e2 = new Expression("b.1101 @<< b.10");
double v1 = e1.calculate();
double v2 = e2.calculate();
mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 );
mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));
[mXparser-v.5.2.1] Res 1: 13 @<< 2 = 52.0
[mXparser-v.5.2.1] Res 2: b.1101 @<< b.10 = 52.0, bits = 110100
Case 6: Signed right shift
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e1 = new Expression("13 @>> 2");
Expression e2 = new Expression("b.1101 @>> b.10");
double v1 = e1.calculate();
double v2 = e2.calculate();
mXparser.consolePrintln("Res 1: " + e1.getExpressionString() + " = " + v1 );
mXparser.consolePrintln("Res 2: " + e2.getExpressionString() + " = " + v2 + ", bits = " + mXparser.convDecimal2OthBase(v2, 2));
[mXparser-v.5.2.1] Res 1: 13 @>> 2 = 3.0
[mXparser-v.5.2.1] Res 2: b.1101 @>> b.10 = 3.0, bits = 11
Nuget – Package Manager
Install-Package
MathParser.org-mXparser
-Version
5.2.1
dotnet add package
MathParser.org-mXparser
--version
5.2.1
<PackageReference Include=
"MathParser.org-mXparser"
Version=
"5.2.1"
/>
Maven – Dependency
<dependency>
<groupid>org.mariuszgromada.math
</groupid>
<artifactid>MathParser.org-mXparser
</artifactid>
<version>5.2.1
</version>
</dependency>
Maven – Gradle
implementation
'org.mariuszgromada.math:MathParser.org-mXparser:5.2.1'
Maven – Gradle (Kotlin)
implementation(
"org.mariuszgromada.math:MathParser.org-mXparser:5.2.1"
)
GitHub
git clone
https://github.com/mariuszgromada/MathParser.org-mXparser
OTHER DOWNLOAD OPTIONS
Download latest release – v.5.2.1 Orion: .NET bin onlyDownload latest release – v.5.2.1 Orion: JAVA bin onlyDownload latest release – v.5.2.1 Orion: bin + doc
NEWS FROM MATHPARSER.ORG
SOURCE CODE
Source code .zipSource code .tar.gz
View on GitHubMathSpace.pl