GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing mathparser.org — Built-in Random Variables - mXparser - Math Expressions Parser for JAVA, C#, C++, Kotlin, Android, .NET/MONO/Xamarin - Mathematical Formula Parser / Evaluator Library FOR COMMERCIAL USE, PLEASE ENSURE YOU HAVE A COMMERCIAL LICENSE.ANOTHER WAY TO SUPPORT MY WORK IS BY PURCHASING MY BOOK, CUSTOMER FIRST, VALUE NEXT.THANK YOU FOR SUPPORTING MY WORK!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: Random integerJava/C# code// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("[Int]");
mXparser.consolePrintln("Res. 1: " + e.getExpressionString() + " = " + (int)e.calculate());
mXparser.consolePrintln("Res. 2: " + e.getExpressionString() + " = " + (int)e.calculate());
C++ code#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("[Int]");
mXparser::consolePrintln("Res. 1: " + e->getExpressionString() + " = " + (int)e->calculate());
mXparser::consolePrintln("Res. 2: " + e->getExpressionString() + " = " + (int)e->calculate());
Code result[mXparser-v.5.2.1] Res. 1: [Int] = -421216764 [mXparser-v.5.2.1] Res. 2: [Int] = 859703054 Case 2: Random integer N: -10^k <= N <= 10^k for k = 1, 2, …,9Java/C# code// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
/* -100 <= N <= 100 */
Expression e2 = new Expression("[Int2]");
mXparser.consolePrintln("Res. 1: " + e2.getExpressionString() + " = " + e2.calculate());
mXparser.consolePrintln("Res. 2: " + e2.getExpressionString() + " = " + e2.calculate());
/* -100000 <= N <= 100000 */
Expression e5 = new Expression("[Int5]");
mXparser.consolePrintln("Res. 3: " + e5.getExpressionString() + " = " + e5.calculate());
mXparser.consolePrintln("Res. 4: " + e5.getExpressionString() + " = " + e5.calculate());
C++ code#include "org/mariuszgromada/math/mxparser.hpp"
// ...
/* -100 <= N <= 100 */
ExpressionPtr e2 = new_Expression("[Int2]");
mXparser::consolePrintln("Res. 1: " + e2->getExpressionString() + " = " + e2->calculate());
mXparser::consolePrintln("Res. 2: " + e2->getExpressionString() + " = " + e2->calculate());
/* -100000 <= N <= 100000 */
ExpressionPtr e5 = new_Expression("[Int5]");
mXparser::consolePrintln("Res. 3: " + e5->getExpressionString() + " = " + e5->calculate());
mXparser::consolePrintln("Res. 4: " + e5->getExpressionString() + " = " + e5->calculate());
Code result[mXparser-v.5.2.1] Res. 1: [Int2] = 92.0 [mXparser-v.5.2.1] Res. 2: [Int2] = 94.0 [mXparser-v.5.2.1] Res. 3: [Int5] = 50442.0 [mXparser-v.5.2.1] Res. 4: [Int5] = -76163.0 Case 3: Random natural numberJava/C# code// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
/* Including 0 */
Expression e1 = new Expression("[nat]");
mXparser.consolePrintln("Res. 1: " + e1.getExpressionString() + " = " + (int)e1.calculate());
mXparser.consolePrintln("Res. 2: " + e1.getExpressionString() + " = " + (int)e1.calculate());
/* Excluding 0 */
Expression e2 = new Expression("[Nat]");
mXparser.consolePrintln("Res. 3: " + e2.getExpressionString() + " = " + (int)e2.calculate());
mXparser.consolePrintln("Res. 4: " + e2.getExpressionString() + " = " + (int)e2.calculate());
C++ code#include "org/mariuszgromada/math/mxparser.hpp"
// ...
/* Including 0 */
ExpressionPtr e1 = new_Expression("[nat]");
mXparser::consolePrintln("Res. 1: " + e1->getExpressionString() + " = " + (int)e1->calculate());
mXparser::consolePrintln("Res. 2: " + e1->getExpressionString() + " = " + (int)e1->calculate());
/* Excluding 0 */
ExpressionPtr e2 = new_Expression("[Nat]");
mXparser::consolePrintln("Res. 3: " + e2->getExpressionString() + " = " + (int)e2->calculate());
mXparser::consolePrintln("Res. 4: " + e2->getExpressionString() + " = " + (int)e2->calculate());
Code result[mXparser-v.5.2.1] Res. 1: [nat] = 1659809708 [mXparser-v.5.2.1] Res. 2: [nat] = 1259835535 [mXparser-v.5.2.1] Res. 3: [Nat] = 248106924 [mXparser-v.5.2.1] Res. 4: [Nat] = 1953526897 Case 4: Random natural number N <= 10^k for k = 1, 2, …,9Java/C# code// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
/* Including 0: 0 <= N < 10 */
Expression e1 = new Expression("[nat1]");
mXparser.consolePrintln("Res. 1: " + e1.getExpressionString() + " = " + (int)e1.calculate());
mXparser.consolePrintln("Res. 2: " + e1.getExpressionString() + " = " + (int)e1.calculate());
/* Excluding 0: 0 < N < 1000 */
Expression e2 = new Expression("[Nat3]");
mXparser.consolePrintln("Res. 3: " + e2.getExpressionString() + " = " + (int)e2.calculate());
mXparser.consolePrintln("Res. 4: " + e2.getExpressionString() + " = " + (int)e2.calculate());
C++ code#include "org/mariuszgromada/math/mxparser.hpp"
// ...
/* Including 0: 0 <= N < 10 */
ExpressionPtr e1 = new_Expression("[nat1]");
mXparser::consolePrintln("Res. 1: " + e1->getExpressionString() + " = " + (int)e1->calculate());
mXparser::consolePrintln("Res. 2: " + e1->getExpressionString() + " = " + (int)e1->calculate());
/* Excluding 0: 0 < N < 1000 */
ExpressionPtr e2 = new_Expression("[Nat3]");
mXparser::consolePrintln("Res. 3: " + e2->getExpressionString() + " = " + (int)e2->calculate());
mXparser::consolePrintln("Res. 4: " + e2->getExpressionString() + " = " + (int)e2->calculate());
Code result[mXparser-v.5.2.1] Res. 1: [nat1] = 10 [mXparser-v.5.2.1] Res. 2: [nat1] = 0 [mXparser-v.5.2.1] Res. 3: [Nat3] = 90 [mXparser-v.5.2.1] Res. 4: [Nat3] = 51 Case 5: Uniform continuous distribution U(0,1)Java/C# code// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("[Uni]");
mXparser.consolePrintln("Res. 1: " + e.getExpressionString() + " = " + e.calculate());
mXparser.consolePrintln("Res. 2: " + e.getExpressionString() + " = " + e.calculate());
C++ code#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("[Uni]");
mXparser::consolePrintln("Res. 1: " + e->getExpressionString() + " = " + e->calculate());
mXparser::consolePrintln("Res. 2: " + e->getExpressionString() + " = " + e->calculate());
Code result[mXparser-v.5.2.1] Res. 1: [Uni] = 0.9203947484394417 [mXparser-v.5.2.1] Res. 2: [Uni] = 0.27088514104678163 Case 6: Normal distribution N(0,1)Java/C# code// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("[Nor]");
mXparser.consolePrintln("Res. 1: " + e.getExpressionString() + " = " + e.calculate());
mXparser.consolePrintln("Res. 2: " + e.getExpressionString() + " = " + e.calculate());
C++ code#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("[Nor]");
mXparser::consolePrintln("Res. 1: " + e->getExpressionString() + " = " + e->calculate());
mXparser::consolePrintln("Res. 2: " + e->getExpressionString() + " = " + e->calculate());
Code result[mXparser-v.5.2.1] Res. 1: [Nor] = 0.33914374337258346 [mXparser-v.5.2.1] Res. 2: [Nor] = 0.2480653909819784 Nuget – Package Manager (C#, F#, Visual Basic, …)
Maven – Dependency (Java, Kotlin, Scala, Groovy, …)
Maven – Gradle
CMake – Dependency / FetchContent (C++, MSVC, LLVM/Clang, GNU/GCC, MinGW, MSYS2, WSL, Windows, Linux, Unix, MacOS)
GitHub
OTHER DOWNLOAD OPTIONSDownload 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.ORGSOURCE CODESource code .zipSource code .tar.gz My other creative spacesDONATIONDonation with PayPal |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |