像SymPy的Haskell库? [英] Haskell library like SymPy?

查看:156
本文介绍了像SymPy的Haskell库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要操作像1 + sqrt(3)这样的表达式,并且执行像加法,减法和除法等基本算术。我希望结果具有某种规范形式,以便它可以用作地图中的关键字。将1 + sqrt(3)转换为float值由于舍入问题而不可行。

我在SymPy中使用了Python中的此任务。 Haskell是否有一个等价的本地库?

解决方案

看起来您正在寻找Haskell中的计算机代数系统(CAS)。尽管对Haskell包/模块名称中的代数对象有如此多的引用,但我从来没有听说过Haskell中的通用目的和维护良好的CA系统(如SymPy或Python中的Sage)。



'p>然而,在计算机代数系统的列表上维基百科我已经找到了对

DoCon。代数域构造器



它使用非标准许可证,但我敢说它仍然是开源的(尽管有重命名和归属要求)。截至2010年7月 docon-2.11 仍然使用GHC 6.12.1构建并运行演示/测试(我只需插入 LANGUAGE FlexibleContexts pragma)。
$ b DoCon有详细的文档记录(手册的362页)。它的手册包含在带有源代码的zip文件中,所以为了方便起见,我将它分开在线。

ABY /rel =noreferrer> DoCon 2.11 Manual.ps



请仔细检查它是否适合您的需求。


I need to manipulate expressions like 1 + sqrt(3) and do basic arithmetic like addition, subtraction, and division. I'd like the result to be in some sort of canonical form so that it can be used as a key in a map. Turning 1 + sqrt(3) into a float is not feasible due to roundoff problems.

I used SymPy for this task in Python. Is there an equivalent native library for Haskell?

解决方案

It seems you are looking for Computer Algebra System (CAS) in Haskell. Inspite of so many references to algebraic objects in the names of Haskell packages/modules, I've never heard of a general purpose and well-maintained CA system in Haskell (like SymPy or Sage in Python).

However in the list of Computer Algebra Systems on Wikipedia I've found a reference to

DoCon. The Algebraic Domain Constructor

It uses a non-standard license, but I dare say it is still Open Source (though with rename and attribution requirements). As of July 2010 docon-2.11 still builds with GHC 6.12.1 and runs demos/tests (I only had to insert a LANGUAGE FlexibleContexts pragma in one file of the demo).

DoCon is well documented (362 pages of the Manual). Its Manual is packed inside of the zip with sources, so I put it online separately for convenience:

DoCon 2.11 Manual.ps

Please look through to check if it suits your needs.

这篇关于像SymPy的Haskell库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