A quick and dirty implementation of Excel NORMINV function in C#

We are piloting the implementation of some financial risk models in F#, it so happens that the models are already implemented in Excel, so I was slowly digging out the formulas in the cells and translating them to F#. Everything was going fine until I found out that some formulas used the NORMINV function which doesn't exist in the .NET libraries. I started to look for F#, and then C#, implementations without luck (as we are just in the lets-see-if-this-have-any-chance-of-flying stage, we can’t afford any of the excellent but paid numerical libraries for .NET). The closest thing I found was a C++ implementation. The code looked really weird to me (my fault, not the coder's), so I decided to do the translation in two steps: first from C++ to C#, then on to F#. The C# translation seems to be working now, and you can download it from SkyDrive:

Please be aware that:

  1. I am not an expert in statistics by any stretch of imagination
  2. Ditto for numerical methods
  3. I have made only a handful of very basic tests

Having said that, the function *seems* to be working so I hope it will help somebody Sonrisa.

Published Thursday, July 29, 2010 5:19 PM by Edgar Sánchez
Filed under: , ,

Comments

# Twitter Trackbacks for A quick&dirty implementation of #Excel NORMINV function in C# (by yours truly, so shame on you if you use it :P) [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 A quick&dirty implementation of #Excel NORMINV function in C# (by yours truly, so shame on you if you use it :P)         [asp.net]        on Topsy.com

# re: A quick and dirty implementation of Excel NORMINV function in C#

Friday, July 30, 2010 1:27 AM by robin jackman

I like your blog and such a useful information sharing. I appreciate your blog and thanks for that.

# A quick and dirty implementation of Excel NORMINV in F#

Monday, August 09, 2010 12:24 AM by .NET at 9.400 ft above sea level

A couple of weeks ago I posted an example implementation of Excel NORMINV function in C#, in there I

# re: A quick and dirty implementation of Excel NORMINV function in C#

Tuesday, February 01, 2011 1:59 AM by joomla development

i appreciate your blog because of unique and informative content.

# re: A quick and dirty implementation of Excel NORMINV function in C#

Monday, July 25, 2011 10:51 AM by rca ieftin

This implementation of the code seems to be faster and easier than the latest version of the code.

Leave a Comment

(required) 
(required) 
(optional)
(required)