Numerical Computing with F#
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 -
Introduction to Numeric Types
Working with Matrices in F#
Defining and working with Custom Numerics in F#
- Generic Numeric Code in F#
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# -
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#
Sho and Solver Foundation are other options for F# by
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#
Re: Sho and Solver Foundation are other options for F#
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!
Camille Fournier May 21, 2015