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.
Case 1: The square root √
import org.mariuszgromada.math.mxparser.*; ... Expression e = new Expression("√2"); mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: √2 = 1.4142135623730951
Case 2: The square root of the square root √√
import org.mariuszgromada.math.mxparser.*; ... Expression e = new Expression("√√16"); mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: √√16 = 2.0
Case 3: The square root and parenthesis √()
import org.mariuszgromada.math.mxparser.*; ... Expression e = new Expression("√√(8+8)"); mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: √√(8+8) = 2.0
Case 4: The roots of various orders ∜ ∛ √
import org.mariuszgromada.math.mxparser.*; ... Expression e = new Expression("∜16 + ∛27 + √16"); mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: ∜16 + ∛27 + √16 = 9.0
Case 5: SIGMA summation operator ∑
import org.mariuszgromada.math.mxparser.*; ... Expression e = new Expression("∑(i, 1, 5, i^2)"); mXparser.consolePrintln("Res: " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.5.0.0] Res: ∑(i, 1, 5, i^2) = 55.0
Case 6: Unicode name of a user defined argument
import 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());
[mXparser-v.5.0.0] Res: sin(α) + cos(β) = 0.0
Case 7: Show all Unicode built-in keywords
import org.mariuszgromada.math.mxparser.*; ... mXparser.consolePrintHelp("unicode");
Help content: # key word type syntax since description - -------- ---- ------ ----- ----------- 5. × <Operator> a × b 5.0 Multiplication - unicode math symbol 6. ⨉ <Operator> a ⨉ b 5.0 Multiplication - unicode math symbol 7. ∙ <Operator> a ∙ b 5.0 Multiplication - unicode math symbol 9. ÷ <Operator> a ÷ b 5.0 Division - unicode math symbol 15. √ <Operator> √x 5.0 Square root function represented as unary left operator - unicode math symbol 16. ∛ <Operator> ∛x 5.0 Cube root function represented as unary left operator - unicode math symbol 17. ∜ <Operator> ∜x 5.0 Fourth root function represented as unary left operator - unicode math symbol 19. ∧ <Boolean Operator> p ∧ q 5.0 Logical conjunction (AND) - unicode math symbol 22. ⊼ <Boolean Operator> p ⊼ q 5.0 NAND - Sheffer stroke - unicode math symbol 24. ~∧ <Boolean Operator> p ~∧ q 5.0 NAND - Sheffer stroke - unicode math symbol 25. ¬& <Boolean Operator> p ¬& q 5.0 NAND - Sheffer stroke - unicode math symbol 26. ¬∧ <Boolean Operator> p ¬∧ q 5.0 NAND - Sheffer stroke - unicode math symbol 29. ¬&& <Boolean Operator> p ¬&& q 5.0 NAND - Sheffer stroke - unicode math symbol 30. ¬/\ <Boolean Operator> p ¬/\ q 5.0 NAND - Sheffer stroke - unicode math symbol 32. ∨ <Boolean Operator> p ∨ q 5.0 Logical disjunction (OR) - unicode math symbol 35. ⊽ <Boolean Operator> p ⊽ q 5.0 Logical NOR - unicode math symbol 37. ~∨ <Boolean Operator> p ~∨ q 5.0 Logical NOR - unicode math symbol 38. ¬| <Boolean Operator> p ¬| q 5.0 Logical NOR - unicode math symbol 39. ¬∨ <Boolean Operator> p ¬∨ q 5.0 Logical NOR - unicode math symbol 42. ¬|| <Boolean Operator> p ¬|| q 5.0 Logical NOR - unicode math symbol 43. ¬\/ <Boolean Operator> p ¬\/ q 5.0 Logical NOR - unicode math symbol 44. ⊻ <Boolean Operator> p ⊻ q 5.0 Exclusive or (XOR) - unicode math symbol 46. ⇒ <Boolean Operator> p ⇒ q 5.0 Implication (IMP) - unicode math symbol 48. ⇐ <Boolean Operator> p ⇐ q 5.0 Converse implication (CIMP) - unicode math symbol 50. ⇏ <Boolean Operator> p ⇏ q 5.0 Material nonimplication (NIMP) - unicode math symbol 52. ⇍ <Boolean Operator> p ⇍ q 5.0 Converse nonimplication (CNIMP) - unicode math symbol 54. ⇔ <Boolean Operator> p ⇔ q 5.0 Logical biconditional (EQV) - unicode math symbol 57. ¬ <Boolean Operator> ¬p 5.0 Negation - unicode math symbol 60. ≠ <Binary Relation> a ≠ b 5.0 Inequation - unicode math symbol 66. ≤ <Binary Relation> a ≤ b 5.0 Lower or equal - unicode math symbol 67. ⋜ <Binary Relation> a ⋜ b 5.0 Lower or equal - unicode math symbol 69. ≥ <Binary Relation> a ≥ b 5.0 Greater or equal - unicode math symbol 70. ⋝ <Binary Relation> a ⋝ b 5.0 Greater or equal - unicode math symbol 251. ∑ <Calculus Operator> ∑(i, from, to, expr, <by>) 5.0 Summation operator - SIGMA - unicode math symbol 252. Σ <Calculus Operator> Σ(i, from, to, expr, <by>) 5.0 Summation operator - SIGMA - unicode math symbol 254. ∏ <Calculus Operator> ∏(i, from, to, expr, <by>) 5.0 Product operator - PI - unicode math symbol 255. ℿ <Calculus Operator> ℿ(i, from, to, expr, <by>) 5.0 Product operator - PI - unicode math symbol 256. Π <Calculus Operator> Π(i, from, to, expr, <by>) 5.0 Product operator - PI - unicode math symbol 258. ∫ <Calculus Operator> ∫(expr, arg, from, to) 5.0 Definite integral operator - unicode math symbol 260. ∂ <Calculus Operator> ∂(expr, arg, <point>) 5.0 Derivative operator - unicode math symbol 262. ∂- <Calculus Operator> ∂-(expr, arg, <point>) 5.0 Left derivative operator - unicode math symbol 264. ∂+ <Calculus Operator> ∂+(expr, arg, <point>) 5.0 Right derivative operator - unicode math symbol 267. ∆ <Calculus Operator> ∆(expr, arg, <delta>) 5.0 Forward difference operator - unicode math symbol 268. Δ <Calculus Operator> Δ(expr, arg, <delta>) 5.0 Forward difference operator - unicode math symbol 270. ∇ <Calculus Operator> ∇(expr, arg, <delta>) 5.0 Backward difference operator - unicode math symbol 278. π <Constant Value> π 5.0 Pi, Archimedes' constant or Ludolph's number - unicode math symbol 279. ℼ <Constant Value> ℼ 5.0 Pi, Archimedes' constant or Ludolph's number - unicode math symbol 282. ℯ <Constant Value> ℯ 5.0 Napier's constant, or Euler's number, base of Natural logarithm - unicode math symbol 283. ⅇ <Constant Value> ⅇ 5.0 Napier's constant, or Euler's number, base of Natural logarithm - unicode math symbol
Case 8: Enable / disable Unicode built-in keywords
import org.mariuszgromada.math.mxparser.*; ... mXparser.disableUnicodeBuiltinKeyWordsMode(); mXparser.consolePrintHelp("unicode");
Help content: # key word type syntax since description - -------- ---- ------ ----- -----------
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
Install-Package
MathParser.org-mXparser
-Version
5.2.0
dotnet add package
MathParser.org-mXparser
--version
5.2.0
<PackageReference Include=
"MathParser.org-mXparser"
Version=
"5.2.0"
/>
Maven – Dependency
<dependency>
<groupid>org.mariuszgromada.math
</groupid>
<artifactid>MathParser.org-mXparser
</artifactid>
<version>5.2.0
</version>
</dependency>
Maven – Gradle
implementation
'org.mariuszgromada.math:MathParser.org-mXparser:5.2.0'
Maven – Gradle (Kotlin)
implementation(
"org.mariuszgromada.math:MathParser.org-mXparser:5.2.0"
)
GitHub
git clone
https://github.com/mariuszgromada/MathParser.org-mXparser
OTHER DOWNLOAD OPTIONS
Download latest release – v.5.2.0 Orion: .NET bin onlyDownload latest release – v.5.2.0 Orion: JAVA bin onlyDownload latest release – v.5.2.0 Orion: bin + doc
NEWS FROM MATHPARSER.ORG
SOURCE CODE
Source code .zipSource code .tar.gz
View on GitHubMathSpace.pl