Original author(s) | Mariusz Gromada |
---|---|
Initial release | January 2010 |
Stable release | 6.0.0 / 19 May 2024 |
Repository | github |
Written in | Java, C# |
Platform | JVM, Android, .NET, .NET Core, .NET Standard, Windows Phone, MONO, Xamarin, Xamarin.iOS, Xamarin.Android |
Website | mathparser |
mXparser is an open-source mathematical expressions parser/evaluator providing abilities to calculate various expressions at a run time. [1] Expressions definitions are given as plain text, then verified in terms of grammar / syntax, finally calculated. Library source code is maintained separately for Java and C#, providing the same API for Java/JVM, Android, .NET and Mono (Common Language Specification Compliant).
mXparser delivers functionalities such as: basic calculations, implied multiplication, built-in constants and functions, numerical calculus operations, iterated operators, user defined constants, user defined functions, user defined recursion, Unicode mathematical symbols support.
mXparser supports basic operators, such as: addition '+', subtraction '-', multiplication '*', division '/', factorial '!', power '^', modulo '#'.
Expressione=newExpression("2+3/(4+5)^4");doublev=e.calculate();
Expressione=newExpression("2(3+4)3");doublev=e.calculate();
Expressione=newExpression("2pi(3+4)2sin(3)e");doublev=e.calculate();
It is possible to combine typical expressions with binary relations (such as: greater than '>', less than '<', equality '=', inequality '<>', greater or equal '>=', lower or equal '<='), as each relation evaluation results in either '1' for true outcome, or '0' for false.
Expressione=newExpression("(2<3)+5");doublev=e.calculate();
Boolean logic also operates assuming equivalence of '1 as true' and '0 as false'. Supported Boolean operators include: AND conjunction, OR disjunction, NAND Sheffer stroke, NOR, XOR Exclusive OR, IMP Implication, CIMP Converse implication, NIMP Material nonimplication, CNIMP Converse nonimplication, EQV Logical biconditional, Negation.
Expressione=newExpression("1 --> 0");doublev=e.calculate();
Supported common mathematical functions (unary, binary and variable number of arguments), including: trigonometric functions, inverse trigonometric functions, logarithm functions, exponential function, hyperbolic functions, Inverse hyperbolic functions, Bell numbers, Lucas numbers, Stirling numbers, prime-counting function, exponential integral function, logarithmic integral function, offset logarithmic integral, binomial coefficient and others.
Expressione=newExpression("sin(0)+ln(2)+log(3,9)");doublev=e.calculate();
Expressione=newExpression("min(1,2,3,4)+gcd(1000,100,10)");doublev=e.calculate();
Expressione=newExpression("if(2<1, 3, 4)");doublev=e.calculate();
Expressione=newExpression("iff(2<1, 1; 3<4, 2; 10<2, 3; 5<10, 4)");doublev=e.calculate();
Built-in mathematical constants, with high precision.
Expressione=newExpression("sin(pi)+ln(e)");doublev=e.calculate();
Iterated summation and product operators.
Expressione=newExpression("sum(i, 1, 10, ln(i))");doublev=e.calculate();
Expressione=newExpression("prod(i, 1, 10, sin(i))");doublev=e.calculate();
mXparser delivers implementation of the following calculus operations: differentiation and integration.
Expressione=newExpression("der( sin(x), x )");doublev=e.calculate();
Expressione=newExpression("int( sqrt(1-x^2), x, -1, 1)");doublev=e.calculate();
Expressione=newExpression("ispr(21)");doublev=e.calculate();
Expressione=newExpression("Pi(1000)");doublev=e.calculate();
Expressione=newExpression("√2");doublev=e.calculate();
Expressione=newExpression("∜16 + ∛27 + √16");doublev=e.calculate();
Expressione=newExpression("∑(i, 1, 5, i^2)");doublev=e.calculate();
Library provides API for creation of user-defined objects, such as: constants, arguments, functions.
Constantt=newConstant("t = 2*pi");Expressione=newExpression("sin(t)",t);doublev=e.calculate();
Argumentx=newArgument("x = 5");Argumenty=newArgument("y = 2*x",x);Expressione=newExpression("sin(x)+y",x,y);doublev=e.calculate();
Functionf=newFunction("f(x, y) = sin(x)+cos(y)");Expressione=newExpression("f(1,2)",f);doublev=e.calculate();
Functionf=newFunction("f(...) = sum( i, 1, [npar], par(i) )");Expressione=newExpression("f(1,2,3,4)",f);doublev=e.calculate();
Functionfib=newFunction("fib(n) = iff( n>1, fib(n-1)+fib(n-2); n=1, 1; n=0, 0 ) )");Expressione=newExpression("fib(10)",fib);doublev=e.calculate();
Bessel functions, first defined by the mathematician Daniel Bernoulli and then generalized by Friedrich Bessel, are canonical solutions y(x) of Bessel's differential equation
Euler's formula, named after Leonhard Euler, is a mathematical formula in complex analysis that establishes the fundamental relationship between the trigonometric functions and the complex exponential function. Euler's formula states that, for any real number x, one has
The exponential function is a mathematical function denoted by or . Unless otherwise specified, the term generally refers to the positive-valued function of a real variable, although it can be extended to the complex numbers or generalized to other mathematical objects like matrices or Lie algebras. The exponential function originated from the operation of taking powers of a number, but various modern definitions allow it to be rigorously extended to all real arguments , including irrational numbers. Its ubiquitous occurrence in pure and applied mathematics led mathematician Walter Rudin to consider the exponential function to be "the most important function in mathematics".
In mathematics, the logarithm is the inverse function to exponentiation. That means that the logarithm of a number x to the base b is the exponent to which b must be raised to produce x. For example, since 1000 = 103, the logarithm base of 1000 is 3, or log10 (1000) = 3. The logarithm of x to base b is denoted as logb (x), or without parentheses, logb x. When the base is clear from the context or is irrelevant it is sometimes written log x.
In mathematics, Catalan's constantG, is defined by
In mathematics, hyperbolic functions are analogues of the ordinary trigonometric functions, but defined using the hyperbola rather than the circle. Just as the points (cos t, sin t) form a circle with a unit radius, the points (cosh t, sinh t) form the right half of the unit hyperbola. Also, similarly to how the derivatives of sin(t) and cos(t) are cos(t) and –sin(t) respectively, the derivatives of sinh(t) and cosh(t) are cosh(t) and +sinh(t) respectively.
In mathematics, the Lambert W function, also called the omega function or product logarithm, is a multivalued function, namely the branches of the converse relation of the function f(w) = wew, where w is any complex number and ew is the exponential function. The function is named after Johann Lambert, who considered a related problem in 1758. Building on Lambert's work, Leonhard Euler described the W function per se in 1783.
In mathematics, exponentiation is an operation involving two numbers: the base and the exponent or power. Exponentiation is written as bn, where b is the base and n is the power; this is pronounced as "b (raised) to the n". When n is a positive integer, exponentiation corresponds to repeated multiplication of the base: that is, bn is the product of multiplying n bases:
Dynamic programming is both a mathematical optimization method and an algorithmic paradigm. The method was developed by Richard Bellman in the 1950s and has found applications in numerous fields, from aerospace engineering to economics.
Euler's constant is a mathematical constant, usually denoted by the lowercase Greek letter gamma, defined as the limiting difference between the harmonic series and the natural logarithm, denoted here by log:
In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form
In mathematics, separation of variables is any of several methods for solving ordinary and partial differential equations, in which algebra allows one to rewrite an equation so that each of two variables occurs on a different side of the equation.
The Basel problem is a problem in mathematical analysis with relevance to number theory, concerning an infinite sum of inverse squares. It was first posed by Pietro Mengoli in 1650 and solved by Leonhard Euler in 1734, and read on 5 December 1735 in The Saint Petersburg Academy of Sciences. Since the problem had withstood the attacks of the leading mathematicians of the day, Euler's solution brought him immediate fame when he was twenty-eight. Euler generalised the problem considerably, and his ideas were taken up more than a century later by Bernhard Riemann in his seminal 1859 paper "On the Number of Primes Less Than a Given Magnitude", in which he defined his zeta function and proved its basic properties. The problem is named after Basel, hometown of Euler as well as of the Bernoulli family who unsuccessfully attacked the problem.
bc, for basic calculator, is "an arbitrary-precision calculator language" with syntax similar to the C programming language. bc is typically used as either a mathematical scripting language or as an interactive mathematical shell.
In mathematics, a fundamental solution for a linear partial differential operator L is a formulation in the language of distribution theory of the older idea of a Green's function.
In probability theory and directional statistics, the von Mises distribution is a continuous probability distribution on the circle. It is a close approximation to the wrapped normal distribution, which is the circular analogue of the normal distribution. A freely diffusing angle on a circle is a wrapped normally distributed random variable with an unwrapped variance that grows linearly in time. On the other hand, the von Mises distribution is the stationary distribution of a drift and diffusion process on the circle in a harmonic potential, i.e. with a preferred orientation. The von Mises distribution is the maximum entropy distribution for circular data when the real and imaginary parts of the first circular moment are specified. The von Mises distribution is a special case of the von Mises–Fisher distribution on the N-dimensional sphere.
In mathematics (specifically multivariable calculus), a multiple integral is a definite integral of a function of several real variables, for instance, f(x, y) or f(x, y, z).
In applied mathematics, a transcendental equation is an equation over the real numbers that is not algebraic, that is, if at least one of its sides describes a transcendental function. Examples include:
This is a summary of differentiation rules, that is, rules for computing the derivative of a function in calculus.
In discrete calculus the indefinite sum operator, denoted by or , is the linear operator, inverse of the forward difference operator . It relates to the forward difference operator as the indefinite integral relates to the derivative. Thus