# PDF, CDF and Quantile functions

## 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: import org.mariuszgromada.math.mxparser.*;
// ...
Expression e = new Expression("int( x * pNor(x, 2, 4), x, -18, 22)");

mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());

[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: import org.mariuszgromada.math.mxparser.*;
// ...
Expression e = new Expression("cNor(3,0,1) - cNor(-3,0,1)");

mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());

[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: import org.mariuszgromada.math.mxparser.*;
// ...
Expression e = new Expression("qNor(0.9, 170, 15)");

mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());

[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>

implementation 'org.mariuszgromada.math:MathParser.org-mXparser:6.0.0'

implementation("org.mariuszgromada.math:MathParser.org-mXparser:6.0.0")

###### GitHub

git clone https://github.com/mariuszgromada/MathParser.org-mXparser