PDF, CDF and Quantile functions

MathParser.org - mXparser - logo - Tutorial

*** If you found the software useful donation is something you might consider 🙂 ***

If you found the software useful donation is something you might consider :-)

JAVA code

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

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.3.0.0] 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)

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.3.0.0] Res. : cNor(3,0,1) - cNor(-3,0,1) = 0.99730020393674

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

X\sim N(170,15)

import org.mariuszgromada.math.mxparser.*;
...
Expression e = new Expression("qNor(0.9, 170, 15)");
mXparser.consolePrintln("Res. : " + e.getExpressionString() + " = " + e.calculate());
[mXparser-v.3.0.0] Res. : qNor(0.9, 170, 15) = 189.223273483169

*** If you found the software useful donation is something you might consider 🙂 ***

If you found the software useful donation is something you might consider :-)

Enjoy! 🙂

 

Best regards,

Mariusz Gromada

Download latest release – v.4.1.1 Aeries: bin + doc + src (.zip 13.4 MB)

Download latest release – v.4.1.1 Aeries: bin only (.zip 4.35 MB) – separate binaries for java: 1.5, 1.6, 1.7, 1.8; .NET: 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, .NET Core, .NET Standard, .NET PCL, Xamarin.Android, Xamarin.iOS

Source code .zipSource code .tar.gz View on GitHubMathSpace.pl