InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Numerical Computing with F#

Posted by Roopesh Shenoy on Nov 28, 2011

Sections
Architecture & Design,
Development
Topics
F# ,
.NET Framework ,
.NET Languages ,
.NET ,
Programming

F# is emerging as a great choice for Numerical computing. Reasons? Functional design, libraries such as PowerPack, MathProvider and Math.NET and the interoperability of the .NET Framework.

F# PowerPack is a collection of libraries and tools for F# provided by Microsoft. It brings additional types, lexer and parser generation tools, document generator, enhancements to Async and Parallel capabilities and more.  Tomas Petricek has written a series of articles on numeric types provided by PowerPack -

There is also a set of samples and tutorials on MSDN on the same topic.

Other libraries that are useful for dealing with Numerics in F# -

  • MathProvider brings linear algebra to F# by providing a wrapper for native BLAS and LAPACK runtimes. 
  • Math.NET Numerics provides methods and algorithms for various scientific and engineering numeric computations, such as special functions, probability models, integral transforms, etc. MSDN has a tutorial on how to use Math.NET numerics in F#.

F# is often compared with other numerical computing languages like R and MATLAB. However, .NET applications can call both MATLAB and R and this allows F# to be used alongside special purpose languages to get the best of both worlds.

Generic numeric code in F# by Tomas Petricek Posted
Re: Generic numeric code in F# by Roopesh Shenoy Posted
Re: Generic numeric code in F# by Tomas Petricek Posted
Sho and Solver Foundation are other options for F# by Faisal Waris Posted
Re: Sho and Solver Foundation are other options for F# by Roopesh Shenoy Posted
  1. Back to top

    Generic numeric code in F#

    by Tomas Petricek

    Thanks for posting links to the articles at InfoQ! I just published the fourth article of the series which explains how to write Generic numeric code in F#. If it could be added to the list of the articles, that would be perfect :-). I think this is actually another very important reason for writing numeric code in F#. As far as I know, F# is the only .NET language that solves this problem efficiently and fairly elegantly.

  2. Back to top

    Sho and Solver Foundation are other options for F#

    by Faisal Waris

    For non-commercial applications, you can also use Sho (developed by Microsoft Research)

    Sho includes Intel MKL libraries (which MATLAB also uses) for very high performance linear algebra. Sho also includes packages for statistics and signal processing.

    Solver Foundation (also from MSR) provides key solvers for linear, non-linear and constraint programming. The free "Express" version is limited for linear and quadratic models but is unrestricted for non-linear models. Coveted routines such as L-BFGS are available in supported, production quality form.

    For data visualization, Sho and FSharpChart provide convenient wrappers over .Net DataVisualization.

    An important point is that F# is really good at data integration and manipulation; often, the big work is in processing the data to feed it into numerical computing libraries (which are mostly freely available now).

    One advantage of using F# over say R or MATLAB is that you can more easily embed the final product into a regular .Net application. F# interactive mode - while not as easy to use as MATLAB's - is decent enough for interactively developing the solution to a numerical problem.

  3. Back to top

    Re: Generic numeric code in F#

    by Roopesh Shenoy

    Sorry, Tomas, I missed your last article since I started working on this post before you posted that - have added the link.

  4. Back to top

    Re: Sho and Solver Foundation are other options for F#

    by Roopesh Shenoy

    Yes Solver Foundation is a great tool with its built-in solvers and add-on architecture. Cost is something that's not fixed yet though.

    I agree about F# being good at data integration and manipulation - especially with Type providers and LINQ. I guess that's what makes it powerful!

  5. Back to top

    Re: Generic numeric code in F#

    by Tomas Petricek

    Thanks for adding it - I actually published the last blog post after this article appeared on InfoQ (which convinced me to finally finish the last blog post!)