I'm looking for a .NET Math Parser which uses variables, custom operators and user defined functions...
Since today i've used muParser (there's a wrapped version for .NET), but i noticed it is too slow!
Does anybody knows another Math Parser (FREE!) that works pretty good?
I tried NCalc, but it doesn't have variables, so it fails..
For my little toy project I went with Math Parser .NET since it supports ^ for powers whereas NCalc does not, and muParser somehow didn't appeal to me as much. There is another benefit: Math Parser .NET supports native C# delegates as custom functions! The solutions that the other libraries offer don't look that elegant.
More a generic scripting language than a math parser, but have an upvote since the OP didn't specify if he was wanting to do symbolic manipulation.
– user47589
Mar 15, 2011 at 13:29
@Inuyasha Actually when I used it in a project I only needed basic +, - and * calculator, even without variables. So using a scripting engine for it seemed like overkill. But it was just so easy to use, so I went for it.
I didn't do any performance evaluations of IronPython script, because performace wasn't critical for me, so I canot say anything about it. But I believe that you can compile IronPython scripts dynamically and then use the compiled vesions from C#.
You should have a look at Jace.NET. Jace is high performing c# math parser that supports all math operations, variables, (custom) functions... It supports all major .NET platforms of Microsoft: .NET 4.x, Windows Phone 7 & 8, Windows Store.
You could try Mathos Parser (https://mathosparser.codeplex.com/), which allows you to add custom operators, custom variables, and custom functions. It supports almost all operations from Math namespace and has a pre-built set of operators. As the parser does not have that many dependencies, it is very easy to just paste the source code into your project (it is less than 500 lines of code)!
Try Irony (http://irony.codeplex.com). It allows you to parse the expression, which you can do everything with: build a delegate for extremely fast computation, highlight the syntax, or like in my project, converts to Latex and display its representation in math formula.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.