BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Numerical Computing with F#

by Roopesh Shenoy on Nov 28, 2011 |

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.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

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.

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.

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.

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!

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!)

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

5 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT