IX.Math project


IX.Math is a .NET library that reads mathematical formulas as text and creates delegates and delegate placeholders for solving them at runtime.

The library is capable of interpreting any mathematical expression that makes sense from a logical perspective, complete with a few mathematical functions. It supports integer numbers (as long in standard numeric formats), floating-point numbers (as double), strings (as string), binary data (as byte[]), and boolean (as bool) values, and can compute the most common mathematic operations, as well as certain mathematics functions.


Requirements for IX.Math are the same across IX projects. This page lists estimative .NET version support information across various frameworks and OSes.

Go here for the


  • NuGet: IX.Math NuGet
  • Latest stable: Latest, package: IX.StandardExtensions NuGet

What you can do with it

Let's assume that you have a text box in which a user can introduce a formula:


You need to calculate the value of what the user has typed in for later use. In order to do that, since the user can input any formula they wish, you would need an interpreter that works with a given set of rules and that can calculate what the user types in.

With IX.Math, you can calculate formulas with varying degrees of complexity:

1+2   // 3
(1+2)*5   // 15
sqrt(25)+max(2,17)+min(sqrt(45)*sin(12),floor(pi))   // 25

...and so on.

Even if your formula involves different data types, you can still do calculations:

25*strlen("abc")   // 75
substr("ABC",1,1)+"ecause of love"   // "Because of love"
"I have "+min(strlen("abc"),5)+" oranges."   // "I have 3 oranges"

From within your .NET software, you can go with more complex formulas that can even contain external variables:


...where x and y can be provided either as parameters to a delegate that is created for you, or as externally-held data through the use of a data finder class. Assuming that x=3 and y=5, the above formula would yield 25.

Even assuming that your data changes and you wish to plot variations accross time, you can still use IX.Math. Let's assume that calling multiple times for the value of x returns 1, then 2, then 3:

"The values accross time are: "+x+","+x+", and "+x   // "The values are 1, 2, and 3"

Logical and bitwise operations are supported:


Comparison and equation are also supported:


...and, if you wish to specify tolerance for these operations, there are a multitude of ways to specify tolerance, including range and percentage.

You can even rename your own operators:

x add y
x subtract y
x multiply by the power of 8
x [ y
x $big$boss$ y   // We don't judge

...or create custom functions, interpret values in funny ways, and many many more!


Licenses and structure

This project uses the MIT license.