Thursday, September 07, 2006

Learn Maths with Haskell

This is a quick plug for the web site of a friend of mine, David Amos. He's been working hard to produce a treasure trove of useful mathematical code in Haskell with the intention of making abstract objects more accessible to mathematics learners.


Highlights include code for


  1. Commutative algebra, including Gröbner basis computation and tools for manipulating ideals of rings.
  2. Permutation groups, including an implementation of the Schreier-Sims algorithm and tools for investigating the Rubik's cube group and its subgroups.
  3. Number theory. Includes tools for working with quadratic fields, p-adic numbers and elliptic curves, and code for factoring using Lenstra's elliptic curve algorithm.

The full repository is here. (Use that link to download the code as some of the other links appear to be broken right now.)


It'd be great to see a textbook grow out of some of this work...

2 comments:

Dave Menendez said...

There is The Haskell Road to Logic, Maths and Programming.

David R. MacIver said...

Hm. Sounds like something I'm working on (I'm using ML rather than Haskell, with an intent to port it to OCaml, but there's not much difference in the implementations really.)

Someone I know has a database of topological spaces, mostly extracted from the book "Counterexamples in Topology". There are various nice properties of topological spaces which are best described by assigning cardinal numbers to them. So it occurred to me that it would be really quite nice to expand the database to include these properties.

Which means that one needs the computer to be able to deal with cardinal numbers (ok, you could just represent them as strings. But that would suck, as it might get confused between max{ aleph_2, 2^aleph_0 } and max { 2^aleph_0, aleph_2 } and I wouldn't for example be able to search for all spaces with weight <= aleph_7).

This turns out to be harder than it looks.

I'm currently treating it as an algebraic datatype with constructors pow, succ, max, min and aleph0 and then applying various redunction rules based on these. It's rather fiddly, and will probably be embarassingly inefficient when it's finished. Also it doesn't handle things like Aleph_omega, and won't until I get around to writing an ordinal datatype and reimplementing this entirely. :-)

Blog Archive