C# 中的复杂计算

发布于 2024-08-02 20:53:36 字数 177 浏览 2 评论 0 原文

.NET (C#) 中可用于计算的最佳工具(最有效)是什么:

  • 积分
  • 偏导数
  • 其他非平凡的数学

人们可以评论 Mathematica 和 Matlab 以及它们与 C# 的集成吗

What are the best tools (most efficient) available in .NET (C#) for calculating:

  • integrals
  • partial derivatives
  • other non-trivial math

Can people please comment on Mathematica and Matlab and their integration into C#?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

献世佛 2024-08-09 20:53:36

Math.NET 是一个用 C# 编写的 Microsoft .NET 平台数学开源工具包,旨在提供一个自包含数值科学和符号代数计算的清晰框架。特别是,Math.NET NumericsdnAnalyticsMath.NET Iridium 并包含以下内容特征:

  • 实数和复数、稠密和稀疏线性代数(带有 LUQR, 特征值,...分解)
  • 数值函数积分(求积)例程
  • 积分变换

Math.NET is a mathematical open source toolkit written in C# for the Microsoft .NET platform that aims to provide a self-contained clean framework for both numerical scientific and symbolic algebraic computations. In particular, Math.NET Numerics is the result of the merger of dnAnalytics with Math.NET Iridium and includes the following features:

  • real and complex, dense and sparse linear algebra (with LU, QR, eigenvalues, ... decompositions)
  • numerical function integration (quadrature) routines
  • integral transforms
相对绾红妆 2024-08-09 20:53:36

我不能保证它是最好的或更有效的,但几天前我了解到 Luca Bolognese 为 .NET 开发了一个财务函数库,

您可以在这里找到它:http ://code.msdn.microsoft.com/FinancialFunctions

也许它对您有用。

I can't vouch for it being the best or more efficient, but a couple of days ago I learned that Luca Bolognese has developed a library of financial functions for .NET

You can find it here: http://code.msdn.microsoft.com/FinancialFunctions

Maybe it'll be usefull for you.

Bonjour°[大白 2024-08-09 20:53:36

我没有使用 Mathematica/.NET 桥的经验,但我使用过 Mathematica/Java 桥,从文档来看,它非常相似。当然,我无法回答的一个问题是接口的实现在稳定性和性能方面有多好。

从概念上讲,我发现调用 Mathematica 的 Java 接口非常好。您有一组对象和方法,可让您启动 Mathematica 会话并将 Mathematica 表达式发送给它们进行计算。您可以发送文本(在简单情况下很容易,但如果您想要一些不平凡的东西,则很棘手)或反映语法树结构的更结构化的 Expr 对象。这些表达式将允许您执行几乎所有操作:以数值或符号方式计算积分、求导数、求解 ODE 等等。

它下降的一个领域是错误处理。 Mathematica 本身没有例外;相反,当遇到麻烦时,它会生成“消息”并继续尝试评估正在处理的表达式。考虑到 Mathematica 相当不寻常的语义(它对具有重复规则重写的表达式进行操作),这是有一定道理的,但是与 Mathematica 通信的默认方法集不允许您轻松地从 Java 中监视这些消息(或者,它似乎、.NET),尽管可以编写自己的方法来做得更好。

I don't have experience with the Mathematica/.NET bridge, but I have used the Mathematica/Java bridge, which, judging from the documentation is pretty similar. Of course, one question I can't answer is how good the implementation of the interface is in terms of stability and performance.

Conceptually, I've found the Java interface for calling out to Mathematica be pretty good. You have a set of objects and methods that let you start Mathematica sessions and send Mathematica expressions to them to be evaluated. You can either send text (which is easy in simple cases but tricky if you want something non-trivial) or more structured Expr objects that mirror the syntax tree structure. These expressions will allow you to do just about anything: evaluate integrals numerically or symbollically, take derivatives, solve ODEs, and so on.

The one area where it falls down some is in error handling. Mathematica doesn't have exceptions per se; instead it produces "messages" when it runs into trouble and continues trying to evaluate the expression it's working on. This makes some sense in light of Mathematica's rather unusual semantics (where it operates on expressions with repeated rule rewrites) but the default set of methods for communicating with Mathematica doesn't allow you to easily monitor those messages from within Java (or, it appears, .NET), though it is possible to write your own methods that do a better job of this.

岛徒 2024-08-09 20:53:36

Microsoft 的 Visual F# 编程语言是专门为此类工作而设计的,因此您可能只想从 C# 代码调用现有的 F# 解决方案。例如,在安装了 F# for Numerics 库的 Visual Studio 2010 中,您可以集成x3-x-1 从 -3 到 3 交互如下:

> Functional.integrate (fun [x] -> x**3.0 - x - 1.0) [-3.0, 3.0];;
val it : float = -6.0

并计算该函数在 x=2 处相对于 x 的偏导数如下:

> Functional.d (fun x -> x**3.0 - x - 1.0) 2.0;;
val it : float = 11.0

Microsoft's Visual F# programming language was specifically designed for this kind of work so you probably just want to call an existing F# solution from your C# code. For example, in Visual Studio 2010 with our F# for Numerics library installed you can integrate x3-x-1 from -3 to 3 interactively as follows:

> Functional.integrate (fun [x] -> x**3.0 - x - 1.0) [-3.0, 3.0];;
val it : float = -6.0

and compute that function's partial derivative with respect to x at x=2 as follows:

> Functional.d (fun x -> x**3.0 - x - 1.0) 2.0;;
val it : float = 11.0
自找没趣 2024-08-09 20:53:36

You might check out http://www.dmoz.org/Science/Math/Software/ - they list several C# ones. I'd say try a few (demo editions if commercial) and do some profiling to see if they meet your requirements. You could also use MATLAB - see the Limitations and Alternatives section of that entry. (I have no personal experience with these tools.)

无声静候 2024-08-09 20:53:36

看看 f# http://research.microsoft.com/ en-us/um/cambridge/projects/fsharp/

它将成为 Visual Studio 2010 的一部分。

Have a look at f# http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/

It will be part of Visual Studio 2010.

老子叫无熙 2024-08-09 20:53:36

如果您有附加产品 MATLAB Builder for .NET,则可以将 MATLAB 代码打包到可从 C# 调用的 .NET 程序集中。

If you have an add-on product MATLAB Builder for .NET, you can package MATLAB code into a .NET assembly that can be called from C#.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文