Accessing help programmatically

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.

List of available options

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...

// Only built-in elements
List<KeyWord> mXparser.getKeyWords();
List<KeyWord> mXparser.getKeyWords(String query);
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...

// Only built-in elements
ListPtr<KeyWordPtr> mXparser::getKeyWords();
ListPtr<KeyWord>Ptr mXparser::getKeyWords(const std::string&);
Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...

// Also with user-defined elements,
// when e is an instance of Expression
List<KeyWord> e.getKeyWords();
List<KeyWord> e.getKeyWords(String query);
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...

// Also with user-defined elements,
// when e is an instance of Expression
ListPtr<KeyWordPtr> e->getKeyWords();
ListPtr<KeyWord>Ptr e->getKeyWords(const std::string query);
For a basic in-line search, simply provide a word (e.g.: "sine") in the query parameter.
Advanced search is also possible, please use one of the tags below when formatting the query parameter:
  • "key=" – keyword (e.g.: "key=sin")
  • "desc=" – description (e.g.: "desc=trigonometric"),
  • "syn=" – syntax (e.g.: "syn=sin")
  • "type=" – type (e.g.: "type=unit")
  • "since=" – since (e.g.: "since=4.1")
  • "typeid=" – please refer to parser tokens (e.g.: "typeid=3")
  • "keyid=" – please refer to parser tokens (e.g.: "keyid=1004").

Only one tag can be used per search.

Case 1: Getting list of all keywords

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
List<KeyWord> helpAsKeywords = mXparser.getKeyWords();

mXparser.consolePrintln("Number of keywords = " + helpAsKeywords.size());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ListPtr<KeyWordPtr> helpAsKeywords = mXparser::getKeyWords();

mXparser_consolePrintln("Number of keywords = " + helpAsKeywords->size());
Code result
[mXparser-v.5.2.0] Number of keywords = 522

Case 2: Getting list of keywords under advanced search condition

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
List<KeyWord> helpAsKeywords = mXparser.getKeyWords("type=Bitwise operator");

mXparser.consolePrintln("Number of keywords = " + helpAsKeywords.size());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ListPtr<KeyWordPtr> helpAsKeywords = mXparser::getKeyWords("type=Bitwise operator");

mXparser_consolePrintln("Number of keywords = " + helpAsKeywords->size());
Code result
[mXparser-v.5.2.0] Number of keywords = 6

Case 3: Printing list of keywords

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
List<KeyWord> helpAsKeywords = mXparser.getKeyWords("type=Bitwise operator");

mXparser.consolePrintln("Number of keywords = " + helpAsKeywords.size());

StringResources stringResources = StringModel.getStringResources();
for (KeyWord kw : helpAsKeywords) {
	mXparser.consolePrintln("--------------------");
	mXparser.consolePrintln(stringResources.KEYWORD + " = " + kw.wordString);
	mXparser.consolePrintln(stringResources.DESCRIPTION + " = " + kw.description);
	mXparser.consolePrintln(stringResources.SYNTAX + " = " + kw.syntax);
	mXparser.consolePrintln(stringResources.SINCE + " = " + kw.since);
	mXparser.consolePrintln(stringResources.TYPE + " = " + Token.getTokenTypeDescription(kw.wordTypeId));
	mXparser.consolePrintln("Type id = " + kw.wordTypeId);
	mXparser.consolePrintln("id = " + kw.wordId);
}
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ListPtr<KeyWordPtr> helpAsKeywords = mXparser::getKeyWords("type=Bitwise operator");

mXparser_consolePrintln("Number of keywords = " + helpAsKeywords->size());

StringResourcesPtr stringResources = StringModel::getStringResources();
for (const KeyWordPtr &kw : *helpAsKeywords) {
    mXparser_consolePrintln("--------------------");
    mXparser_consolePrintln(stringResources->KEYWORD + " = " + kw->wordString);
    mXparser_consolePrintln(stringResources->DESCRIPTION + " = " + kw->description);
    mXparser_consolePrintln(stringResources->SYNTAX + " = " + kw->syntax);
    mXparser_consolePrintln(stringResources->SINCE + " = " + kw->since);
    mXparser_consolePrintln(stringResources->TYPE + " = " + Token::getTokenTypeDescription(kw->wordTypeId));
    mXparser_consolePrintln("Type id = " + kw->wordTypeId);
    mXparser_consolePrintln("id = " + kw->wordId);
}
Code result
[mXparser-v.5.2.0] Number of keywords = 6
[mXparser-v.5.2.0] --------------------
[mXparser-v.5.2.0] Keyword = @~
[mXparser-v.5.2.0] Description = Bitwise unary complement - Bitwise operator
[mXparser-v.5.2.0] Syntax = @~a
[mXparser-v.5.2.0] Since = 4.0
[mXparser-v.5.2.0] Type = Bitwise operator
[mXparser-v.5.2.0] Type id = 11
[mXparser-v.5.2.0] id = 1
[mXparser-v.5.2.0] --------------------
[mXparser-v.5.2.0] Keyword = @&
[mXparser-v.5.2.0] Description = Bitwise and AND - Bitwise operator
[mXparser-v.5.2.0] Syntax = a @& b
[mXparser-v.5.2.0] Since = 4.0
[mXparser-v.5.2.0] Type = Bitwise operator
[mXparser-v.5.2.0] Type id = 11
[mXparser-v.5.2.0] id = 2
[mXparser-v.5.2.0] --------------------
[mXparser-v.5.2.0] Keyword = @^
[mXparser-v.5.2.0] Description = Bitwise exclusive or XOR - Bitwise operator
[mXparser-v.5.2.0] Syntax = a @^ b
[mXparser-v.5.2.0] Since = 4.0
[mXparser-v.5.2.0] Type = Bitwise operator
[mXparser-v.5.2.0] Type id = 11
[mXparser-v.5.2.0] id = 3
[mXparser-v.5.2.0] --------------------
[mXparser-v.5.2.0] Keyword = @|
[mXparser-v.5.2.0] Description = Bitwise inclusive or OR - Bitwise operator
[mXparser-v.5.2.0] Syntax = a @| b
[mXparser-v.5.2.0] Since = 4.0
[mXparser-v.5.2.0] Type = Bitwise operator
[mXparser-v.5.2.0] Type id = 11
[mXparser-v.5.2.0] id = 4
[mXparser-v.5.2.0] --------------------
[mXparser-v.5.2.0] Keyword = @<<
[mXparser-v.5.2.0] Description = Signed left shift - Bitwise operator
[mXparser-v.5.2.0] Syntax = a @<< b
[mXparser-v.5.2.0] Since = 4.0
[mXparser-v.5.2.0] Type = Bitwise operator
[mXparser-v.5.2.0] Type id = 11
[mXparser-v.5.2.0] id = 5
[mXparser-v.5.2.0] --------------------
[mXparser-v.5.2.0] Keyword = @>>
[mXparser-v.5.2.0] Description = Signed right shift - Bitwise operator
[mXparser-v.5.2.0] Syntax = a @>> b
[mXparser-v.5.2.0] Since = 4.0
[mXparser-v.5.2.0] Type = Bitwise operator
[mXparser-v.5.2.0] Type id = 11
[mXparser-v.5.2.0] id = 6
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

DONATION
Did you find the software useful?
Please consider donation 🙂
DONATE