mXparser - Tutorial

mXparser - logo

Did you find the software useful? Please consider donation 🙂
Developing and maintaining MathParser.org-mXparser takes a lot of time, mainly my free time. I hope it saved some of your time. If yes, then buy me a coffee 🙂
DONATE

- Printing the license

  • mXparser.consolePrintln( mXparser.LICENSE );

Using internal help

  • Full help content
  • In-line help searching

- Simple expressions

  • Simple calculation
  • Changing expression string
  • Using operators
  • Power function
  • Using numbers in scientific notation
  • Percent sign - ! new ! (since 4.1 Aeries)
  • Leading zeros - ! new ! (since 4.1 Aeries)

- Evaluating relations

  • Binary relation "="
  • Binary relation "<"
  • Boolean operator "OR"
  • Boolean operator "AND"

- Using built-in functions

  • Unary function
  • Binary function
  • Function with 3 arguments
  • Function with n-arguments
  • Function with even number of arguments

- User defined arguments

  • Dealing with free arguments
  • Defining dependent arguments

- Summation & Product iterated operators

  • SIGMA summation operator
  • PI product operator
  • SIGMA summation operator - Approximating sin(x) by Taylor series
  • SIGMA summation operator - Approximating pi value by integrating sqrt(1-x^2)

- Derivatives & Integrals

  • General derivative
  • Left / right derivative
  • Derivative from more complex function
  • Derivative - alternative syntax - ! new ! (since 4.1 Aeries)
  • Integrals - calculating pi by integration sqrt(1-x^2)

- Built-in constants

  • Using built-in constants
  • Estimating Moon gravitational acceleration
  • Getting list of constants

- Built-in Units

  • Units of length / distance
  • Units of time
  • Units of information
  • Units of volume
  • List of supported units

- Built-in Metric prefixes

  • Example: 10 Millions / Kilo
  • List of supported metric prefixes

- Bitwise Operators

  • Bitwise unary complement
  • Bitwise AND
  • Bitwise exclusive OR
  • Bitwise inclusive OR
  • Signed left / right shift

- User defined functions

  • Fast function definition (performance of creation)
  • Handy function constructor, but slower proces of function creation (performance of
  • creation slower, but calculation the same)
  • Function with more parameters
  • Function in function
  • Implementing your own Function Extension

- User defined constants

  • Defining constant - various options

- Fast (limited) user defined recursion

  • Fibonacci numbers using fast recursion

- User defined recursion - not limited

  • Fibonacci numbers using user defined recursive function
  • Number of recursive parameters is not limited - binomial coefficient definition using user defined recursive function
  • Mixing function parameters - part causing recursive calls, other part as 'typical' parameter. Below example is presenting definition of Chebyshev polynomial using recursive function.
  • Indirect recursion - approximating sin(x) and cos(x)

Prime Numbers

  • Primality test function
  • Primes counting function
  • Using built-in primes cache to accelerate calculations
  • Estimating number of primes using Offset logarithmic integral function
  • Prime factorization - ! new ! (since 4.1 Aeries)

- Inspecting calculation process

  • Setting the verbose mode
  • Syntax checking
  • Lexical syntax checking
  • Getting computing time

- Random numbers

  • Random number from uniform continuous distribution
  • Random number from uniform discrete distribution
  • Random number from normal distribution
  • Random number from a given list
  • Estimating mean of Normal distribution
  • Estimating standard deviation of Normal distribution
  • Estimating variance of Normal distribution

- PDF, CDF and Quantile functions

  • Expected value estimation using Probability Distribution Function
  • Probability estimation using Cumulative Distribution Function - the law of 3*SIGMA
  • Calculating quantiles using Inverse Cumulative Distribution Function - males height example assuming males height distribution N(170, 15)

- Solving equation f(x) = 0

  • Solve 2x-4 = 0 for x in [0, 10]
  • Solve cos(x) = 0 for x in [0, pi]
  • Solve cos(x) = 0 for x in [pi, pi] (root not bracketed)
  • Solve x-y = 0 for x in [0, 10] and y = 4
  • Solve sin'(x) = 0 for x in [0, pi]

- Built-in Random Variables

  • Random integer
  • Random integer N: -10^k <= N <= 10^k for k = 1, 2, ...,9
  • Random natural number
  • Random natural number N <= 10^k for k = 1, 2, ...,9
  • Uniform continuous distribution U(0,1)
  • Normal distribution N(0,1)

User defined Random Variables

  • Dependent argument as user defined random variable
  • User defined function as user defined random variable - random walk example

Playing with expression tokens

  • Printing expression tokens
  • Using tokens to print expression in a fancy way
  • Playing with invalid tokens

Various numeral systems

  • Binary number - ! new ! (since 4.1 Aeries)
  • Octal number - ! new ! (since 4.1 Aeries)
  • Hexadecimal number - ! new ! (since 4.1 Aeries)
  • Unary number - ! new ! (since 4.1 Aeries)
  • Unary zero - ! new ! (since 4.1 Aeries)
  • Base 1 - 36 number literals - ! new ! (since 4.1 Aeries)
  • Base N numeral system - ! new ! (since 4.1 Aeries)

Working with NaN (Not-a-Number)

  • NaN in condition - ! new ! (since 4.1 Aeries)
  • NaN symbol - ! new ! (since 4.1 Aeries)
  • First non-NaN value - ! new ! (since 4.1 Aeries)

Built-in tokens (key words) manipulation

  • Removing built-in tokens - ! new ! (since 4.1 Aeries)
  • Modifying built-in tokens - ! new ! (since 4.1 Aeries)
  • Overriding built-in tokens - ! new ! (since 4.1 Aeries)

*** 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