Monthly Archives: January 2016

mXparser v.2.3.0: Extensive prime numbers support, Multi-threading performance tests, New built-in functions and constants!

Major update of the library was released on Jan,  17th 2016.

Extensive support for the prime numbers:

  • new class PrimesCache in mathcollection
  • MathFunctions extended with primality test
  • ispr(n) - Primality 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

Download mXparser-v.2.3.0

Enjoy 🙂

Mariusz Gromada

mXparser v.2.2.0: Android is coming

mXparser and Android

Since mXparser-v.2.2.0 library is being always tested also on the Android platform. I can confirm that all regression tests were passed without any problems. Recommended library to use directly in the Android project is mXparser built with JDK 1.7.

Console output available in String

In terms of System.out.println() Android behavior is different than JVM causing that all data passed to Console on JVM is printed in by Android Dalvik. If you will use mXparser.consolePrintln()/Print() methods instead of System.out. equivalents  you will also get access to the console output string containing printed data. Please refer to the API specification of the mXparser class.

Enjoy 🙂

Mariusz Gromada

mXparser - user defined functions applied to Fundamental theorem of calculus

Fundamental Theorem of Calculus is a kind of a link between two most important calculus concepts: derivative and integral.

Fundamental Theorem of Calculus - formal statement

For continuous real-valued function f:[a,b]\to\mathbb{R} defined on closed interval [a,b] let F:[a,b]\to\mathbb{R} be the function given by

F(x)=\int_a^x f(t)\text{d}t

The F is uniformly continuous on [a, b], differentiable on the open interval (a, b), and


Fundamental Theorem of Calculus - mXparser test

import org.mariuszgromada.math.mxparser.*;
/* Function */
Function f = new Function("f(x) = sin(x)");
/* Antiderivative */
Function F = new Function("F(x) = int(f(t), t, 0, x)", f);
/* function = derivative ( antiderivative ) */
Argument x = new Argument("x = pi");
Expression e = new Expression("f(x) - der(F(x), x)", x, f, F);
mXparser.consolePrintln("Res : " + e.getExpressionString() + " = " + e.calculate());
mXparser.consolePrintln("Computing time = " + e.getComputingTime() + " s.");
Res : f(x) - der(F(x), x) = 6.237833817291525E-8
Computing time = 0.411 s.

Best regards,
Mariusz Gromada