Lisp、OCaml 还是 Runge Kutta?

发布于 2024-09-03 07:02:08 字数 238 浏览 8 评论 0原文

您建议使用哪种语言来求解系统:

  • 一阶微分方程
  • 复变量
  • N 维

使用四阶龙格库塔等的

。速度很多,但会牺牲:

  • 优雅(干净且简短)的代码
  • 灵活性 + 可扩展性

我主要在 Lisp 和 OCaml 之间,但欢迎任何其他建议。

谢谢!

Which language would you propose for solving a system with:

  • first order differential equations
  • complex variables
  • N-dimensions

using 4th order Runge Kutta or the like.

Speed matters a lot but would sacrifice for:

  • Elegant (clean and short) code
  • Flexibility + scalability

I'm mostly between a Lisp and OCaml but any other suggestion is welcomed.

Thanks!

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

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

发布评论

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

评论(7

婴鹅 2024-09-10 07:02:08

下面是 Common Lisp 中 RK 的实现:

http://github.com /bld/bld-ode/blob/master/rk.lisp

Common Lisp 的好处是,您可以从简单而优雅的代码开始,然后使关键部分快速运行(例如,通过从主要功能切换到有状态计算,或通过声明类型)。

SBCL 拥有出色的本机代码编译器。

Here's an implementation of RK in Common Lisp:

http://github.com/bld/bld-ode/blob/master/rk.lisp

The nice thing about Common Lisp is that you can start with simple and elegant code and then make the critical bits run fast (e.g. by switching from mostly functional to stateful computation, or by declaring types).

SBCL has an excellent native-code compiler.

弄潮 2024-09-10 07:02:08

RK4 是一种非常基本的方法,并且已经编写了许多优秀的实现。使用其中之一,并将精力花在项目的其他方面。

RK4 is a very basic method, and there lots of excellent implementations that are already written. Use one of them, and spend your effort on other aspects of the project.

谁的年少不轻狂 2024-09-10 07:02:08

我不熟悉 Runge Kutta,但 OCaml 总体上可以提供良好的速度和可读性,至少如果您小心一点的话。然后,您的应用程序的其余部分就可以享受到强大的静态类型系统的优势。

I'm not familiar with Runge Kutta, but OCaml can provide good speed and readability in general, at least if you're a bit careful. You then have the advantage of a robust static type system for the rest of your application.

甜扑 2024-09-10 07:02:08

除此之外,您还可以将 OCaml 绑定写入现有的 C runge-kutta 求解器。

Apart from anything else, you can write OCaml bindings to your existing C runge-kutta solver.

并安 2024-09-10 07:02:08

很难说哪种语言最简单,有 lispC++, 内置对 ODE 的支持...Lisp 可能比较慢...而且我不能代表 OCaml。

Its hard to say which language would be easiest, there are lisp, C++, C#, etc libraries to accomplish this, so alot if it has to do with personal preference. I would speculate Matlab is the most tailored and elegant solution specifically for these types of tasks, and it has a lot of built in support for ODEs... Lisp may be on the slow side... and I can't speak for OCaml.

作死小能手 2024-09-10 07:02:08

我建议使用 python+numpy+scipy,一般数学和数字支持(超级多维数组)非常好。无论如何,这取决于具体需求。

I would suggest using python+numpy+scipy, the general math and numeric support (superbe multidimensional arrays) is excellent. Anyway it depends on specific needs.

半步萧音过轻尘 2024-09-10 07:02:08

Fortran 或 C,可能需要查看 NAG 例程。 C 会更灵活,也更容易理解,但 Fortran 通常被认为最适合数字。

Fortran or C, might want to look into NAG routines. C would be more flexible, and easier to understand, but Fortran is usually regarded as the best for numerics.

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