Microsoft Excel® users can easily access NAG routines from both the NAG Fortran Library and the NAG C Library, because they are distributed as Dynamic Link Libraries (DLLs). For example, my colleague Marcin Krzysztofik has recently described how to solve a nonlinear least-squares problem in Excel using the nag_opt_nlin_lsq (e04unc) routine from the NAG C Library.
Recently, we had a query from an Excel user who wanted to invoke a method from the NAG Library for .NET. One way to do this is to use Visual Studio Tools for Office (VSTO) to create a customized Excel workbook that loads a .NET assembly when it is opened. Events in the workbook (e.g. typing values in cells or clicking buttons) then call assembly methods which can access workbook data and - for example - call NAG methods to process it.
My colleague Sorin Serban and I have illustrated this by producing a demo Excel workbook which fits a surface to a set of points in 3D space. More specifically, it uses the NAG method e01da to compute a bicubic spline through a set of data values on a rectangular grid, and then invokes e02df to calculate the values of the spline on the grid. The user can edit the data values in the workbook, and can also select a subset of the points to be used in the fit.
Screenshot of Excel demo, showing the data points in the table at the top, along with a histogram of the points at bottom left. A subset of the points has been selected by the user, and the NAG methods have been used to fit and calculate the bicubic spline surface which passes through them (displayed bottom right).
The demo is freely available for download as a deployed VSTO solution from this location, whilst more information about its working and installation - including how to obtain a trial licence for the NAG Library for .NET, which is required to run the demo - can be found in this README (a copy of which is also contained in the demo distribution). To obtain a copy of the full solution (including the assembly C# source code which invokes the NAG methods), please contact NAG support.