MathParser.org-mXparser

Math Parser: Java, C#, C++, Kotlin, Android, and all .NET platforms (Nuget, Maven, CMake). Supports .NET Framework, .NET Core, .NET Standard, Xamarin, and more. Features: rich built-in library of math functions, operators, constants. Flexible in user-defined arguments, functions. Expressions provided as plain text. Easy to use. Well documented.

OTHER License

Downloads
558
Stars
908
Committers
10

Bot releases are hidden (Show)

MathParser.org-mXparser - Major update: random numbers, double rounding, ULP rounding, epsilon comparison

Published by mariuszgromada over 8 years ago

v.3.0.0 (2016-05-18): Major update: Random numbers, Probability distributions & Random variables, Double precision rounding, ULP rounding, epsilon comparison, New special functions.

.NET: since v.3.0.0 dll - different private key used for signing.

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

Enjoy :-)

Download mXparser - Math Parser Java C# Library

MathParser.org-mXparser - Average, Variance, Standard deviation + New iterative operators

Published by mariuszgromada over 8 years ago

v.2.4.0 (2016-02-28): Average, Variance, Standard deviation + New iterative operators

New functions with variadic parameters:

  • mean(a1, a2, ... , an) - sample average;
  • var(a1, a2, ... , an) - bias-corrected sample variance;
  • std(a1, a2, ... , an) - bias-corrected sample standard deviation.

New iterative operators:

  • mini(i, from, to, f(i), ) - minimum from function values;
  • maxi(i, from, to, f(i), ) - maximum from function values;
  • avg(i, from, to, f(i), ) - average from function values;
  • vari(i, from, to, f(i), ) - bias-corrected sample variance from function values;
  • stdi(i, from, to, f(i), ) - bias-corrected sample standard deviation from function values.

Other changes

  • New regression tests to cover new functions;
  • Small code reorganization;
  • Added manifest to jar files containing version information;
  • .dll files were signed.

Enjoy :-)

Mariusz Gromada

Download mXparser - Math Parser Java C# Library

MathParser.org-mXparser - Trailing letter 'e' bug fix

Published by mariuszgromada over 8 years ago

v.2.3.1 (2016-01-29):

  • Trailing letter 'e' bug fix
  • Some minor changes in the code.

Download mXparser - Math Parser Java C# Library

v.2.3.0 (2016-01-17): Prime numbers supported! Multithreading performance tests! New functions: Exponential/Offset/Logarithmic integral!

Prime numbers supported:

  • new class PrimesCache in mathcollection
  • MathFunctions extended with prime testes
  • ispr(n) - Prime test function supported in expressions
  • Pi(n) - Prime Counting function supported in expressions
  • mXparser.initPrimesCache() methods (and others) to initialize prime numbers cache

Some special functions supported

  • Ei(x) - Exponential integral function supported in expressions
  • li(x) - Logarithmic integral function supported in expressions
  • Li(x) - Offset logarithmic integral function supported in expressions

New constants

  • [G] - Gompertz Constant OEIS A073003 supported in expressions
  • [li2] - li(2) A069284 - supported in expressions

Multithreading performance tests

  • Default number of cores taken from the environment
  • Possibility to change number of default threads:
  • PerformanceTests.start(int threadsNum)
  • mXparser.setThreadsNumber(int threadsNumber)

New regression tests to cover new functionalities

Enjoy :-)

Mariusz Gromada

Download mXparser - Math Parser Java C# Library

MathParser.org-mXparser - Android is coming!

Published by mariuszgromada almost 9 years ago

v.2.2.0 (2016-01-10): Android is coming!

mxparser_jdk1.7.jar - tested with Android !!!

  • all regression tests passed :-)

New public methods in the mXparser class

  • static String getConsoleOutput() - returns as string output produced by mXparser.consolePrin/ln() methods. Using this method you can capture the output to the string variable.
  • static void resetConsoleOutput() - resets the string representing console output
  • Added CONSOLE/PREFIX & CONSOLE_OUTPUT_STRING/PREFIX + configuration

Method modified in mXparser class

  • consolePrintln()
  • consolePrintln(Object o)
  • consolePrint(Object o)
  • Above methods are outputting also to string representing console output.

New RunTest method in regressiontesting, method executes specified scenario according to below params:

  • reg - Expression regression tests
  • api - mXparser API regression tests
  • syn - Syntax checking regression tests
  • perf - Performance tests

Code clean-up

  • blank lines
  • trailing white spaces
  • src folders structure for c-sharp is now the same as in java

Enjoy :-)

Mariusz Gromada

Download mXparser - Math Parser Java C# Library

MathParser.org-mXparser - Binaries for older versions of JAVA and .NET

