PDF, CDF and Quantile functions

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: Expected value estimation using Probability Distribution Function

$$X\sim N(2,4) \quad \text{E}X = \int_{\mathbb{R}} xp(x) \text{d}x = 2$$

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("int( x * pNor(x, 2, 4), x, -18, 22)");

mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("int( x * pNor(x, 2, 4), x, -18, 22)");

mXparser::consolePrintln("Res. : " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res. : int( x * pNor(x, 2, 4), x, -18, 22) = 1.9999986197331323

Case 2: Probability estimation using Cumulative Distribution Function – the law of 3*SIGMA

$$X\sim N(0,1) \quad P(-3 < X < 3)$$

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("cNor(3,0,1) - cNor(-3,0,1)");

mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("cNor(3,0,1) - cNor(-3,0,1)");

mXparser::consolePrintln("Res. : " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res. : cNor(3,0,1) - cNor(-3,0,1) = 0.9973002039367398

Case 3: Calculating quantiles using Inverse Cumulative Distribution Function – males height example assuming males height distribution N(170, 15)

$$X\sim N(170,15)$$

Java/C# code
// JAVA: import org.mariuszgromada.math.mxparser.*;
// C#: using org.mariuszgromada.math.mxparser;
// ...
Expression e = new Expression("qNor(0.9, 170, 15)");

mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());
C++ code
#include "org/mariuszgromada/math/mxparser.hpp"
// ...
ExpressionPtr e = new_Expression("qNor(0.9, 170, 15)");

mXparser::consolePrintln("Res. : " + e->getExpressionString() + " = " + e->calculate());
Code result
[mXparser-v.5.2.1] Res. : qNor(0.9, 170, 15) = 189.223273483169
Nuget – Package Manager

Install-Package MathParser.org-mXparser -Version 6.0.0

Nuget – .NET CLI

dotnet add package MathParser.org-mXparser --version 6.0.0

Nuget – Package Reference

<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

My other creative spaces

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