TO SUPPORT MY WORK, ORDER A COMMERCIAL LICENSE
THANK YOU!
The tutorial consists of more than 200 live examples from 50 sections given separately for JAVA, C# and C++. 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, C# (the code for C# is almost identical) and C++. To copy the code, double-click inside the frame.
mXparser provides extensive configuration options. The vast majority of settings can be understood by analyzing the method name – however, I encourage you to read the API documentation and tutorials.
1. Degrees / Radians Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfDegreesMode();
void mXparser.setDegreesMode();
boolean mXparser.checkIfRadiansMode();
void mXparser.setRadiansMode();
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfDegreesMode();
void mXparser::setDegreesMode();
bool mXparser::checkIfRadiansMode();
void mXparser::setRadiansMode();
2. Attempt To Fix Expression String Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfAttemptToFixExpStrMode();
void mXparser.enableAttemptToFixExpStrMode();
void mXparser.disableAttemptToFixExpStrMode();
/* Local Settings - Reach: Given Expression e */
boolean e.checkIfAttemptToFixExpStrMode();
void e.enableAttemptToFixExpStrMode();
void e.disableAttemptToFixExpStrMode();
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfAttemptToFixExpStrMode();
void mXparser::enableAttemptToFixExpStrMode();
void mXparser::disableAttemptToFixExpStrMode();
/* Local Settings - Reach: Given Expression e */
bool e->checkIfAttemptToFixExpStrMode();
void e->enableAttemptToFixExpStrMode();
void e->disableAttemptToFixExpStrMode();
3. Primes Cache
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.initPrimesCache();
void mXparser.initPrimesCache(int mximumNumberInCache);
void mXparser.initPrimesCache(const PrimesCachePtr &primesCache);
boolean mXparser.isInitPrimesCacheSuccessful();
int mXparser.getMaxNumInPrimesCache();
void mXparser.setNoPrimesCache();
C++ code
/* Global Settings - Reach: All Defined Elements */
void mXparser::initPrimesCache();
void mXparser::initPrimesCache(int mximumNumberInCache);
void mXparser::initPrimesCache(const PrimesCachePtr &primesCache);
bool mXparser::isInitPrimesCacheSuccessful();
int mXparser::getMaxNumInPrimesCache();
void mXparser::setNoPrimesCache();
4. Epsilon Comparison / Exact Comparison Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfEpsilonMode();
void mXparser.setEpsilonComparison();
double mXparser.getEpsilon();
void mXparser.setEpsilon(double epsilon);
void mXparser.setDefaultEpsilon();
boolean mXparser.checkIfExactMode();
void mXparser.setExactComparison();
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfEpsilonMode();
void mXparser::setEpsilonComparison();
double mXparser::getEpsilon();
void mXparser::setEpsilon(double epsilon);
void mXparser::setDefaultEpsilon();
bool mXparser::checkIfExactMode();
void mXparser::setExactComparison();
5. Canonical Rounding Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfCanonicalRounding();
void mXparser.enableCanonicalRounding();
void mXparser.disableCanonicalRounding();
void mXparser.setCanonicalRounding(bool canonicalRoundingState);
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfCanonicalRounding();
void mXparser::enableCanonicalRounding();
void mXparser::disableCanonicalRounding();
void mXparser::setCanonicalRounding(bool canonicalRoundingState);
6. ULP (Unit In The Last Place) Rounding Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfUlpRounding();
void mXparser.enableUlpRounding();
void mXparser.disableUlpRounding();
void mXparser.setUlpRounding(boolean ulpRoundingState);
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfUlpRounding();
void mXparser::enableUlpRounding();
void mXparser::disableUlpRounding();
void mXparser::setUlpRounding(bool ulpRoundingState);
7. Almost Integers Rounding Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfAlmostIntRounding();
void mXparser.enableAlmostIntRounding();
void mXparser.disableAlmostIntRounding();
void mXparser.setAlmostIntRounding(boolean almostIntRoundingState);
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfAlmostIntRounding();
void mXparser::enableAlmostIntRounding();
void mXparser::disableAlmostIntRounding();
void mXparser::setAlmostIntRounding(bool almostIntRoundingState);
8. Implied Multiplication Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfImpliedMultiplicationMode();
void mXparser.enableImpliedMultiplicationMode();
void mXparser.disableImpliedMultiplicationMode();
/* Local Settings - Reach: Given Expression e */
boolean e.checkIfImpliedMultiplicationMode();
void e.enableImpliedMultiplicationMode();
void e.disableImpliedMultiplicationMode();
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfImpliedMultiplicationMode();
void mXparser::enableImpliedMultiplicationMode();
void mXparser::disableImpliedMultiplicationMode();
/* Local Settings - Reach: Given Expression e */
bool e->checkIfImpliedMultiplicationMode();
void e->enableImpliedMultiplicationMode();
void e->disableImpliedMultiplicationMode();
9. Unicode Builtin Key Words Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfUnicodeBuiltinKeyWordsMode();
void mXparser.enableUnicodeBuiltinKeyWordsMode();
void mXparser.disableUnicodeBuiltinKeyWordsMode();
/* Local Settings - Reach: Given Expression e */
boolean e.checkIfUnicodeBuiltinKeyWordsMode();
void e.enableUnicodeBuiltinKeyWordsMode();
void e.disableUnicodeBuiltinKeyWordsMode();
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfUnicodeBuiltinKeyWordsMode();
void mXparser::enableUnicodeBuiltinKeyWordsMode();
void mXparser::disableUnicodeBuiltinKeyWordsMode();
/* Local Settings - Reach: Given Expression e */
bool e->checkIfUnicodeBuiltinKeyWordsMode();
void e->enableUnicodeBuiltinKeyWordsMode();
void e->disableUnicodeBuiltinKeyWordsMode();
10. Verbose / Silent Mode
Java/C# code
/* Local Settings - Reach: Given Expression e */
void e.setVerboseMode();
void e.setSilentMode();
C++ code
/* Local Settings - Reach: Given Expression e */
void e->setVerboseMode();
void e->setSilentMode();
11. Override Builtin Tokens Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
boolean mXparser.checkIfsetToOverrideBuiltinTokens();
void mXparser.setToOverrideBuiltinTokens();
void mXparser.setNotToOverrideBuiltinTokens();
C++ code
/* Global Settings - Reach: All Defined Elements */
bool mXparser::checkIfsetToOverrideBuiltinTokens();
void mXparser::setToOverrideBuiltinTokens();
void mXparser::setNotToOverrideBuiltinTokens();
12. Modify Builtin Tokens Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.modifyBuiltinToken(String currentToken, String newToken);
void mXparser.modifyBuiltinToken(String currentToken, String newToken, String newTokenDescription);
String[][] mXparser.getBuiltinTokensToModify();
void mXparser.unmodifyBuiltinTokens(String... currentOrNewTokens);
void mXparser.unmodifyAllBuiltinTokens();
C++ code
/* Global Settings - Reach: All Defined Elements */
void mXparser::modifyBuiltinToken(const std::string ¤tToken, const std::string &newToken);
void mXparser::modifyBuiltinToken(const std::string ¤tToken, const std::string &newToken, const std::string &newTokenDescription);
ArrayPtr<StringPtr> mXparser::getBuiltinTokensToModify();
template<typename... Strings> void mXparser::unmodifyBuiltinTokens(Strings &&... currentOrNewTokens)
void mXparser::unmodifyAllBuiltinTokens();
13. Remove Builtin Tokens Mode
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.removeBuiltinTokens(String... tokens);
String[] mXparser.getBuiltinTokensToRemove();
void mXparser.unremoveBuiltinTokens(String... tokens);
void mXparser.unremoveAllBuiltinTokens();
C++ code
/* Global Settings - Reach: All Defined Elements */
template<typename... Strings> void removeBuiltinTokens(Strings &&... tokens)
ArrayPtr<StringPtr> mXparser::getBuiltinTokensToRemove();
template<typename... Strings> void mXparser::unremoveBuiltinTokens(Strings &&... tokens)
void mXparser::unremoveAllBuiltinTokens();
14. Current Calculation Cancellation
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.cancelCurrentCalculation();
boolean mXparser.isCurrentCalculationCancelled();
void mXparser.resetCancelCurrentCalculationFlag();
C++ code
/* Global Settings - Reach: All Defined Elements */
void mXparser::cancelCurrentCalculation();
bool mXparser::isCurrentCalculationCancelled();
void mXparser::resetCancelCurrentCalculationFlag();
15. Setting Console Prefix
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.setConsolePrefix(String consolePrefix);
void mXparser.setDefaultConsolePrefix();
C++ code
void mXparser::setConsolePrefix(const std::string &consolePrefix);
void mXparser::setDefaultConsolePrefix();
16. Reaching Console Output String
Java/C# code
/* Global Settings - Reach: All Defined Elements */
String mXparser.getConsoleOutput();
void mXparser.resetConsoleOutput();
void mXparser.setConsoleOutputPrefix(String consoleOutputPrefix);
void mXparser.setDefaultConsoleOutputPrefix();
C++ code
/* Global Settings - Reach: All Defined Elements */
StringPtr mXparser::getConsoleOutput();
void mXparser::resetConsoleOutput();
void mXparser::setConsoleOutputPrefix(const std::string &consoleOutputPrefix);
void mXparser::setDefaultConsoleOutputPrefix();
17. Maximum Allowed Recursion Depth
Java/C# code
/* Global Settings - Reach: All Defined Elements */
int mXparser.getMaxAllowedRecursionDepth();
void mXparser.setMaxAllowedRecursionDepth(int maxAllowedRecursionDepth);
C++ code
/* Global Settings - Reach: All Defined Elements */
int mXparser::getMaxAllowedRecursionDepth();
void mXparser::setMaxAllowedRecursionDepth(int maxAllowedRecursionDepth);
18. Double to Fraction Conversion
Java/C# code
/* Global Settings - Reach: All Defined Elements */
long mXparser.getToFractionInitSearchSize();
void mXparser.setToFractionInitSearchSize(long n);
double[] mXparser.toFraction(double value);
String mXparser.toFractionString(double value);
double[] mXparser.toMixedFraction(double value);
String mXparser.toMixedFractionString(double value);
C++ code
/* Global Settings - Reach: All Defined Elements */
Long mXparser::getToFractionInitSearchSize();
void mXparser::setToFractionInitSearchSize(Long n);
ArrayPtr<double> mXparser::toFraction(double value);
String mXparser::toFractionString(double value);
ArrayPtr<double> mXparser::toMixedFraction(double value);
StringPtr mXparser::toMixedFractionString(double value);
19. Random Generator Selection
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.setRandomGenerator(Random randomGenerator);
C++ code
/* Global Settings - Reach: All Defined Elements */
void mXparser::setRandomGenerator(const RandomPtr &randomGenerator);
20. Maximum Threads Number
Java/C# code
/* Global Settings - Reach: All Defined Elements */
int mXparser.getThreadsNumber();
void mXparser.setThreadsNumber(int threadsNumber);
void mXparser.setDefaultThreadsNumber();
C++ code
/* Global Settings - Reach: All Defined Elements */
int mXparser::getThreadsNumber();
void mXparser::setThreadsNumber(int threadsNumber);
void mXparser::setDefaultThreadsNumber();
21. Default Settings
Java/C# code
/* Global Settings - Reach: All Defined Elements */
void mXparser.setDefaultOptions();
C++ code
/* Global Settings - Reach: All Defined Elements */
void mXparser::setDefaultOptions();
Nuget – Package Manager
Install-Package
MathParser.org-mXparser
-Version
6.0.0
dotnet add package
MathParser.org-mXparser
--version
6.0.0
<PackageReference Include=
"MathParser.org-mXparser"
Version=
"6.0.0"
/>
Maven – Dependency
<dependency>
<groupid>org.mariuszgromada.math
</groupid>
<artifactid>MathParser.org-mXparser
</artifactid>
<version>6.0.0
</version>
</dependency>
Maven – Gradle
implementation
'org.mariuszgromada.math:MathParser.org-mXparser:6.0.0'
CMake – Dependency / FetchContent
include(FetchContent)
FetchContent_Declare(MathParserOrgMxParser
GIT_REPOSITORY https://github.com/mariuszgromada/MathParser.org-mXparser.git
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.0.0 Picon: .NET bin onlyDownload latest release – v.6.0.0 Picon: JAVA bin onlyDownload latest release – v.6.0.0 Picon: bin + doc
NEWS FROM MATHPARSER.ORG
SOURCE CODE
Source code .zipSource code .tar.gz
View on GitHubMathSpace.pl