Published by mariuszgromada almost 9 years ago

v.2.1.1-1 (2016-01-07):

  • Binaries for java: 1.5, 1.6, 1.7, 1.8
  • Binaries for .NET: 2.0, 3.0, 3.5, 4.0, 4.5, 4.6

Download mXparser - Math Parser Java C# Library

MathParser.org-mXparser - Fixed bug with min/max function

Published by mariuszgromada almost 9 years ago

v.2.1.1 (2016-01-04)

  • Fixed bug with min/max functions.
MathParser.org-mXparser - Documentation update + new methods for dec, hex, ASCII conversion

Published by mariuszgromada almost 9 years ago

v.2.1.0 (2016-01-02):

New static methods in class mXparser

  • mXparser.numberToHexString(number) + overloads: int, long, double
  • mXparser.hexString2AsciiString(String hexString)
  • mXparser.numberToAsciiString(number) + overloads: int, long, double
  • additional regression tests for the above methods

Hello World examples showing how to use mXparser binary library (manual includes: projects, code, screenshots) for:

  • JAVA (project done in Eclipse Mars 1)
  • C# (project done in Visual Studio 2015)
  • Visual Basic (project done in Visual Studio 2015)
  • C++/CLI (project done in Visual Studio 2015)
  • F# (project done in Visual Studio 2015)
MathParser.org-mXparser - Major update of the library providing more intuitive and much simpler to use API

Published by mariuszgromada almost 9 years ago

v.2.0.0 (2015-12-31):

Major update of the library providing more intuitive and much simpler to use API, no changes to the MathCollection.

Methods removed: setRecursiveMode(), disableRecursiveMode()

  • No need to manually mark recursive mode, mXparser is recognizing this mode automatically.

New handy and super easy (natural to use) constructors:

  • Constructors for user defined arguments (Argument / RecursiveArgument classes), user defined constant (Constant class), user defined functions (Function class).

Sample code:

   Constant c = new Constant("c=5");
   Constant c = new Constant("c=5+2");
   Argument x = new Argument("x=5");
   Constant c = new Constant("c=5+x", x);
   Argument y = new Argument("y=2*x", x);
   RecursiveArgument f = new RecursiveArgument("f(n)=n*f(n-1)");
   Function f = new Function("f(x,y)=sin(x)+y");
   Function f = new Function("f(n)=if( n>0, n*f(n-1), 1)");

New methods: addDefinitions(PrimitiveElement... elements), removeDefinitions(PrimitiveElement... elements)

  • New class PrimitiveElement introduced only to simplify constructors of arguments, constants, functions and expressions.
  • Classes Argument, RecursiveArgument, Constant, Functions inherits now from PrimitiveElement class, it means you can call one method for adding / removing definitions by passing comma separated list of elements that can be different type (supported types: Argument, RecursiveArgument, Constant, Function).
  • Method addArguments(), addConstants(), addFunctions(),removeArguments(), removeConstants(), removeFunctions() are still public, but this will change in the future.

Sample code:

   Constant c = new Constant("c=5");
   Argument x = new Argument("x=10/2");
   Expression e = new Expression("c+x");
   e.addDefinitions(x,c);

Modified constructors for classes Argument, RecursiveArgument, Constant, Function

  • Constructors relying on directly given argument / constant / function name are now checking given name according to the predefined regular expression (the name must start with letters, and then digits / underscores / letters are allowed).
  • Constructors removed – all constructors relying on ArrayList/List of arguments, constants, functions or on varidic type Argument, Constant, Function were substituted based on comma separated prams list of PrimitiveElement type, where Argument, Constant, Functions extend / inherit PrimitiveElement).

C# library is now Common Language Specification Compliant, it means mXparser is available right now to many other .NET languages (providing exactly the same API), including:

  • C#
  • Visual Basic .NET
  • C++/CLI
  • F#

Other changes

  • New extended list of regression tests (to cover new methods, constructors, etc...)
  • Implemented Performance Tests
  • Source code converted from cp150 to UTF-8
  • Source code reorganization (some part of package level code of the Expression class was moved to the mXparser class)
  • Some bugs fixed (for sure there are others)
MathParser.org-mXparser -

Published by mariuszgromada almost 9 years ago

1.0.3:

  • Fixed bug during indirect recursion (infinite loops while syntax checking)
  • Some minor modification of code making it more portable across platforms

1.0.2

  • Fixed bug in user defined function related to RecursiveArguments

1.0.1

1.0:

  • Initial release
Package Rankings
Top 8.19% on Repo1.maven.org
Top 9.47% on Npmjs.org
Badges
Extracted from project README
Subscription-Form INFIMA Scalar-Lite paypal INFIMA
Related Projects