I been looking at the recent blog post by Jeff Atwood on Alternate Sorting Orders. I tried to convert the code in the post to C# but I ran into an issue. There is no function in .NET that I know of that will return the z-value, given the percentage of area under the standard normal curve. The recommended values to use for the algorithm are 95% and 97.5% which you can look up on the z-value table in any statistics book.
Does anyone know how to implement such a function for all values of z or at least to 6 standard deviations from the mean. One way would be to hard code the values into a dictionary and use a look up but there has to be a way of calculating the exact value.
My attempt at solving this was to take a definite integral of the standard normal curve function.
y = (1 / (sqrt(2 * PI))) * e^(-(1/2) * x^2)
This gives me the area under the curve between two x values but then I am stuck… Maybe I am way of base and this is not how you would do it?
Thanks.
解决方案
Here's some code for the normal distribution written in Python, but it could easily be translated to C# by adding some punctuation. It's just about 15 lines of code.