We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
截至今天,我发现这三个都支持变量和用户定义的函数,但似乎只有 muParser 支持自定义运算符:
对于我的小玩具项目,我选择了 Math Parser .NET 因为它支持
^
的幂,而 NCalc 不支持,而且 muParser 不知何故对我没有那么大的吸引力。还有另一个好处:Math Parser .NET 支持本机 C# 委托作为自定义函数!其他库提供的解决方案看起来并不那么优雅。I've found these three as of today, all of which support variables and user defined functions, but only muParser seems to support custom operators:
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.我使用 IronPython 作为表达式计算器。
I used IronPython as an expression evaluator.
你应该看看 Jace.NET。 Jace 是高性能 C# 数学解析器,支持所有数学运算、变量、(自定义)函数...它支持 Microsoft 的所有主要 .NET 平台:.NET 4.x、Windows Phone 7 和 Windows Phone 7。 8、Windows应用商店。
https://www.nuget.org/packages/Jace
https://github.com/pieterderycke/Jace
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.
https://www.nuget.org/packages/Jace
https://github.com/pieterderycke/Jace
您可以尝试 Mathos Parser (https://mathosparser.codeplex.com/),它允许您添加自定义运算符、自定义变量和自定义函数。它支持 Math 命名空间中的几乎所有操作,并具有一组预先构建的运算符。由于解析器没有那么多依赖项,因此很容易将源代码粘贴到您的项目中(不到 500 行代码)!
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)!
尝试 Irony (http://irony.codeplex.com)。它允许您解析表达式,您可以使用它执行所有操作:构建委托以实现极快的计算,突出显示语法,或者像在我的项目中一样,转换为 Latex 并以数学公式显示其表示形式。
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.