# mXparser – v.3.0.0 – released!

## Random numbers – new functions

• rUni(a, b) – Random number from uniform continuous distribution U(a,b)
• rUnid(a, b) – Random number from uniform discrete distribution U{a,b}
• rNor(m, s) – Random number from normal distribution N(m,s)
• rList(a1, a2, …, an) – Random number from given list of numbers

## Probability distributions – new functions

• pUni(x, a, b) – Probability distribution function – Uniform continuous distribution U(a,b)
• cUni(x, a, b) – Cumulative distribution function – Uniform continuous distribution U(a,b)
• qUni(q, a, b) – Quantile function (inverse cumulative distribution function) – Uniform continuous distribution U(a,b)
• pNor(x, a, b) – Probability distribution function – Normal distribution N(m,s)
• cNor(x, a, b) – Cumulative distribution function – Normal distribution N(m,s)
• qNor(q, m, s) – Quantile function (inverse cumulative distribution function) – Normal distribution N(m,s)

## Random variables (predefined) – acting as random constant (no parameters)

• [Int] – Random variable – random integer
• [Int1] – Random variable – random integer – Uniform discrete distribution U{-10^1, 10^1}
• [Int2] – Random variable – random integer – Uniform discrete distribution U{-10^2, 10^2}
• [Int3] – Random variable – random integer – Uniform discrete distribution U{-10^3, 10^3}
• [Int4] – Random variable – random integer – Uniform discrete distribution U{-10^4, 10^4}
• [Int5] – Random variable – random integer – Uniform discrete distribution U{-10^5, 10^5}
• [Int6] – Random variable – random integer – Uniform discrete distribution U{-10^6, 10^6}
• [Int7] – Random variable – random integer – Uniform discrete distribution U{-10^7, 10^7}
• [Int8] – Random variable – random integer – Uniform discrete distribution U{-10^8, 10^8}
• [Int9] – Random variable – random integer – Uniform discrete distribution U{-10^9, 10^9}
• [nat] – Random variable – random natural number including 0
• [nat1] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^1}
• [nat2] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^2}
• [nat3] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^3}
• [nat4] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^4}
• [nat5] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^5}
• [nat6] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^6}
• [nat7] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^7}
• [nat8] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^8}
• [nat9] – Random variable – random natural number including 0 – Uniform discrete distribution U{0, 10^9}
• [Nat] – Random variable – random natural number
• [Nat1] – Random variable – random natural number – Uniform discrete distribution U{1, 10^1}
• [Nat2] – Random variable – random natural number – Uniform discrete distribution U{1, 10^2}
• [Nat3] – Random variable – random natural number – Uniform discrete distribution U{1, 10^3}
• [Nat4] – Random variable – random natural number – Uniform discrete distribution U{1, 10^4}
• [Nat5] – Random variable – random natural number – Uniform discrete distribution U{1, 10^5}
• [Nat6] – Random variable – random natural number – Uniform discrete distribution U{1, 10^6}
• [Nat7] – Random variable – random natural number – Uniform discrete distribution U{1, 10^7}
• [Nat8] – Random variable – random natural number – Uniform discrete distribution U{1, 10^8}
• [Nat9] – Random variable – random natural number – Uniform discrete distribution U{1, 10^9}
• [Nor] – Random variable – Normal distribution N(0,1)

## Double precision rounding

• round(value, places) – decimal rounding (half-up)

## New special functions

• erf(x) – Gauss error function
• erfc(x) – Gauss complementary error function
• erfInv(x) – Inverse Gauss error function
• erfcInv(x) – Inverse Gauss complementary error function

## Other functions

• ulp(x) – Unit in The Last Place

## Binary relations – epsilon+ulp comparison – enabled as default

If a rel b then applied epsilon is maximum from epsilon and ulp(b) : i.e. a eq b if a \in [b-eps; b+eps] inclusive

• mXparser.setExactComparison()
• mXparser.setEpsilonComparison()
• mXparser.setEpsilon(double epsilon)
• mXparser.setDefaultEpsilon()
• mXparser.getEpsilon()
• mXparser.checkIfEpsilonMode()
• mXparser.checkIfExactMode()

## Intelligent automatic double ULP rounding – enabled as default

** Try 0.1 + 0.1 + 0.1 – it will give exact 0.3 🙂 **

• mXparser.enableUlpRounding()
• mXparser.disableUlpRounding()
• mXparser.checkIfUlpRounding()

## Parser tokens definition now public in API

• mxparser.parsertokens

## Expression after tokenization now public in API

• Expression.getCopyOfInitialTokens()
• mxparser.parsertokens
• mXparser.consolePrintTokens()

## Significant reorganization of code

• Mainly mathcollection & parser tokens

## Backwards compatibility

• is preserved for String API, Expression, Function, Argument, Constnat, …
• other public API was reorganized (mainly mxparser.mathcollection)

## Bugs fixed

• bugs related to iterated operators

## Other changes

• Many new regression tests

## 10 thoughts on “mXparser – v.3.0.0 – released!”

1. Tj says:

I’m not having much luck using the library via NuGet for a dnx based console project.

The error I get is, “The dependency MathParser.org-mXparser 3.0.0 in project TestSample does not support framework DNXCore,Version=v5.0”

Has anyone had a luck getting it to work with the new .Net stuff? I’m currently using RC1 still.

2. Kameswara Rao says:

I have one query mXparser – v.3.0.0.
How can I work on traditional sum and average like
sum(1,2,3,4,5,6,7)= 28
avg(6,9,2,3)=5
can you please send me sample code

1. Mariusz Gromada says:

Hi,

“sum” keyword is reserved for SIGMA operator (sum an for n=a to b) – the same in case of “avg”. In order to perform variadic sum please use add(1,2,3,4,5,6,7). In case of variadic average you should use mean(6,9,2,3).

Best regards

1. Kameswara Rao says:

Working fine.

3. Kameswara Rao says:

Hi ,
For large values it is not giving proper output. Is there any thing wrong from my inputs

FYI.
I am using like
mXparser.consolePrintln(“Res 1: ” + e1.getExpressionString() + ” = ” + e1.calculate());

output :
[mXparser-v.3.0.0] Res 1: add(122,32312312,5434543,553112,554332432,566878545,5432433242,99876677,321313,44312132121,31213123,444112313131,441133432234) = 9.36281232907E11

1. Mariusz Gromada says:

Hi,

Everything seems to be ok. mXparser performs calculation on double numbers. If you expect integer please do casting to int / long, or simply format the number when displaying.

9.36281232907E11 = 936281232907

Best regards

1. Kameswara Rao says:

Working fine.

1. Andrzej says:

Hi,
Is there a way to keep zeroes after decimal point in rounding function?
e.g. round(1.6000,2) = 1.60 ?? On Java I can use string formatter, but I want to make it more generic.

1. Mariusz Gromada says:

Hi,

The result is always a double, so you need to convert it at the end to a string.

Best regards

4. will says: