tags:

views:

229

answers:

5

Can anyone recommend a good math library for use with F#?

I am looking for the moment for something with statistical distributions, but obviously as needs grow, a fuller library will be useful. Something not unlike Numpy for Python for example.

I searched and came across the Math.Net project.. They have a new library math.net which seems to be alpha, and an old one (Iridium) which seems to be depracated or something). If somebody has experience with either of these, can they advice?

+3  A: 

I have to admit that I don't have much experience with these numerical libraries myself (yet!), however, here are some information and links that you may find useful.

  • There were a few open source .NET math projects, but all of them were merged into Math.NET, so I think that this project is currently the choice if you're looking for mathematical library for .NET (the source projects were dnAnalaytics and Iridium)

  • Aside from that, there are also some comercial libraries (if open source isn't a strict requirement). Extreme Optimization and IMSL Numerical Library both list F# as a supported language.

  • There is also Microsoft Solver Foundation, which is a more specific tool (solving constraints etc.), but could be also relevant. This is not open-source (as far as I know), but is freely available.

[EDIT: Added Microsoft Solver Foundation]

Tomas Petricek
IMSL make .NET libraries, so yes they support F#. But functional programming has way much to bring to math programming than mere black-box optimization routines
Alexandre C.
It is a pity that the development of Math.Net has been paused for more than one year now. However, the authors claimed that there would be some progress this summer.
Yin Zhu
@ Alex I don't think so. FP is good at abstractions. These libraries providers sell mature linear algebra functions. an SVD is an SVD. Not need to abstract out anything. FP is good at connecting 100 math functions to build an application. However, on implementing one math function, say SVD, imperative languages are better.
Yin Zhu
@Yin Zhu: FP libraries should be high order functions which connect 100 math functions for you. Black box SVD or Levenberg or whatever are in the imperative realm. A FP math library should provide you more than that.
Alexandre C.
+3  A: 

Microsoft is working with Enthought to produce a .NET version of NumPy and SciPy. See the announcement here. NumPy will come out first.

In the mean time, you can get to NumPy from .NET by going through IronClad. There's a link to details about IronClad in the announcement.

John D. Cook
This is great news! Once that is done, an F# wrapper would solve the math library problem to some extent.
Yin Zhu
This is definitely good news. thanks.
Muhammad Alkarouri
+2  A: 

There are a couple of other commercial libraries made by the Flying Frog Consultancy (the F# for Numerics and F# for Visualisation libraries)

smhillary
A: 

The only math library specifically for F# is our (commercial) F# for Numerics library. As for open source libraries, I surveyed many before I decided to write a commercial one to address their deficiencies and, IMHO, the best open source math library by a country mile is Alglib which is usable from F# but not designed to be F# friendly. In fact, it uses Fortran style...

Jon Harrop
Jon has a point here. If a library is *designed for* F# it has the potential for being a lot less cumbersome to use.
Mau
+2  A: 

If you want BLAS and LAPACK, i.e. basic operations and linear algebra for dense matrices, you can use F# Math Provider.

This was an experimental component, already deprecated by MSR. But I found it quite useful and the code is still available in F# PowerPack's source code. You can know more about it through my blog posts, in which you will get information on how to compile the DLLs and how to use it.

Yin Zhu