BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Numerical Computing with F#

Numerical Computing with F#

Bookmarks

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.

Rate this Article

Adoption
Style

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.

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

Community comments

  • Generic numeric code in F#

    by Tomas Petricek,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    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

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

BT