Unicode math

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.

Case 1: The square root √

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("√2");

mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("√2");

mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res: √2 = 1.4142135623730951

Case 2: The square root of the square root √√

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("√√16");

mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("√√16");

mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res: √√16 = 2.0

Case 3: The square root and parenthesis √()

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("√√(8+8)");

mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("√√(8+8)");

mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res: √√(8+8) = 2.0

Case 4: The roots of various orders ∜ ∛ √

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("∜16 + ∛27 + √16");

mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("∜16 + ∛27 + √16");

mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res: ∜16 + ∛27 + √16 = 9.0

Case 5: SIGMA summation operator ∑

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("∑(i, 1, 5, i^2)");

mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("∑(i, 1, 5, i^2)");

mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res: ∑(i, 1, 5, i^2) = 55.0

Case 6: Unicode name of a user defined argument

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Argument a = new Argument("α = 2π");
Argument b = new Argument("β = π/2");

Expression e = new Expression("sin(α) + cos(β)", a, b);

mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ArgumentPtr a = new_Argument("α = 2π");
ArgumentPtr b = new_Argument("β = π/2");

ExpressionPtr e = new_Expression("sin(α) + cos(β)", a, b);

mXparser::consolePrintln("Res: " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res: sin(α) + cos(β) = 0.0

Case 7: Show all Unicode built-in keywords

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
mXparser.consolePrintHelp("unicode");
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
mXparser::consolePrintHelp("unicode");
Code result
[mXparser-v.5.2.1] Help content limited to query: 'unicode'
  #  Keyword             Type                    Syntax                                        Since Description
  -  --------            ----                    ------                                        ----- -----------
  1. ×                   <Operator>              a × b                                         5.0   Multiplication - Operator - Unicode math symbol
  2. ⨉                   <Operator>              a ⨉ b                                         5.0   Multiplication - Operator - Unicode math symbol
  3. ∙                   <Operator>              a ∙ b                                         5.0   Multiplication - Operator - Unicode math symbol
  4. ÷                   <Operator>              a ÷ b                                         5.0   Division - Operator - Unicode math symbol
  5. √                   <Operator>              √x                                            5.0   Square root - Operator - Unicode math symbol
  6. ∛                   <Operator>              ∛x                                            5.0   Cube root - Operator - Unicode math symbol
  7. ∜                   <Operator>              ∜x                                            5.0   Fourth root - Operator - Unicode math symbol
  8. ∧                   <Boolean operator>      p ∧ q                                         5.0   Logical conjunction AND - Boolean operator - Unicode math symbol
  9. ⊼                   <Boolean operator>      p ⊼ q                                         5.0   Sheffer stroke NAND - Boolean operator - Unicode math symbol
 10. ~∧                  <Boolean operator>      p ~∧ q                                        5.0   Sheffer stroke NAND - Boolean operator - Unicode math symbol
 11. ¬&                  <Boolean operator>      p ¬& q                                        5.0   Sheffer stroke NAND - Boolean operator - Unicode math symbol
 12. ¬∧                  <Boolean operator>      p ¬∧ q                                        5.0   Sheffer stroke NAND - Boolean operator - Unicode math symbol
 13. ¬&&                 <Boolean operator>      p ¬&& q                                       5.0   Sheffer stroke NAND - Boolean operator - Unicode math symbol
 14. ¬/\                 <Boolean operator>      p ¬/\ q                                       5.0   Sheffer stroke NAND - Boolean operator - Unicode math symbol
 15. ∨                   <Boolean operator>      p ∨ q                                         5.0   Logical disjunction OR - Boolean operator - Unicode math symbol
 16. ⊽                   <Boolean operator>      p ⊽ q                                         5.0   Logical not or (joint denial) NOR - Boolean operator - Unicode math symbol
 17. ~∨                  <Boolean operator>      p ~∨ q                                        5.0   Logical not or (joint denial) NOR - Boolean operator - Unicode math symbol
 18. ¬|                  <Boolean operator>      p ¬| q                                        5.0   Logical not or (joint denial) NOR - Boolean operator - Unicode math symbol
 19. ¬∨                  <Boolean operator>      p ¬∨ q                                        5.0   Logical not or (joint denial) NOR - Boolean operator - Unicode math symbol
 20. ¬||                 <Boolean operator>      p ¬|| q                                       5.0   Logical not or (joint denial) NOR - Boolean operator - Unicode math symbol
 21. ¬\/                 <Boolean operator>      p ¬\/ q                                       5.0   Logical not or (joint denial) NOR - Boolean operator - Unicode math symbol
 22. ⊻                   <Boolean operator>      p ⊻ q                                         5.0   Exclusive or XOR - Boolean operator - Unicode math symbol
 23. ⇒                   <Boolean operator>      p ⇒ q                                         5.0   Implication IMP - Boolean operator - Unicode math symbol
 24. ⇐                   <Boolean operator>      p ⇐ q                                         5.0   Converse implication CIMP - Boolean operator - Unicode math symbol
 25. ⇏                   <Boolean operator>      p ⇏ q                                         5.0   Material nonimplication NIMP - Boolean operator - Unicode math symbol
 26. ⇍                   <Boolean operator>      p ⇍ q                                         5.0   Converse nonimplication CNIMP - Boolean operator - Unicode math symbol
 27. ⇔                   <Boolean operator>      p ⇔ q                                         5.0   Logical biconditional EQV - Boolean operator - Unicode math symbol
 28. ¬                   <Boolean operator>      ¬p                                            5.0   Negation - Boolean operator - Unicode math symbol
 29. ≠                   <Binary relation>       a ≠ b                                         5.0   Inequation - Binary relation - Unicode math symbol
 30. ≤                   <Binary relation>       a ≤ b                                         5.0   Lower or equal - Binary relation - Unicode math symbol
 31. ⋜                   <Binary relation>       a ⋜ b                                         5.0   Lower or equal - Binary relation - Unicode math symbol
 32. ≥                   <Binary relation>       a ≥ b                                         5.0   Greater or equal - Binary relation - Unicode math symbol
 33. ⋝                   <Binary relation>       a ⋝ b                                         5.0   Greater or equal - Binary relation - Unicode math symbol
 34. ∑                   <Calculus operator>     ∑(i, from, to, expr, <by>)                    5.0   Summation SIGMA - Iterated operator Σ - Calculus operator - Unicode math symbol
 35. Σ                   <Calculus operator>     Σ(i, from, to, expr, <by>)                    5.0   Summation SIGMA - Iterated operator Σ - Calculus operator - Unicode math symbol
 36. ∏                   <Calculus operator>     ∏(i, from, to, expr, <by>)                    5.0   Product PI - Iterated operator ∏ - Calculus operator - Unicode math symbol
 37. ℿ                   <Calculus operator>     ℿ(i, from, to, expr, <by>)                    5.0   Product PI - Iterated operator ∏ - Calculus operator - Unicode math symbol
 38. Π                   <Calculus operator>     Π(i, from, to, expr, <by>)                    5.0   Product PI - Iterated operator ∏ - Calculus operator - Unicode math symbol
 39. ∫                   <Calculus operator>     ∫(expr, arg, from, to)                        5.0   Definite integral ∫ - Calculus operator - Unicode math symbol
 40. ∂                   <Calculus operator>     ∂(expr, arg, <point>)                         5.0   Derivative ∂ - Calculus operator - Unicode math symbol
 41. ∂-                  <Calculus operator>     ∂-(expr, arg, <point>)                        5.0   Left derivative ∂- - Calculus operator - Unicode math symbol
 42. ∂+                  <Calculus operator>     ∂+(expr, arg, <point>)                        5.0   Right derivative ∂+ - Calculus operator - Unicode math symbol
 43. ∆                   <Calculus operator>     ∆(expr, arg, <delta>)                         5.0   Forward difference ∆ - Calculus operator - Unicode math symbol
 44. Δ                   <Calculus operator>     Δ(expr, arg, <delta>)                         5.0   Forward difference ∆ - Calculus operator - Unicode math symbol
 45. ∇                   <Calculus operator>     ∇(expr, arg, <delta>)                         5.0   Backward difference ∇ - Calculus operator - Unicode math symbol
 46. π                   <Constant value>        π                                             5.0   Pi, Archimedes' or Ludolph's number - Mathematical constant π - Constant value - Unicode math symbol
 47. ℼ                   <Constant value>        ℼ                                             5.0   Pi, Archimedes' or Ludolph's number - Mathematical constant π - Constant value - Unicode math symbol
 48. ℯ                   <Constant value>        ℯ                                             5.0   Napier's or Euler's number (base of Natural logarithm) - Mathematical constant e - Constant value - Unicode math symbol
 49. ⅇ                   <Constant value>        ⅇ                                             5.0   Napier's or Euler's number (base of Natural logarithm) - Mathematical constant e - Constant value - Unicode math symbol
[mXparser-v.5.2.1] 

Case 8: Enable / disable Unicode built-in keywords

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
mXparser.disableUnicodeBuiltinKeyWordsMode();
mXparser.consolePrintHelp("unicode");
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
mXparser::disableUnicodeBuiltinKeyWordsMode();
mXparser::consolePrintHelp("unicode");
Code result
[mXparser-v.5.2.1] Help content limited to query: 'unicode'
  #  Keyword             Type                    Syntax                                        Since Description
  -  --------            ----                    ------                                        ----- -----------
[mXparser-v.5.2.1] 

List of Unicode symbols that grammar accepts

"α" = "\u03b1": can be used as var name
"β" = "\u03b2": can be used as var name
"γ" = "\u03b3": can be used as var name
"δ" = "\u03b4": can be used as var name
"ε" = "\u03b5": can be used as var name
"ζ" = "\u03b6": can be used as var name
"η" = "\u03b7": can be used as var name
"θ" = "\u03b8": can be used as var name
"ι" = "\u03b9": can be used as var name
"κ" = "\u03ba": can be used as var name
"λ" = "\u03bb": can be used as var name
"μ" = "\u03bc": can be used as var name
"ν" = "\u03bd": can be used as var name
"ξ" = "\u03be": can be used as var name
"ο" = "\u03bf": can be used as var name
"π" = "\u03c0": pi constant
"ρ" = "\u03c1": can be used as var name
"ς" = "\u03c2": can be used as var name
"σ" = "\u03c3": can be used as var name
"τ" = "\u03c4": can be used as var name
"υ" = "\u03c5": can be used as var name
"φ" = "\u03c6": can be used as var name
"χ" = "\u03c7": can be used as var name
"ψ" = "\u03c8": can be used as var name
"ω" = "\u03c9": can be used as var name
"Α" = "\u0391": can be used as var name
"Β" = "\u0392": can be used as var name
"Γ" = "\u0393": can be used as var name
"Δ" = "\u0394": Forward difference operator
"Ε" = "\u0395": can be used as var name
"Ζ" = "\u0396": can be used as var name
"Η" = "\u0397": can be used as var name
"Θ" = "\u0398": can be used as var name
"Ι" = "\u0399": can be used as var name
"Κ" = "\u039a": can be used as var name
"Λ" = "\u039b": can be used as var name
"Μ" = "\u039c": can be used as var name
"Ν" = "\u039d": can be used as var name
"Ξ" = "\u039e": can be used as var name
"Ο" = "\u039f": can be used as var name
"Π" = "\u03a0": Product operator - PI
"Ρ" = "\u03a1": can be used as var name
"Σ" = "\u03a3": Summation operator - SIGMA
"Τ" = "\u03a4": can be used as var name
"Υ" = "\u03a5": can be used as var name
"Φ" = "\u03a6": can be used as var name
"Χ" = "\u03a7": can be used as var name
"Ψ" = "\u03a8": can be used as var name
"Ω" = "\u03a9": can be used as var name
"∑" = "\u2211": Summation operator - SIGMA
"∏" = "\u220f": Product operator - PI
"ℿ" = "\u213f": Product operator - PI
"∆" = "\u2206": Forward difference operator
"∇" = "\u2207": Backward difference operator
"∫" = "\u222b": Definite integral operator
"ℼ" = "\u213c": pi constant
"ℇ" = "\u2107": can be used as var name
"ⅇ" = "\u2147": Napier's constant, or Euler's number, base of Natural logarithm
"ℯ" = "\u212f": Napier's constant, or Euler's number, base of Natural logarithm
"∜" = "\u221c": Fourth root function represented as unary left operator
"∛" = "\u221b": Cube root function represented as unary left operator
"√" = "\u221a": Square root function represented as unary left operator
"∂" = "\u2202": Derivative operator
"⊻" = "\u22bb": Exclusive or (XOR)
"⊽" = "\u22bd": Logical NOR
"⊼" = "\u22bc": NAND - Sheffer stroke
"⇔" = "\u21d4": Logical biconditional (EQV)
"⇍" = "\u21cd": Converse nonimplication (CNIMP)
"⇏" = "\u21cf": Material nonimplication (NIMP)
"⇐" = "\u21d0": Converse implication (CIMP)
"⇒" = "\u21d2": Implication (IMP)
"¬" = "\u00ac": Negation
"∧" = "\u2227": And
"∨" = "\u2228": Or
"⋝" = "\u22dd": Greater or equal
"≥" = "\u2265": Greater or equal
"⋜" = "\u22dc": Lower or equal
"≤" = "\u2264": Lower or equal
"≠" = "\u2260": Inequation
"÷" = "\u00f7": Division
"∙" = "\u2219": Multiplication
"⨉" = "\u2a09": Multiplication
"×" = "\u00d7": Multiplication
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